diff options
Diffstat (limited to 'src/usr/diag/prdf/common')
236 files changed, 57862 insertions, 0 deletions
diff --git a/src/usr/diag/prdf/common/framework/config/iipConfigurator.C b/src/usr/diag/prdf/common/framework/config/iipConfigurator.C new file mode 100755 index 000000000..2b3bb8ca1 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/iipConfigurator.C @@ -0,0 +1,68 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/iipConfigurator.C $ */ +/* */ +/* 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 */ + +// Module Description ************************************************** +// +// Description: +// +// End Module Description ********************************************** +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define iipConfigurator_C + +#include <iipConfigurator.h> + +#undef iipConfigurator_C +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +namespace PRDF +{ + +Configurator::~Configurator() +{ +} + +} // End namespace PRDF diff --git a/src/usr/diag/prdf/common/framework/config/iipConfigurator.h b/src/usr/diag/prdf/common/framework/config/iipConfigurator.h new file mode 100755 index 000000000..311a1fc78 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/iipConfigurator.h @@ -0,0 +1,211 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/iipConfigurator.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 Configurator_h +#define Configurator_h + +// Class Specification ************************************************/ +// +// Name: Configurator +// Parent class: None. +// +// Summary: Instantiates a chip object for each hardware chip that +// is marked as functional in the syspit. Instantiates all +// the PRD Domains and assigns chip objects to them. Creates +// the system and transfers chip and domain lists to it. +// +//## Class: Configurator; Abstract +//## Category: PRDCommon +//## Subsystem: PRDCommon +//## Concurrency: Sequential +//## Persistence: Transient +//## Cardinality: 1 +//## Uses iipspit {1 -> 1} +//## Creates instances of: Domain {1 -> n} +//## Creates instances of: CHIP_CLASS {1 -> n} +// +// Notes: There is only one type of configurator per PRD bind which is +// determined at compile time by the definition of getConfiguratorPtr() +// +// Usage Example: +// Configurator * c = getConfiguratorPtr(); // CreateConfigurator +// System *system = c->build(); +// if(!rc) +// { +// Configurator::chipList cl = c->getChipList(); +// Configurator::domainList d = c->getDomainList(); +// } +// . +// . +// delete c; +// BIG NOTE: +// (Delete will NOT destroy the chip or domain instances created by +// the build function - only the vectors of pointers to the instances) +// +// End Class Specification ********************************************/ +//---------------------------------------------------------------------- +// Reference the virtual function tables and inline function +// defintions in another translation unit. +//---------------------------------------------------------------------- + +// Includes +#if (!defined(_CPU_H) && !defined(CPU_H)) +//#include <cpu.h> +#endif + +#include <prdfMain.H> + +#include <vector> +/*--------------------------------------------------------------------*/ +/* Forward References */ +/*--------------------------------------------------------------------*/ +class CHIP_CLASS; +class Domain; +class System; + +namespace PRDF +{ + +class Configurator +{ +public: + + typedef std::vector<CHIP_CLASS *> chipList; + typedef std::vector<Domain *> domainList; + + static Configurator * getConfiguratorPtr(); + // Function Specification ************************************* + // + // Purpose: returns a ptr to an instance of the Configurator + // Notes: There is one and only one type of configurator for each + // hardware platform - the correct one is determined at + // compile time by the definition of this function. + // new is used to create the object and can be + // deleted when it is no longer needed. + // + // End Function Specification ********************************* + + //## Destructor (generated) + virtual ~Configurator(); + + virtual System * build()=0; + // Function Specification ******************************************** + // + // Purpose: Builds chipList and domainList and system + // Parameters: None + // Returns: Ptr to system | NULL + // Requirements: Global ptr to syspit object has been initialized + // Promises: All chip objects and domain objects for system intantiated + // Exceptions: None + // Concurrency: Sequential + // Notes: + // Instantiate a chip object for each hardware chip that is + // marked as functional in the syspit. + // Instantiates the domains in the system and assign chips. + // This function should only be called once. + // If any fail conditions are encoutered then an SRC is written to + // the SOT using SRCFILL. If NULL is returned then chiplist and + // domainlist may not be complete. + // + // End Function Specification ****************************************** + +protected: + + chipList & getChipList() { return(sysChipLst); } + // Function Specification ******************************************** + // + // Purpose: Get reference to a vector of pointers to chips + // Parameters: None + // Returns: Reference to chipList + // Requirements: Build must have been called prior to this + // Promises: chipList contains all chip objects for the system + // Exceptions: None + // Concurrency: Sequential + // + // End Function Specification ****************************************** + + domainList & getDomainList() { return(sysDmnLst); } + // Function Specification ******************************************** + // + // Purpose: Get reference to a vector of pointers to domains + // Parameters: None + // Returns: Reference to domainList + // Requirements: Build must have been called prior to this + // Promises: domainList contains all domain objects for the system + // the appropriate chips have been assigned to each domain + // Exceptions: None + // Concurrency: Sequential + // + // End Function Specification ****************************************** + +protected: + Configurator(int max_chips = 50, int max_domains = 4) + { + sysChipLst.reserve(max_chips); + sysDmnLst.reserve(max_domains); + } + // Function Specification ******************************************** + // + // Purpose: Constructor + // Parameters: Maximum number of chips and domains expected in the system + // Specifying maximums causes memory to be managed more efficiently + // Returns: Nothing + // Requirements: None + // Promises: Instance of this class created + // Exceptions: None + // Concurrency: Sequential + // + // + // End Function Specification ****************************************** + +//## Equality Operations (generated) +// int operator==(const Configurator &right) const; +// int operator!=(const Configurator &right) const; + + + chipList sysChipLst; // List of chips in the system + domainList sysDmnLst; // List of domains in the system + +private: + + Configurator(const Configurator &right); + const Configurator & operator=(const Configurator &right); + + // Function Specification ******************************************** + // + // Purpose: Copy constructor / Assignment operator + // Parameters: Reference to instance of Configurator + // Returns: Nothing + // Requirements: These operations are not allowed + // Promises: Prevents copies / Assignments from being made + // Exceptions: None + // Concurrency: n/a + // Notes: No definition should exist + // + // End Function Specification **************************************** + +}; + +} // End namespace PRDF + +#endif diff --git a/src/usr/diag/prdf/common/framework/config/iipDomain.C b/src/usr/diag/prdf/common/framework/config/iipDomain.C new file mode 100755 index 000000000..5a86822af --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/iipDomain.C @@ -0,0 +1,84 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/iipDomain.C $ */ +/* */ +/* 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 */ + +// Module Description ************************************************** +// +// Description: This module provides the implementation for the PRD +// Domain class. +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define iipDomain_C + +#include <iipDomain.h> + +#undef iipDomain_C + +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +Domain::Domain(DOMAIN_ID domain_id) : +dom_id(domain_id) +{ +} + +Domain::~Domain(void) +{ +} + +int32_t Domain::Initialize (void) +{ + // Default = do nothing + return(SUCCESS); +} + + +// @jl02 Add this for Unit CS. This is a virtual function so it doesn't need and code here. +void Domain::Remove(TARGETING::TargetHandle_t i_ptargetChip) +{ +}; +// @jl02 a End. diff --git a/src/usr/diag/prdf/common/framework/config/iipDomain.h b/src/usr/diag/prdf/common/framework/config/iipDomain.h new file mode 100755 index 000000000..4fdab1a57 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/iipDomain.h @@ -0,0 +1,126 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/iipDomain.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 iipDomain_h +#define iipDomain_h + + +#include <iipconst.h> // Include file for DOMAIN_ID's +#include <iipchip.h> // @jl02 +#ifndef IIPSDBUG_H +#include <iipsdbug.h> // Include file for ATTENTION_TYPE +#endif + +// Forward References +struct STEP_CODE_DATA_STRUCT; + +/*! + Domain class provides error analysis of a specific domain of a hardware system + + Usage Examples: + @code + // during PrdInitialize() + Domain * domain = new DerivedDomain(id,...); + int32_t rc=domain->Initialize(); // Perform domain dependent hardware init + + // During PRD Analyze: called from System_Class + if (domain->Query()) // Query for domain at attention + { + // Analyze the attention + int32_t rc=domain->Analyze(service_data,System_attention_type); + } + + DOMAIN_ID id = domain->GetId(); - Get the current domains id. + @endcode + */ +class Domain +{ +public: + + /** + Contructor + @param domain_id Id of this domain. See iipconst.h + */ + Domain(DOMAIN_ID domain_id); + + /** + Destructor + @note Default does nothing - must be virtual for derived classes + */ + virtual ~Domain(void); + + /** + Initialize domain specific hardware as needed + @return MOPS error code or @c prd_return_code_t + */ + virtual int32_t Initialize(void); + + /** + Remove domain specific hardware as needed + @return MOPS error code or @c prd_return_code_t + */ + virtual void Remove(TARGETING::TargetHandle_t); + + /** + Query - if any sub components have attention matching attentionType + @param attentionType see iipsdbug.h for values + @return true|false + @pre this->Initialize() must be called + */ + virtual bool Query(ATTENTION_TYPE attentionType) = 0; + + /** + Analzye this domain + @param attentionType to analyze + @return Mops return code | @c prd_return_code_t + @return serviceData + @pre this->Query() == true + @post serviceData valid + */ + virtual int32_t Analyze(STEP_CODE_DATA_STRUCT & serviceData, + ATTENTION_TYPE attentionType) = 0; + + /** + Access the ID of this domain + @return @c DOMAIN_ID See iipconst.h + */ + DOMAIN_ID GetId(void) const { return(dom_id); } + +protected: + + /** + Prioritize the components of this domain for Analysis + @param ATTENTION_TYPE [MACHINE_CHECK, RECOVERABLE, SPECIAL] + @post Domain prepared for Analysis + @note Default is do nothing + */ + virtual void Order(ATTENTION_TYPE attentionType) = 0; + +private: + + DOMAIN_ID dom_id; + +}; + + +#endif diff --git a/src/usr/diag/prdf/common/framework/config/iipDomainContainer.C b/src/usr/diag/prdf/common/framework/config/iipDomainContainer.C new file mode 100755 index 000000000..2274adce9 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/iipDomainContainer.C @@ -0,0 +1,165 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/iipDomainContainer.C $ */ +/* */ +/* 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 */ + +// Module Description ************************************************** +// +// Description: This module provides the implementation for the PRD +// DomainContainer class. +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- + +#include <iipServiceDataCollector.h> +#include <prdfErrorSignature.H> +#include <iipDomainContainer.h> + +#include <prdfRuleChip.H> +#include <prdfPluginDef.H> +#include <prdfPlatServices.H> +#include <algorithm> + +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +// @jl02 a Start +// This is used with the CHIP_CLASS vectors to remove one that matches a chipID +// Predicate function for comparing chip IDs. This is required by remove_if from STL. +// TODO:FIXME: Add compiler directives or some method to make sure the type handling here +// is generic enough or correct enough to handle future use of this functionality. +class prdfCompareChipIds: public std::unary_function<void*&, bool> +{ + public: + //Constructor allows a value to be passed in to compare against. + inline prdfCompareChipIds(TARGETING::TargetHandle_t cid) : __cid(cid) {}; + //This operator is the one I'd like to call straight. But, because of the void ptr type + // I cannot call it directly. C++ won't allow it because of "strong typing" rules. + inline bool operator() (CHIP_CLASS& i) + { + return (__cid == i.GetChipHandle()); + }; + //Really fancy caste for the benefit of the compiler. + inline bool operator() (void*& i) + { + //Anonymous Union for calling void ptr a CHIP_CLASS. + union {CHIP_CLASS* c; void* v;} cptr; + //assign value passed in to it's void ptr type. + cptr.v = i; + //pass CHIP_CLASS type to inline overloaded operator above. + return this->operator()(*cptr.c); + }; + private: + //Private storage for value passed in. + TARGETING::TargetHandle_t __cid; +}; +// @jl02 a Stop + +template<class T> +inline +DomainContainer<T>::DomainContainer(DOMAIN_ID domainId, unsigned int size) : +Domain(domainId), +chips() // dg04 - remove size from arg list +{ + chips.reserve(size); // dg04 +} + +template<class T> +inline +bool DomainContainer<T>::Query(ATTENTION_TYPE attentionType) // DG03 +{ + bool rc = false; + + SYSTEM_DEBUG_CLASS sysdebug; + unsigned int size = GetSize(); + for(unsigned int i = 0;(i < size) && (rc == false);i++) + { + TARGETING::TargetHandle_t l_pchipHandle = LookUp(i)->GetChipHandle(); + if(sysdebug.IsAttentionActive(l_pchipHandle) == true) + { + if(sysdebug.GetAttentionType(l_pchipHandle) == attentionType) rc = true; + } + } + + return(rc); +} + +template<class T> +inline +int32_t DomainContainer<T>::Analyze(STEP_CODE_DATA_STRUCT & serviceData, + ATTENTION_TYPE attentionType) +{ + serviceData.service_data->GetErrorSignature()->clear(); + Order(attentionType); // DG01 DG02 + return(LookUp(0)->Analyze(serviceData, attentionType)); +} + +template<class T> +inline +void DomainContainer<T>::Swap(unsigned int index1, unsigned int index2) +{ + void * ptr = chips[index1]; + chips[index1] = chips[index2]; + chips[index2] = ptr; +} + +template<class T> // pw01 - Added function. +inline +void DomainContainer<T>::MoveToFront(unsigned int index) +{ + for (unsigned int i = index; i > 0; i--) + { + Swap(i, i-1); + } +} + +template<class T> +inline +void DomainContainer<T>::Remove(TARGETING::TargetHandle_t i_pChipHandle) +{ + // erase and remove_if functions are from the STL and require begin end and predicate functions to work. + // This will iterate thru the vectors and remove any vectors with chip ID that matches the i_chip. + chips.erase(std::remove_if(chips.begin(), chips.end(), prdfCompareChipIds(i_pChipHandle)), chips.end()); +} diff --git a/src/usr/diag/prdf/common/framework/config/iipDomainContainer.h b/src/usr/diag/prdf/common/framework/config/iipDomainContainer.h new file mode 100755 index 000000000..223fb8120 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/iipDomainContainer.h @@ -0,0 +1,266 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/iipDomainContainer.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 iipDomainContainer_h +#define iipDomainContainer_h + +#ifndef iipDomain_h +#include <iipDomain.h> +#endif + +#include <vector> + +// Forward References +struct STEP_CODE_DATA_STRUCT; + +/** + Template class that Define a domain that contain other objects - typically + chips. + @par + Contained objects must have interface like CHIP_CLASS see iipchip.h + @note Parent class: Domain + @par Usage Examples: + @code + + // Create a Domain derived class holding chips of a specific type + class MyChip: public CHIP_CLASS {....}; + + class MyDomain : public DomainContainer<MyChip *> + { + MyDomain(DOMAIN_ID domainId); + + // Need to implement pure virtual functions + virtual SINT32 Order(void); // put chip to analyze at top of list + }; + + void foo(MyChip * chipPtr) + { + MyDomain myDomain(ID, 10); // Need to hold about 10 chips + + myDomain.AddChip(chipPtr); // Add chip to list of chips + // .... + + if(myDomain.LookUp(0) == chipPtr) // lookup first chip + { + // LookUp successfully returned pointer to the chip + } + } + + void f(Domain & myDomain, + STEP_CODE_DATA_STRUCT & sevice_data, + ATTENTION_TYPE system_attention_type) + { + if(myDomain->Query()) // if has attention + { + myDomain->Analyze(service_data, system_attention_type); + } + } + @endcode +*/ +template <class T> +class DomainContainer : public Domain +{ +public: + + /** + Constructor + <ul> + <br><b>Parameter: </b> domainId: Identifies the Domain (See iipconst.h) + <br><b>Parameter: </b> size: Estimate of max number of chips in domain + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Object created + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> + </ul><br> + */ + DomainContainer(DOMAIN_ID domainId, unsigned int size = 5); + + // Function Specification ******************************************** + // + // Purpose: Copy + // Parameters: c: Reference to instance to copy + // Returns: No value returned. + // Requirements: None. + // Promises: All data members will be copied (Deep copy). + // Exceptions: None. + // Concurrency: N/A. + // Notes: This constructor is not declared. This compiler generated + // default definition is sufficient. + // + // End Function Specification **************************************** + // DomainContainer(const DomainContainer<T> & c); + + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: This destructor is not declared. This compiler generated + // default definition is sufficient. + // + // End Function Specification **************************************** + // virtual ~DomainContainer(void); + + // Function Specification ******************************************** + // + // Purpose: Assigment + // Parameters: c: Reference to instance to assign from + // Returns: Reference to this instance + // Requirements: None. + // Promises: All data members are assigned to + // Exceptions: None. + // Concurrency: N/A. + // Notes: This assingment operator is not declared. The compiler + // generated default definition is sufficient. + // + // End Function Specification **************************************** + // DomainContainer<T> & operator=(const DomainContainer<T> & c); + + /** + Add a chip to this domain + <ul> + <br><b>Parameters: </b> Pointer to a chip instance + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> GetSize()++ + <br><b>Exceptions: </b> None. + </ul><br> + */ + void AddChip(T * chipPtr); + + /** + Query domain for attention + <ul> + <br><b>Parameters: </b> attentionType + <br><b>Returns: </b> true if 1 or more chips within the domain have + the attention type specified otherwise false + <br><b>Requirements:</b> GetSize() > 0, Initialize() + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual bool Query(ATTENTION_TYPE attentionType); + + + /** + Determin which chip to Analyze and call it's Analyze() function + <ul> + <br><b>Parameter: </b> serviceData (See iipServiceDataCollector.h) + <br><b>Parameter: </b> attentionType [MACHINE_CHECK|RECOVERED|SPECIAL] + <br><b>Returns: </b> return code (0 == SUCCESS) + <br><b>Requirements:</b> Query() == true, Initialize() + <br><b>Promises: </b> serviceData complete + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> This implementation calls Order() to determin + which chip to analyze and calls that chips + Analyze() function. + </ul><br> + */ + virtual int32_t Analyze(STEP_CODE_DATA_STRUCT & serviceData,ATTENTION_TYPE attentionType); + + /** + Returns a pointer to the chip at the specified index + <ul> + <br><b>Parameters: </b> chipIndex + <br><b>Returns: </b> pointer to a Chip of type T | NULL + <br><b>Requirements:</b> AddChip(), 0 <= chipIndex < GetSize() + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> NULL is return if chipIndex is out of range + </ul><br> + */ + const T * LookUp(unsigned int chipIndex) const; + T * LookUp(unsigned int chipIndex); + + /** + Return the number of chips in the domain + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> number of chips in the domain + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + uint32_t GetSize(void) const; + +protected: + + + /** + Swaps the position of two chips in the chip list + <ul> + <br><b>Parameters: </b> chip indexes of chips to swap + <br><b>Returns: </b> None. + <br><b>Requirements:</b> indexes < GetSize(), & >= 0 + <br><b>Promises: </b> chiplist order modified + <br><b>Exceptions: </b> None. + </ul><br> + */ + void Swap(unsigned int index1, unsigned int index2); + + /** + * Moves the specified chip to the front of the list but preserves the + * rest of the order. + */ + void MoveToFront(unsigned int index); // pw01 + +// @jl02 a Start + /** + Removes a chip from the list inside of each Domain that contains it. + It will leave the list at the system level for later deletion. + <ul> + <br><b>Parameters: </b> chip identifier of chip to remove + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + void Remove(TARGETING::TargetHandle_t i_chip); + +private: + + // void * is used to reduce template code bloat + // the chip type T is restored whenever a reference to a chip + // is requested + typedef std::vector<void *> ChipContainerType; + + ChipContainerType chips; + + +}; + +#include "iipDomainContainer.inl" + +//#ifdef RS6000 -- changed for V4R1 Bali - 2/27/96 JFP +#ifndef __GNUC__ +#include "iipDomainContainer.C" +#endif + +#endif diff --git a/src/usr/diag/prdf/common/framework/config/iipDomainContainer.inl b/src/usr/diag/prdf/common/framework/config/iipDomainContainer.inl new file mode 100755 index 000000000..effca23b3 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/iipDomainContainer.inl @@ -0,0 +1,57 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/iipDomainContainer.inl $ */ +/* */ +/* 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 iipDomainContainer_inl +#define iipDomainContainer_inl + + +template<class T> +inline +void DomainContainer<T>::AddChip(T * chipPtr) +{ + chips.push_back((T *) chipPtr); +} + +template<class T> +inline +const T * DomainContainer<T>::LookUp(unsigned int i_chipIndex) const +{ + return((T *) ((i_chipIndex < chips.size()) ? chips[i_chipIndex] : NULL)); +} + +template<class T> +inline +T * DomainContainer<T>::LookUp(unsigned int i_chipIndex) +{ + return((T *) ((i_chipIndex < chips.size()) ? chips[i_chipIndex] : NULL)); +} + +template<class T> +inline +uint32_t DomainContainer<T>::GetSize(void) const +{ + return(chips.size()); +} + +#endif + diff --git a/src/usr/diag/prdf/common/framework/config/iipSystem.C b/src/usr/diag/prdf/common/framework/config/iipSystem.C new file mode 100755 index 000000000..4fda713cf --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/iipSystem.C @@ -0,0 +1,338 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/iipSystem.C $ */ +/* */ +/* 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 */ + +// Module Description ************************************************** +// +// Description: This module provides the implementation for the PRD +// System class. +// +// End Module Description ********************************************** + +/*--------------------------------------------------------------------*/ +/* Emit the virtual function tables and inline function defintions in + this translation unit. */ +/*--------------------------------------------------------------------*/ +#ifdef __GNUC__ +#endif + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- + +#include <prdfMain.H> +#include <iipSystem.h> +#include <iipResolution.h> +#include <iipsdbug.h> +#include <iipchip.h> +#include <iipDomain.h> +#include <iipServiceDataCollector.h> +#include <iipResolutionFactory.h> +#include <iipglobl.h> +#include <prdfPlatServices.H> + +#ifndef __HOSTBOOT_MODULE + #include <prdfMfgThresholdMgr.H> +#endif + +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +System::System( Resolution & noSystemAttentions ) : + chips(), + prioritizedDomains(), + noAttnResolution(noSystemAttentions) +{} + +System::~System(void) +{ + for(ChipMapType::iterator chipIterator = chips.begin(); + chipIterator != chips.end();chipIterator++) + { + delete (*chipIterator); + } + + // change to delete prioritiezed Domains instead of domains dg04 + for(DomainContainerType::iterator domainIterator = prioritizedDomains.begin(); + domainIterator != prioritizedDomains.end();domainIterator++) + { + delete (*domainIterator); + } + // clear the Resolution factory + ResolutionFactory::Access().Reset(); + +#ifndef __HOSTBOOT_MODULE + // FIXME: need to implement PrdfMfgThresholdMgr in Hostboot + // clear the MfgThresholdMgr + PrdfMfgThresholdMgr::getInstance()->reset(); +#endif + + // clear the threshold policies + ThresholdResolution::reset(); +} + +CHIP_CLASS * System::GetChip(TARGETING::TargetHandle_t i_pchipHandle ) +{ + CHIP_CLASS * chipPtr = NULL; + + // chips.LookUp(chipPtr, chipId); + for(uint32_t i = 0; i < chips.size(); ++i) + { + if(chips[i]->GetChipHandle() == i_pchipHandle) + { + chipPtr = chips[i]; + break; + } + } + + return(chipPtr); +} + +Domain * System::GetDomain(DOMAIN_ID domainId) +{ + Domain * domainPtr = NULL; + + // domains.LookUp(domainPtr, domainId); + for(uint32_t i = 0; i < prioritizedDomains.size(); ++i) + { + if(prioritizedDomains[i]->GetId() == domainId) + { + domainPtr = prioritizedDomains[i]; + break; + } + } + + return(domainPtr); +} + +void System::AddChips(ChipContainerIterator begin, + ChipContainerIterator end) +{ + using namespace PRDF; + + size_t l_size = 0; + if(begin < end) l_size = end-begin; + else l_size = begin-end; + chips.reserve(chips.size()+l_size); + while(begin != end) + { + chips.push_back(*begin); + begin++; + } +} + +void System::AddDomains(DomainContainerIterator begin, + DomainContainerIterator end) +{ + size_t l_size = 0; + if(begin < end) l_size = end-begin; + else l_size = begin-end; + prioritizedDomains.reserve(prioritizedDomains.size()+l_size); + // The Configurator owns determining the priority of the domains. + while(begin != end) + { + prioritizedDomains.push_back(*begin); // dg01 - add: Keep order given + begin++; + } +} + +void System::RemoveStoppedChips(TARGETING::TargetHandle_t i_pchipHandle) +{ + for(DomainContainerType::iterator domainIterator = prioritizedDomains.begin(); + domainIterator != prioritizedDomains.end(); domainIterator++) + { + (*domainIterator)->Remove(i_pchipHandle); + } +} + +// -------------------------------------------------------------------- + +void System::RemoveNonFunctionalChips() +{ + using namespace PRDF; + + ChipMapType l_chips; + + for(ChipMapType::iterator chipIterator = chips.begin(); + chipIterator != chips.end(); + chipIterator++) + { + if(!PlatServices::isFunctional((*chipIterator)->GetChipHandle())) + { + l_chips.push_back(*chipIterator); + } + } + + // The reason for l_chips is because we can't remove elements from a vector + // as we are iterating on it. Otherwise, it will foul up the iterators. + // Now, this is not the most efficient way to remove the chips, because this + // implementation will remove (put at the end of the vector) the chip then + // erase it and repeat for each element. Instead, it should remove all chips + // then erase all removed chips. However, for the scope of this code, the + // efficiency increase is nominal so it can be left for future improvements. + for(ChipMapType::iterator chipIterator = l_chips.begin(); + chipIterator != l_chips.end(); + chipIterator++) + { + RemoveStoppedChips((*chipIterator)->GetChipHandle()); + } +} + +// -------------------------------------------------------------------- + +void System::Initialize(void) +{ + uint32_t rc = SUCCESS; + //SYSTEM_DEBUG_CLASS sysdebug; dg08d + + for(ChipMapType::iterator chipIterator = chips.begin(); + (chipIterator != chips.end()) && (rc == SUCCESS);chipIterator++) + { + rc = (*chipIterator)->Initialize(); + // if rc then an error log was (will be) committed + if(rc != SUCCESS) + { + PRDF_ERR( "System::Initialize of chips failed. rc = %x", rc ); + } + } + + // change domains to priortizedDomains dg04 + for(DomainContainerType::iterator domainIterator = prioritizedDomains.begin(); + (domainIterator != prioritizedDomains.end()) && (rc == SUCCESS); + domainIterator++) + { + rc = (*domainIterator)->Initialize(); + + if(rc != SUCCESS) + { + PRDF_ERR( "System::Initialize of chips failed. rc = %x", rc ); + } + } +} + +// ------------------------------------------------------------------- + +int System::Analyze(STEP_CODE_DATA_STRUCT & serviceData, + ATTENTION_TYPE attentionType) +{ + using namespace PRDF; + + SYSTEM_DEBUG_CLASS sysdebug; + Domain * domainAtAttentionPtr = NULL; + ServiceDataCollector * l_saved_sdc = NULL; + + int rc = (prioritizedDomains.empty() ? NO_DOMAINS_IN_SYSTEM : SUCCESS); + int l_saved_rc = 0; + + if(rc == SUCCESS) + { + // IF machine check then check for recoverable errors first + // otherwise just check for the given type of attention + ATTENTION_TYPE startAttention = attentionType; + if((attentionType == MACHINE_CHECK) || (attentionType == UNIT_CS)) + startAttention = RECOVERABLE; + ATTENTION_TYPE atnType = startAttention; + for(atnType = startAttention; + domainAtAttentionPtr == NULL && atnType >= attentionType ; + --atnType) + { + for(DomainContainerType::iterator domainIterator = prioritizedDomains.begin(); + domainIterator != prioritizedDomains.end() && domainAtAttentionPtr == NULL; + domainIterator++) + { + domainAtAttentionPtr = ((*domainIterator)->Query(atnType)) ? (*domainIterator) : NULL; + if(domainAtAttentionPtr != NULL) + { + serviceData.service_data->SetCauseAttentionType(atnType); + rc = domainAtAttentionPtr->Analyze(serviceData, atnType); + if((rc == PRD_SCAN_COMM_REGISTER_ZERO) || + (rc == PRD_POWER_FAULT)) + { + // save sdc, and continue + if(l_saved_sdc == NULL) + { + l_saved_sdc = new ServiceDataCollector( + *serviceData.service_data); + l_saved_rc = rc; + } + // TODO clear serviceData ? + domainAtAttentionPtr = NULL; + + if(rc == PRD_POWER_FAULT) + { + PRDF_ERR( "System::Analyze() Power Fault detected!" ); + break; + } + } + } + } + } + + // if ptr is NULL && we don't have a saved SDC than we have noAttns + // if ptr is NULL && we have a saved SDC then we have an attn with no-bits-on + // otherwise we are done - aready did the analysis + if(domainAtAttentionPtr == NULL) + { + if(l_saved_sdc == NULL) + { + rc = noAttnResolution.Resolve(serviceData); + } + else + { + *serviceData.service_data = *l_saved_sdc; + sysdebug.CalloutThoseAtAttention(serviceData); + rc = l_saved_rc; + } + } + //else + //{ + // // mk442956 a Add atnType to CauseAttentionType in sdc + // serviceData.service_data->SetCauseAttentionType(atnType+1); + // rc = domainAtAttentionPtr->Analyze(serviceData, atnType+1); // jp01 + //} + if(l_saved_sdc != NULL) delete l_saved_sdc; //dg05a + + } + + return(rc); +} diff --git a/src/usr/diag/prdf/common/framework/config/iipSystem.h b/src/usr/diag/prdf/common/framework/config/iipSystem.h new file mode 100755 index 000000000..23f84e4da --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/iipSystem.h @@ -0,0 +1,312 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/iipSystem.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 iipSystem_h +#define iipSystem_h + +// Class Specification ************************************************* +// +// Class name: System +// Parent class: None. +// +// Summary: This class provides access to the domains and chips of the +// actual hardware system. The System is initially set up with +// one or more calls to the Add...() functions in which Domains +// and Chips are added to the system. The System assumes the +// ownership of the pointers to the chips and domains that are +// added to the system and will delete the associated chip and +// domain objects when the destructor of the System is called. +// +// The Initialize() function calls the Initialize() funciton +// for each Chip and Domain in the System. The function is +// also virtual so that it can be overidden in a derived class +// for a specific system initialization behaviour. +// +// The Analyze() function determins which Domain Analzye() function +// to call. The prioritization for Domain Analysis +// is based on the value of the Domain ID. The lower Domain +// ID has higher priority. When Analyze() is called, the Domains +// are queried for attention status starting with the highest +// priority Domain and moving to the lowest. +// The first Domain that returns true from Query() will have its +// Analyze() function called. +// +// Cardinality: N +// +// Performance/Implementation: +// Space Complexity: Linear based on the number of domains and chips +// configured in the hardware system. +// Time Complexity: All member functions constant unless otherwise +// stated. +// +// Usage Examples: +// +// extern CHIP_CLASS * chips[CHIP_COUNT]; +// extern Domain * domains[DOMAIN_COUNT]; +// extern ServiceDataCollector sdc; +// +// void foo(void) +// { +// System system; +// +// system.Add(chips, chips + CHIP_COUNT); +// system.Add(domains, domains + DOMAIN_COUNT); +// +// CHIP_CLASS * system.GetChip(CHIP_ID); +// Domain * system.GetDomain(DOMAIN_ID); +// +// system.Initialize(); +// +// system.Analyze(sdc); +// } +// +// End Class Specification ********************************************* + +#include <vector> + +#ifndef IIPCONST_H +#include <iipconst.h> //TARGETING::TargetHandle_t, DOMAIN_ID_TYPE +#endif + +#include <iipsdbug.h> // Include file for ATTENTION_TYPE + +// Forward Declarations +class CHIP_CLASS; +class Domain; +class Resolution; +struct STEP_CODE_DATA_STRUCT; + +class System + { + private: + + typedef std::vector<CHIP_CLASS *>::iterator ChipContainerIterator; + typedef std::vector<Domain *>::iterator DomainContainerIterator; + + public: + + System(Resolution & noSystemAttentions); + // Function Specification ******************************************** + // + // Purpose: Initialization + // Parameters: A resolution to resolve the serviceData if no + // attentions are found in the configured system + // Returns: No value returned. + // Requirements: None. + // Promises: All data members are initialized. + // Exceptions: None. + // Concurrency: Reentrant + // + // End Function Specification ////////////////////////////////////// + + // System(const System & c); + // Function Specification ******************************************** + // + // Purpose: Copy + // Parameters: c: Reference to instance to copy + // Returns: No value returned. + // Requirements: None. + // Promises: All data members will be copied (Deep copy). + // Exceptions: None. + // Concurrency: N/A. + // Notes: This constructor is not declared. This compiler generated + // default definition is sufficient. + // + // End Function Specification **************************************** + + virtual ~System(void); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: This destructor deletes each Chip and Domain instance in + // the respective containers. + // + // End Function Specification **************************************** + + // System & operator=(const System & c); + // Function Specification ******************************************** + // + // Purpose: Assigment + // Parameters: Handle to the chip + // Returns: Reference to this instance + // Requirements: None. + // Promises: All data members are assigned to + // Exceptions: None. + // Concurrency: N/A. + // Notes: This assingment operator is not declared. The compiler + // generated default definition is sufficient. + // + // End Function Specification **************************************** + + CHIP_CLASS * GetChip(TARGETING::TargetHandle_t i_pchipHandle); + // Function Specification ******************************************** + // + // Purpose: Get Chip + // Parameters: chipId: Specifies chip to get + // Returns: Pointer to CHIP_CLASS + // Requirements: None. + // Promises: Return a pointer to the requested chip if it exists + // Exceptions: None. + // Concurrency: Reentrant. + // Notes: If the specified chip is not in the System, then NULL is + // returned. + // + // End Function Specification **************************************** + + Domain * GetDomain(DOMAIN_ID domainId); + // Function Specification ******************************************** + // + // Purpose: Get Domain + // Parameters: domainId: Specifies domain to get + // Returns: Pointer to Domain. + // Requirements: None. + // Promises: Return a pointer to the requested domain if it exists + // Exceptions: None. + // Concurrency: Reentrant. + // Notes: If the specified domain is not in the System, then NULL is + // returned. + // + // End Function Specification **************************************** + + void AddChips(ChipContainerIterator begin, + ChipContainerIterator end); + // Function Specification ******************************************** + // + // Purpose: Adds a Chips to the system + // Parameters: begin: Iterator to first Chip to add + // end: Iterator to end Chip to add + // Returns: No value returned. + // Requirements: None. + // Promises: Pointer to chip stored in system, Pointer ownership assumed + // Exceptions: None. + // Concurrency: Nonreentrant. + // + // End Function Specification **************************************** + + void AddDomains(DomainContainerIterator begin, + DomainContainerIterator end); + // Function Specification ******************************************** + // + // Purpose: Adds Domains to the system + // Parameters: Handle of chip that check stopped + // Returns: No value returned. + // Requirements: None. + // Promises: Pointer Domain stored in system, Pointer ownership assumed + // Exceptions: None. + // Concurrency: Nonreentrant. + // + // End Function Specification **************************************** + + void RemoveStoppedChips(TARGETING::TargetHandle_t i_pChipHandle); //@jl02 Unit Check Stop code added + + // Function Specification ******************************************** + // + // Purpose: Removes a chip from a Domain that this chip is in if we no longer + // want to have the chip within prds view. + // Parameters: chip: Chip ID to be changed. + // Returns: No value returned. + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Nonreentrant. + // + // End Function Specification **************************************** + + void RemoveNonFunctionalChips(); //@jl04 a Add code to remove non functional + // Function Specification ******************************************** + // + // Purpose: Removes chips from a Domain if we no longer + // want to have the chips that are nonfunctional in HOM. + // Parameters: None. + // Returns: No value returned. + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Nonreentrant. + // + // End Function Specification **************************************** + + + virtual void Initialize(); + // Function Specification ******************************************** + // + // Purpose: Initializes all chip and domains + // Parameters: refCode: Reference code to use if error + // stepCode: Step code to use if error + // Returns: No value returned. + // Requirements: None. + // Promises: Initialize function on all chip and domains called unless + // an error occurrs in one of the Initialize functions. + // Exceptions: None. + // Concurrency: Reentrant. + // Notes: The Initialize() function for each Chip and Domain is + // called. If an error code is returned from a Chip or Domain + // Initialize call, then SrcFill is called with the specified + // reference code, step code, and return code. No further calls + // are made when an error occurs. + // + // End Function Specification **************************************** + + virtual int Analyze(STEP_CODE_DATA_STRUCT & serviceData, + ATTENTION_TYPE attentionType); + // Function Specification ******************************************** + // + // Purpose: Analyze domains for an error + // Parameters: serviceData: Reference to pass back error data in + // attentionType: Indicates attention type + // Returns: Error value + // Requirements: None. + // Promises: ServiceData completed unless error encountered + // Exceptions: None. + // Concurrency: Reentrant. + // Notes: Each Domain is queried using the prioritization sequence. + // The first Domain that returns true from Domain Query() + // will have its Analyze() function called. If + // there are no Domains, then the error code + // NO_DOMAINS_IN_SYSTEM(0xDD20) is returned. If there are no + // Domains at attention, then the error code + // NO_DOMAINS_AT_ATTENTION(0xDD21) is returned. + // + // End Function Specification **************************************** + + private: + + typedef std::vector<CHIP_CLASS *> ChipMapType; + + typedef std::vector<Domain *> DomainContainerType; + + ChipMapType chips; + + DomainContainerType prioritizedDomains; + + Resolution & noAttnResolution; + }; + + +#endif diff --git a/src/usr/diag/prdf/common/framework/config/iipchip.C b/src/usr/diag/prdf/common/framework/config/iipchip.C new file mode 100755 index 000000000..78e1ed378 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/iipchip.C @@ -0,0 +1,146 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/iipchip.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1993,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 */ + +#define IIPCHIP_CPP + +/* Module Description *************************************************/ +/* */ +/* Name: iipchip.cpp */ +/* */ +/* Description: This module contains the implementation for the + Processor Runtime Diagnostics Chip class. */ +/* */ +/* End Module Description *********************************************/ + +/* Change Log *********************************************************/ +/* */ +/* Flag Reason Vers Date Coder Description */ +/* ---- -------- ---- -------- ----- ------------------------------- */ +/* V2ST 07/30/93 JST Initial Creation */ +/* V2ST 08/20/93 JST Added Tables and Analyze() + Converted to ABC */ +/* V300 11/02/93 JST Using Error Register, + ATTENTION_TYPE */ +/* V300 11/02/93 JST Created CHIP_IDENTITY */ +/* V300 01/04/94 JST Analyze() returns Step Code Data + via parameter reference */ +/* V300 01/11/94 JST Removed CHIP_IDENTITY */ +/* V300 01/20/94 JST Removed Analyze() */ +/* V300 05/04/94 JST Added Initialize() */ +/* D24585.5 V300 06/07/94 JST Adding CapruteErrorData() */ +/* V400 07/28/94 JST Removing CapruteErrorData() */ +/* */ +/* End Change Log *****************************************************/ + +/*--------------------------------------------------------------------*/ +/* Emit the virtual function tables and inline function defintions in + this translation unit. */ +/*--------------------------------------------------------------------*/ + +#include <iipchip.h> +#include <prdfPlatServices.H> + +/*--------------------------------------------------------------------*/ +/* Forward References */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* User Types */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Constants */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Macros */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Internal Function Prototypes */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Global Variables */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Static Variables */ +/*--------------------------------------------------------------------*/ + +// Function Specification ////////////////////////////////////////// +// +// Title: ~CHIP_CLASS (Virtual destructor) +// +// Purpose: This destructor does nothing. This declaration is +// provided to enable derived class destuctores to be +// called properly. +// +// Side-effects: None. +// +// Dependencies: None. +// +// End Function Specification ////////////////////////////////////// + +CHIP_CLASS::~CHIP_CLASS +( + void + /*!i No parameters */ + ) +/*!o No value returned */ +{ +} + +// Function Specification ////////////////////////////////////////// +// +// Title: Initialize (Virtual) +// +// Purpose: This function handles the PRD initialization of the +// corresponding hardware chip and any associated data. +// +// This default implementation does nothing and returns +// SUCCESS(0). +// +// Side-effects: Scan comm registers may be written. +// Internal data may be modified. +// +// Dependencies: None. +// +// End Function Specification ////////////////////////////////////// + +int32_t CHIP_CLASS::Initialize +( + void + /*!i No parameters */ + ) +/*!o Error Return code */ +{ + return(SUCCESS); +} + +PRDF::HUID CHIP_CLASS::GetId() const +{ + return(PRDF::PlatServices::getHuid(iv_pchipHandle)); +} + +#undef IIPCHIP_CPP diff --git a/src/usr/diag/prdf/common/framework/config/iipchip.h b/src/usr/diag/prdf/common/framework/config/iipchip.h new file mode 100755 index 000000000..e45adb0d5 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/iipchip.h @@ -0,0 +1,242 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/iipchip.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1993,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 IIPCHIP_H +#define IIPCHIP_H + +/** + @brief + This module contains the Processor Runtime Diagnostics Chip class declaration. + @file iipchip.h +*/ + + +#if !defined(PRDF_TYPES_H) +#include <prdf_types.h> +#endif + +#if !defined(IIPSDBUG_H) + #include <iipsdbug.h> // for ATTENTION_TYPE +#endif + +#if !defined(PRDF_MAIN_H) + #include <prdfMain.H> +#endif + +#include <iipconst.h> + +/*--------------------------------------------------------------------*/ +/* Forward References */ +/*--------------------------------------------------------------------*/ + +class STEP_CODE_DATA_STRUCT; +class CaptureData; + +/** + CHIP_CLASS - model of hardware chip and functions needed by PRD + + Abstract base class + +@Notes + This Chip specifies a common interface for hardware chips. + Associated with every hardware chip is an index to a data + location in the SP SYS Debug global data area. This index + is specified during instantiation and is maintained + internally. The accessor function GetErrorEntryIndex() + returns this value. Each chip also has a logical ID for + indentifying specific instances. The accessor function + GetId() that this value. +@par + The pure virtual Analyze() function provides a standard + interface for analyzing Chip errors. The basic + algorithm must be defined for each derived class. +@par + The pure virtual MaskError() function provides a standard + interface for masking a Chip error. The basic + mechanism for maksing is defined in each derived class. +@par + Two pure virtual functions are used to provide Chip + specific data for external Manual Ops SCR interfaces. + Chip select parameters are passed to these functions. + Derived classes define the function GetChipSelectValues() + to return an array of these values as needed. The derived + classes must then also define the function + GetChipSelectCount() to return the number of values in + this array. +@par + The virtual Initialize() function provides a standard + interface for initializing the state of the hardware Chip. + This may also involve changing internal data members. A + default implementation will be provided that does + nothing. */ + +class CHIP_CLASS +{ + public: + + /** + Destructor + <ul> + <br><b>Parameters: </b> None + <br><b>Requirements:</b> None. + <br><b>Promises: </b> ojbect destroyed - any resourses deallocated + </ul><br> + */ + virtual ~CHIP_CLASS(); + + /** + Access the target handle for this chip + <ul> + <br><b>Parameters: </b> none + <br><b>Returns: </b> Handle for this chip + <br><b>Requirements:</b> None + <br><b>Promises: </b> None + <br><b>Notes: </b> Not to be used previous to Regatta + </ul><br> + */ + TARGETING::TargetHandle_t GetChipHandle() const + { + return iv_pchipHandle; + } + + /** + Initialize hardware associated with this chip object + <ul> + <br><b>Parameters: </b> parms + <br><b>Returns: </b> return code (usually Mops return code) + <br><b>Requirements:</b> System.build() complete + <br><b>Promises: </b> Hardware state may be modified + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Default implementation is to do nothing + </ul><br> + */ + virtual int32_t Initialize(); + + /** + * @brief Analyze the error being reported by this chip + * @param data Service Data Collector + * @param attention_type [MACHINE_CHECK | RECOVERED | SPECIAL] + * @return return code (see iipconst.h for PRD return codes) otherwise it's + * a MOPs return code + * @pre Initiialize(). The hardware chip this object represents drove + * attention. + * @post ServiceData complete. Hardware state may be modified. + */ + virtual int32_t Analyze( STEP_CODE_DATA_STRUCT & data, + ATTENTION_TYPE attention_type ) = 0; + + /** + Mask the reporting of an error by the hardware associated with this chip + <ul> + <br><b>Parameters: </b> maskId + <br><b>Returns: </b> return code (usually from MOPs) + <br><b>Requirements:</b> Initialize() + <br><b>Promises: </b> Hardware state modified + </ul><br> + */ + virtual int32_t MaskError( uint32_t error_mask_id ) = 0; + + /** + Capture the contents of certain registers withing the hardware + <ul> + <br><b>Parameters: </b> cd:Capture data object (to store the capture data) + <br><b>Returns: </b> return code (usually from MOPs) + <br><b>Requirements:</b> Initialize() + <br><b>Promises: </b> None. + <br><b>Notes: </b> default is to do nothing + </ul><br> + */ + virtual int32_t CaptureErrorData(CaptureData & cd) + { + return 0; + } + + /** + Returns the HUID of the chip + <ul> + <br><b>Parameters: </b> Nil + <br><b>Returns: </b> HUID of the chip + <br><b>Requirements:</b> chip Handle + <br><b>Promises: </b> None. + <br><b>Notes: </b> default is to do nothing + </ul><br> + */ + PRDF::HUID GetId() const; + + protected: + + /** + Constructor + <ul> + <br><b>Parameters: </b> i_pChipHandle: Handle for this chip + <br><b>Returns: </b> N/A + <br><b>Requirements:</b> Id must be unique + <br><b>Promises: </b> object instanciated + <br><b>Exceptions: </b> None. + </ul><br> + */ + CHIP_CLASS( TARGETING::TargetHandle_t i_pChipHandle ) : + iv_pchipHandle(i_pChipHandle) + {} + + // Function Specification ////////////////////////////////////////// + // + // Title: CHIP_CLASS (Copy constructor) + // + // Purpose: This constructor does nothing. The compiler generated + // function is sufficient. It does not need to be called + // by derived class assingment operators. + // + // Side-effects: This instance is initialized. + // + // Dependencies: None. + // + // End Function Specification ////////////////////////////////////// + + // Function Specification ////////////////////////////////////////// + // + // Title: operator= (assignment operator) + // + // Purpose: This assignment operator does nothing. This defintion + // is provided for an explicit call from a derived class + // assignment operator. It does not need to be called by + // a derived class assignment operator. + // + // Side-effects: None. + // + // Dependencies: None. + // + // End Function Specification ////////////////////////////////////// + + CHIP_CLASS & operator=(const CHIP_CLASS & chip) + { + return(*this); + } + + private: + + TARGETING::TargetHandle_t iv_pchipHandle; + +}; + +#endif diff --git a/src/usr/diag/prdf/common/framework/config/prdfExDomain.H b/src/usr/diag/prdf/common/framework/config/prdfExDomain.H new file mode 100644 index 000000000..0849affb4 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/prdfExDomain.H @@ -0,0 +1,55 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/prdfExDomain.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 __PRDFEXDOMAIN_H +#define __PRDFEXDOMAIN_H + +#include <prdfRuleChipDomain.H> + +class PrdfExDomain : public PrdfRuleChipDomain +{ + public: + + /** + * @brief Constructor + * @param i_did The domain ID + * @param i_size The projected size of the domain + */ + PrdfExDomain( DOMAIN_ID i_did, uint32_t i_size = EX_DOMAIN_SIZE ) : + PrdfRuleChipDomain( i_did, i_size ) + {} + + /** + * @brief Query for an attention of a specific type in this domain + * @param i_attnType [MACHINE_CHECK | RECOVERABLE | SPECIAL] + * @return false + * @note This function will always return false. That way PRD will look + * for the attention via the processor chip. + */ + virtual bool Query( ATTENTION_TYPE i_attnType ) + { return false; } + +}; + +#endif /* __PRDFEXDOMAIN_H */ + diff --git a/src/usr/diag/prdf/common/framework/config/prdfExtensibleChip.H b/src/usr/diag/prdf/common/framework/config/prdfExtensibleChip.H new file mode 100755 index 000000000..01f17c0eb --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/prdfExtensibleChip.H @@ -0,0 +1,68 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/prdfExtensibleChip.H $ */ +/* */ +/* 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 */ + +#ifndef __PRDFEXTENSIBLECHIP_H +#define __PRDFEXTENSIBLECHIP_H + +#include <iipscr.h> +#include <iipchip.h> + +#include <prdfPluginDef.H> + +class PrdfDataBundle; + +class PrdfExtensibleChip : public CHIP_CLASS +{ + public: + PrdfExtensibleChip( TARGETING::TargetHandle_t i_target ) : + CHIP_CLASS(i_target) + {} + + virtual PrdfExtensibleChipFunction * getExtensibleFunction( + const char * i_func, + bool i_expectNull = false ) = 0; + + virtual SCAN_COMM_REGISTER_CLASS * getRegister( + const char * i_reg, + bool i_expectNull = false ) = 0; + + virtual PrdfDataBundle *& getDataBundle() = 0; + + /** + * Add Capture data to the Capture Data object + * @param Capture data object (I/O) + * @param Capture group + */ + virtual int32_t CaptureErrorData( CaptureData &, int i_group = 1 ) = 0; + + virtual uint32_t getSignatureOffset() const = 0; +}; + +class PrdfDataBundle +{ + public: + virtual ~PrdfDataBundle() {}; +}; + +#endif + diff --git a/src/usr/diag/prdf/common/framework/config/prdfExtensibleDomain.C b/src/usr/diag/prdf/common/framework/config/prdfExtensibleDomain.C new file mode 100755 index 000000000..ef6991896 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/prdfExtensibleDomain.C @@ -0,0 +1,75 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/prdfExtensibleDomain.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2009,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 */ + +#include <string.h> + +#include <prdfExtensibleDomain.H> +#include <prdfPluginMap.H> +#include <prdf_service_codes.H> +#include <errlentry.H> +#include <prdfPfa5Data.h> +#include <iipglobl.h> + +PrdfExtensibleDomainFunction * + PrdfExtensibleDomain::getExtensibleFunction(const char * i_func, + bool i_expectNull) +{ + PrdfExtensibleFunctionType * plugin = + prdfGetPluginGlobalMap().getPlugins(iv_domainName)[i_func]; + if (NULL == plugin) + { + static PrdfPlugin<PrdfExtensibleDomain> l_nullPlugin(NULL); + plugin = &l_nullPlugin; + + if (!i_expectNull) + { + errlHndl_t l_errl = NULL; + PRDF_CREATE_ERRL(l_errl, + ERRL_SEV_UNRECOVERABLE, + ERRL_ETYPE_NOT_APPLICABLE, + SRCI_ERR_INFO, + SRCI_NO_ATTR, + PRDF_EXTENSIBLEDOMAIN, + LIC_REFCODE, + PRDF_CODE_FAIL, + __LINE__, + 0, 0, 0); + PRDF_ADD_FFDC(l_errl, + iv_domainName, + strlen(iv_domainName), + prdfErrlVer1, + prdfErrlString); + + PRDF_ADD_FFDC(l_errl, + i_func, + strlen(i_func), + prdfErrlVer1, + prdfErrlString); + + PRDF_COMMIT_ERRL(l_errl, ERRL_ACTION_REPORT); + delete l_errl; + } + } + + return (PrdfExtensibleDomainFunction *) plugin; +} diff --git a/src/usr/diag/prdf/common/framework/config/prdfExtensibleDomain.H b/src/usr/diag/prdf/common/framework/config/prdfExtensibleDomain.H new file mode 100755 index 000000000..b37f60c9e --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/prdfExtensibleDomain.H @@ -0,0 +1,57 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/prdfExtensibleDomain.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2009,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 __PRDFEXTENSIBLEDOMAIN_H +#define __PRDFEXTENSIBLEDOMAIN_H + +#include <prdfPluginDef.H> +#include <prdfExtensibleChip.H> + +class PrdfExtensibleDomain +{ + public: + PrdfExtensibleDomain(const char * i_domainName) : + iv_domainName(i_domainName), iv_dataBundle(NULL) {}; + + virtual ~PrdfExtensibleDomain() + { + if (NULL != iv_dataBundle) + { + delete iv_dataBundle; + iv_dataBundle = NULL; + } + }; + + virtual PrdfExtensibleDomainFunction * + getExtensibleFunction(const char * i_func, + bool i_expectNull = false); + + virtual PrdfDataBundle *& getDataBundle() { return iv_dataBundle; }; + + private: + const char * iv_domainName; + PrdfDataBundle * iv_dataBundle; + +}; + +#endif //__PRDFEXTENSIBLEDOMAIN_H diff --git a/src/usr/diag/prdf/common/framework/config/prdfFabricDomain.C b/src/usr/diag/prdf/common/framework/config/prdfFabricDomain.C new file mode 100755 index 000000000..e01d38c02 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/prdfFabricDomain.C @@ -0,0 +1,523 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/prdfFabricDomain.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 */ + +// Module Description ************************************************** +// +// Description: +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define prdfFabricDomain_C + +#include <iipglobl.h> +#include <iipstep.h> +#include <iipsdbug.h> +#include <iipErrorRegister.h> +#include <iipServiceDataCollector.h> +#include <prdfFabricDomain.H> +#include <UtilHash.H> +#include <prdfPluginDef.H> + +#include <prdfPlatServices.H> + +#include <algorithm> + +#undef prdfFabricDomain_C +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- +int32_t FabricDomain::Analyze(STEP_CODE_DATA_STRUCT & serviceData, + ATTENTION_TYPE attentionType) +{ + using namespace PRDF; + + int32_t l_rc; + l_rc = DomainContainer<PrdfRuleChip>::Analyze(serviceData, attentionType); + + + if( l_rc == PRD_POWER_FAULT ) + { + PRDF_ERR( "PrdfFabricDomain::Analyze::Power Fault detected!" ); + } + else + { + // Capture Global FIRs on xstp and recovered errors for domain. + if ((attentionType == MACHINE_CHECK) || (attentionType == RECOVERABLE)) + { + for (uint32_t i = 1; i < GetSize(); ++i) // start at 1 to skip analyzed. + { + LookUp(i)->CaptureErrorData( + serviceData.service_data->GetCaptureData(), + Util::hashString("GlobalFIRs")); + + if (attentionType == MACHINE_CHECK) + { + LookUp(i)->CaptureErrorData( + serviceData.service_data->GetCaptureData(), + Util::hashString("AllFIRs")); + } + } + } + } + + return l_rc; +} + +void FabricDomain::Order(ATTENTION_TYPE attentionType) +{ + using namespace PRDF; + using PrdfPluginDef::bindParm; + + if (attentionType == MACHINE_CHECK) + { + SortForXstop(); + + } + else if (attentionType == RECOVERABLE) + { + SortForRecov(); + } + else // Recovered or Special + { + SYSTEM_DEBUG_CLASS sysdbug; + for (int32_t i = (GetSize() - 1); i >= 0; --i) //pw03 + { + PrdfRuleChip * l_fabChip = LookUp(i); + TARGETING::TargetHandle_t l_pchipHandle = l_fabChip->GetChipHandle(); + if ((sysdbug.IsAttentionActive(l_pchipHandle)) && + (sysdbug.GetAttentionType(l_pchipHandle ) == attentionType)) + { + MoveToFront(i); //pw03 + break; + } + } + } +} + +// Determine the proper sorting for a checkstop based on: +// 1. Find only a single chip with an internal checkstop +// 2. Graph reduction algorithm +// 3. WOF/TOD counters +void FabricDomain::SortForXstop() +{ + using namespace PrdfPluginDef; + using namespace TARGETING; + + uint32_t l_internalOnlyCount = 0; + int l_chip = 0; + + uint64_t l_externalDrivers[GetSize()]; + uint64_t l_wofValues[GetSize()]; + bool l_internalCS[GetSize()]; + + union { uint64_t * u; CPU_WORD * c; } ptr; // zs01 + + // Get internal setting and external driver list for each chip. + for(uint32_t i = 0; i < GetSize(); ++i) + { + l_externalDrivers[i] = 0; + l_wofValues[i] = 0; + + PrdfRuleChip * l_fabChip = LookUp(i); + + ptr.u = &l_externalDrivers[i]; // zs01 + prdfBitString l_externalChips(GetSize(), ptr.c); // zs01 + TargetHandleList l_tmpList; + + // Call "GetCheckstopInfo" plugin. + PrdfExtensibleChipFunction * l_extFunc + = l_fabChip->getExtensibleFunction("GetCheckstopInfo"); + + (*l_extFunc)(l_fabChip, + bindParm<bool &, TargetHandleList &, uint64_t &> + (l_internalCS[i], + l_tmpList, + l_wofValues[i] + ) + ); + + + // Update bit buffer. + for (TargetHandleList::iterator j = l_tmpList.begin(); + j != l_tmpList.end(); ++j) + { + for (uint32_t k = 0; k < GetSize(); k++) + if ((*j) == LookUp(k)->GetChipHandle()) + l_externalChips.Set(k); + }; + + // Check if is internal. + if (l_internalCS[i]) + { + l_internalOnlyCount++; + l_chip = i; + } + } + + // Check if we are done... only one with an internal error. + if (1 == l_internalOnlyCount) + { + MoveToFront(l_chip); //pw03 + return; + } + else if (0 == l_internalOnlyCount) + { + // TODO : add trace here... continue with analysis to determine + // which chip origined though. + } + + // --- Do graph reduction --- + // Currently does not do cycle elimination. + + // Get initial list (all chips). + BIT_STRING_BUFFER_CLASS l_current(GetSize()); + l_current.Pattern(0,GetSize(),0xFFFFFFFF, 32); // turn on all bits. + + // Do reduction. + // When done, l_prev will have the minimal list. + BIT_STRING_BUFFER_CLASS l_prev(GetSize()); + l_prev.Clear(); + + while ((!(l_current == l_prev)) && (!l_current.IsZero())) + { + l_prev = l_current; + l_current.Clear(); + + for (uint32_t i = 0; i < GetSize(); i++) + { + if (l_prev.IsSet(i)) // skip if this chip isn't in the pool. + for (uint32_t j = 0; j < GetSize(); j++) + { + ptr.u = &l_externalDrivers[i]; // zs01 + if ( prdfBitString(GetSize(), ptr.c).IsSet(j) ) // zs01 + l_current.Set(j); + } + } + } + + // Hopefully, we got just one chip left... + if (1 == l_prev.GetSetCount()) + { + // Now find it. + for (uint32_t i = 0; i < GetSize(); i++) + if ((l_prev.IsSet(i)) && + (l_internalCS[i] || (0 == l_internalOnlyCount))) + { + MoveToFront(i); //pw03 + return; + } + } + + // --- Do WOF compare --- + uint32_t l_minWof = 0; + for (uint32_t i = 0; i < GetSize(); i++) + { + // Search for minimum WOF value. + if (l_wofValues[i] < l_wofValues[l_minWof]) + // Only choose chips with internal checkstop, + // unless no internals. + if ((l_internalCS[i] || (0 == l_internalOnlyCount))) + l_minWof = i; + } + MoveToFront(l_minWof); //pw03 + return; + +}; + +namespace __prdfFabricDomain // pw03 --- +{ + // This function is used for the std::max_element function in SortForRecov + // to ensure that elements towards the end of the list are favored (and + // therefore preventing starvation of chips at the end of the domain list) + inline bool lessThanOperator(uint32_t & l, uint32_t & r) + { + if (l == r) + { + return ((void *)&l) < ((void *)&r); + } + return l < r; + } +}; // --- pw03 + +void FabricDomain::SortForRecov() +{ + using namespace PRDF; + using namespace PrdfPluginDef; + + SYSTEM_DEBUG_CLASS sysdbug; + uint32_t l_sev[GetSize()]; + std::fill(&l_sev[0], &l_sev[GetSize()], 0); + + // Loop through all chips. + for (uint32_t i = 0; i < GetSize(); ++i) + { + PrdfRuleChip * l_fabChip = LookUp(i); + TARGETING::TargetHandle_t l_pchipHandle = l_fabChip->GetChipHandle(); + if (sysdbug.IsAttentionActive(l_pchipHandle)) // If at attention, check. + { + + if (RECOVERABLE == sysdbug.GetAttentionType( l_pchipHandle)) + { + // Recovered, set sev 1. + l_sev[i] = 1; + } + else if (CHECK_STOP == sysdbug.GetAttentionType(l_pchipHandle)) + { + // Check for recovered error at checkstop. + PrdfExtensibleChipFunction * l_extFunc + = l_fabChip->getExtensibleFunction("CheckForRecovered"); + + bool l_hasRer = false; + + (*l_extFunc)(l_fabChip, bindParm<bool &>(l_hasRer)); + + if (l_hasRer) + { + // Has a recovered error, sev 1. + l_sev[i] = 1; + } + } + + // Find real severity level. + if (0 != l_sev[i]) + { + PrdfExtensibleChipFunction * l_extFunc + = l_fabChip->getExtensibleFunction( + "CheckForRecoveredSev"); + + uint32_t l_cSev = 1; + (*l_extFunc)(l_fabChip, bindParm<uint32_t &>(l_cSev)); + + l_sev[i] = l_cSev; + } + } + } + + // Find item with highest severity. + MoveToFront(std::distance(&l_sev[0], + std::max_element(&l_sev[0], + &l_sev[GetSize()], + __prdfFabricDomain::lessThanOperator)) + ); //pw03 +} + + +//Analyze a subset of chips in a Domain... +//This is a mini analysis of some of the chips in the Fabric Domain. +int32_t FabricDomain::AnalyzeTheseChips(STEP_CODE_DATA_STRUCT & serviceData, + ATTENTION_TYPE attentionType, + TARGETING::TargetHandleList & i_chips) +{ + using namespace TARGETING ; + PRDF_DENTER( "FabricDomain::AnalyzeTheseChips" ); + int32_t l_rc = ~SUCCESS; + + PRDF_DTRAC( "FabricDomain::AnalyzeTheseChips:: Domain ID = 0x%X", GetId() ); + + if(i_chips.size() != 0) + { + + for (TargetHandleList::iterator i = i_chips.begin(); i != i_chips.end(); ++i) + { + PRDF_DTRAC( "FabricDomain::AnalyzeTheseChips::Before--chip=0x%X", + PRDF::PlatServices::getHuid(*i)); + } + + OrderTheseChips(attentionType, i_chips); + + for (TargetHandleList::iterator i = i_chips.begin(); i != i_chips.end(); ++i) + { + PRDF_DTRAC( "FabricDomain::AnalyzeTheseChips::After--chip=0x%X", + PRDF::PlatServices::getHuid(*i) ); + } + //After the Order function is called the first chip should contain the chip to look at. + //Look here for the correct LookUp function. I don't think this is working. + PrdfRuleChip * l_fabChip = FindChipInTheseChips(i_chips[0], i_chips); + PRDF_DTRAC( "FabricDomain::AnalyzeTheseChips::Analyzing this one: 0x%X", + l_fabChip->GetId() ); + if(NULL != l_fabChip) + { + l_rc = l_fabChip->Analyze(serviceData, attentionType); + } + else + { + PRDF_DTRAC( "FabricDomain::AnalyzeTheseChips::l_fabChip is NULL" ); + l_rc = ~SUCCESS; + } + } + else + { + PRDF_DTRAC( "FabricDomain::AnalyzeTheseChips::i_chips = %d", + i_chips.size() ); + } + + //Get P7 chip Global FIR data for FFDC + for (TargetHandleList::iterator i = i_chips.begin(); i != i_chips.end(); ++i) + { + PrdfRuleChip * l_fabChip = FindChipInTheseChips(*i, i_chips); + l_fabChip->CaptureErrorData( + serviceData.service_data->GetCaptureData(), + Util::hashString("GlobalFIRs")); + } + + + PRDF_DEXIT( "FabricDomain::AnalyzeTheseChips" ); + return l_rc; +} + + +int32_t FabricDomain::OrderTheseChips(ATTENTION_TYPE attentionType, + TARGETING::TargetHandleList & i_chips) +{ + using namespace PrdfPluginDef; + using namespace TARGETING; + PRDF_DENTER( "FabricDomain::OrderTheseChips" ); + + uint32_t l_internalOnlyCount = 0; + uint64_t l_externalDrivers[i_chips.size()]; + uint64_t l_wofValues[i_chips.size()]; + bool l_internalCS[i_chips.size()]; + + union { uint64_t * u; CPU_WORD * c; } ptr; + + uint32_t l_chip = 0; + uint32_t l_chipToFront = 0; + // Get internal setting and external driver list for each chip. + for (TargetHandleList::iterator i = i_chips.begin(); i != i_chips.end(); ++i) + { + + PrdfRuleChip * l_fabChip = FindChipInTheseChips(*i, i_chips); + + ptr.u = &l_externalDrivers[l_chip]; + prdfBitString l_externalChips(i_chips.size(), ptr.c); + TargetHandleList l_tmpList; + + if(l_fabChip != NULL) + { + // Call "GetCheckstopInfo" plugin. + PrdfExtensibleChipFunction * l_extFunc + = l_fabChip->getExtensibleFunction("GetCheckstopInfo"); + + (*l_extFunc)(l_fabChip, + bindParm<bool &, TargetHandleList &, uint64_t &> + (l_internalCS[l_chip], + l_tmpList, + l_wofValues[l_chip] + ) + ); + } + else + { + l_internalCS[l_chip] = false; + PRDF_DTRAC( "FabricDomain::OrderTheseChips: l_fabChip is NULL" ); + } + + //If we are just checking for internal errors then there is no need for + //a list of what chips sent checkstops where. + // Update bit buffer. + for (TargetHandleList::iterator j = l_tmpList.begin(); + j != l_tmpList.end(); + ++j) + { + for (uint32_t k = 0; k < i_chips.size(); k++) + if ((*j) == LookUp(k)->GetChipHandle()) + l_externalChips.Set(k); + }; + + // Check if is internal. + if (l_internalCS[l_chip]) + { + l_internalOnlyCount++; + l_chipToFront = l_chip; + } + l_chip++; //Move to next chip in the list. + } + + // Check if we are done... only one with an internal error. + if (1 == l_internalOnlyCount) + { + MoveToFrontInTheseChips(l_chipToFront, i_chips); + return(SUCCESS); + } + + PRDF_DEXIT( "FabricDomain::OrderTheseChips" ); + return(SUCCESS); +} + +//This function is to ensure the order of the chip in the list is the correct chip. +//Because there is no garaunteed order within the domain container this is necessary. +PrdfRuleChip * FabricDomain::FindChipInTheseChips(TARGETING::TargetHandle_t i_pchipHandle, TARGETING::TargetHandleList & i_chips) +{ + using namespace TARGETING; + + PRDF_DENTER( "FabricDomain::FindChipNumber" ); + PrdfRuleChip * l_fabChip = NULL; + TargetHandle_t l_tmpfabHandle= NULL; + // Loop through all chips. + for (TargetHandleList::iterator iter = i_chips.begin(); iter != i_chips.end(); ++iter) + { + for (uint32_t i = 0; i < GetSize(); ++i) + { + l_fabChip = LookUp(i); + l_tmpfabHandle = l_fabChip->GetChipHandle(); + if( (l_tmpfabHandle == (*iter)) && (l_tmpfabHandle == i_pchipHandle) ) return(l_fabChip); + } + } + + PRDF_DEXIT( "FabricDomain::FindChipNumber" ); + return(NULL); +} + +//Swaps chip at location 0 with a chip at location i_chipToFront +void FabricDomain::MoveToFrontInTheseChips(uint32_t i_chipToFront, TARGETING::TargetHandleList & i_chips) +{ + using namespace TARGETING; + + for (TargetHandleList::iterator i = i_chips.begin()+i_chipToFront; i != i_chips.begin(); i--) + { + std::swap((*i), (*(i-1))); + } +} diff --git a/src/usr/diag/prdf/common/framework/config/prdfFabricDomain.H b/src/usr/diag/prdf/common/framework/config/prdfFabricDomain.H new file mode 100755 index 000000000..645daac21 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/prdfFabricDomain.H @@ -0,0 +1,163 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/prdfFabricDomain.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 prdfFabricDomain_H +#define prdfFabricDomain_H + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#if !defined(iipCallResolutionTemplate_h) + #include <iipCallResolutionTemplate.h> +#endif + +#include <prdfRuleChipDomain.H> +#include <prdfPlatServices.H> + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +/** + @file prdfFabricDomain.H + @brief Fabric Domain, contains Fabric Chips + @author Mike Kobler +*/ +class FabricDomain : public PrdfRuleChipDomain +{ + public: + + /** + * @brief Constructor + * @param i_did The domain ID + * @param i_size The projected size of the domain + */ + FabricDomain( DOMAIN_ID i_did, uint32_t i_size = PROC_DOMAIN_SIZE ) : + PrdfRuleChipDomain( i_did, i_size ) + {} + + /* + 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 sufficient + </ul><br> + */ + //~FabricDomain(); + + /* + Determin which chip to Analyze and call it's Analyze() function + <ul> + <br><b>Parameter: </b> serviceData (See iipServiceDataCollector.h) + <br><b>Parameter: </b> attentionType [MACHINE_CHECK|RECOVERED|SPECIAL] + <br><b>Returns: </b> return code (0 == SUCCESS) + <br><b>Requirements:</b> Query() == true, Initialize() + <br><b>Promises: </b> serviceData complete + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> This implementation calls Order() to determin + which chip to analyze and calls that chips + Analyze() function. + </ul><br> + */ + virtual int32_t Analyze( STEP_CODE_DATA_STRUCT & serviceData, + ATTENTION_TYPE attentionType ); + + /** + * @brief Determine which chip to Analyze in a list of chips in this domain. + * @note This main only analyze one chip in the domain. Not the whole domain. + * @param serviceData Service data collector. + * @param attentionType Attention of the chip. + * @param i_chips List of chips in the domain to analyze. + * @return SUCCESS + */ + virtual int32_t AnalyzeTheseChips( STEP_CODE_DATA_STRUCT & serviceData, + ATTENTION_TYPE attentionType, + TARGETING::TargetHandleList & i_chips ); + /** + * @brief Order chips in a list of chips in this domain. + * @note + * @param attentionType Attention of the chip. + * @param i_chips List of chips in the domain to analyze. + * @return SUCCESS + */ + virtual int32_t OrderTheseChips( ATTENTION_TYPE attentionType, + TARGETING::TargetHandleList & i_chips ); + + /** + * @brief Finds the pointer to the appropriate chip to do analysis or other. + * @note Just a function to help keep order in a subset of the domain. + * @param i_chipId Handle of the chip to find. + * @param i_chips List of chips in the domain to analyze. + * @return SUCCESS + */ + virtual PrdfRuleChip * FindChipInTheseChips( TARGETING::TargetHandle_t i_chipId, + TARGETING::TargetHandleList & i_chips ); + + /** + * @brief Moves the chip in question to the front of the list of chips. + * @note This gives analysis some good chance of finding the correct chip first. + * @param i_chipToFront The chip that should be in the front of the list. + * @param i_chips List of chips in the domain to analyze. + * @return SUCCESS + */ + virtual void MoveToFrontInTheseChips( uint32_t i_chipToFront, + TARGETING::TargetHandleList & i_chips ); + +protected: + + /** + Determin which chip to Analyze and call it's Analyze() function + <ul> + <br><b>Parameter: </b> attentionType [MACHINE_CHECK|RECOVERED|SPECIAL] + <br><b>Returns: </b> return code (0 == SUCCESS) + <br><b>Requirements:</b> Query() == true, Initialize() + <br><b>Promises: </b> chip at attention at top of list + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> + </ul><br> + */ + virtual void Order(ATTENTION_TYPE attentionType); + + /** + Determine which chip to Analyze on checkstop and put at front of list. + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> None. + <br><b>Requirements:</b> Query() == true, Initialize() + <br><b>Promises: </b> chip at attention at top of list + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> + </ul><br> + */ + virtual void SortForXstop(); + virtual void SortForRecov(); + +private: // functions +private: // Data + +}; + +#endif /* prdfFabricDomain_H */ diff --git a/src/usr/diag/prdf/common/framework/config/prdfMbaDomain.H b/src/usr/diag/prdf/common/framework/config/prdfMbaDomain.H new file mode 100644 index 000000000..3b98351c5 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/prdfMbaDomain.H @@ -0,0 +1,55 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/prdfMbaDomain.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 __PRDFMBADOMAIN_H +#define __PRDFMBADOMAIN_H + +#include <prdfRuleChipDomain.H> + +class PrdfMbaDomain : public PrdfRuleChipDomain +{ + public: + + /** + * @brief Constructor + * @param i_did The domain ID + * @param i_size The projected size of the domain + */ + PrdfMbaDomain( DOMAIN_ID i_did, uint32_t i_size = MBA_DOMAIN_SIZE ) : + PrdfRuleChipDomain( i_did, i_size ) + {} + + /** + * @brief Query for an attention of a specific type in this domain + * @param i_attnType [MACHINE_CHECK | RECOVERABLE | SPECIAL] + * @return false + * @note This function will always return false. That way PRD will look + * for the attention via the memory buffer chip. + */ + virtual bool Query( ATTENTION_TYPE i_attnType ) + { return false; } + +}; + +#endif /* __PRDFMBADOMAIN_H */ + diff --git a/src/usr/diag/prdf/common/framework/config/prdfMcsDomain.H b/src/usr/diag/prdf/common/framework/config/prdfMcsDomain.H new file mode 100644 index 000000000..60cdb5f21 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/prdfMcsDomain.H @@ -0,0 +1,55 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/prdfMcsDomain.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 __PRDFMCSDOMAIN_H +#define __PRDFMCSDOMAIN_H + +#include <prdfRuleChipDomain.H> + +class PrdfMcsDomain : public PrdfRuleChipDomain +{ + public: + + /** + * @brief Constructor + * @param i_did The domain ID + * @param i_size The projected size of the domain + */ + PrdfMcsDomain( DOMAIN_ID i_did, uint32_t i_size = MCS_DOMAIN_SIZE ) : + PrdfRuleChipDomain( i_did, i_size ) + {} + + /** + * @brief Query for an attention of a specific type in this domain + * @param i_attnType [MACHINE_CHECK | RECOVERABLE | SPECIAL] + * @return false + * @note This function will always return false. That way PRD will look + * for the attention via the processor chip. + */ + virtual bool Query( ATTENTION_TYPE i_attnType ) + { return false; } + +}; + +#endif /* __PRDFMCSDOMAIN_H */ + diff --git a/src/usr/diag/prdf/common/framework/config/prdfMembufDomain.H b/src/usr/diag/prdf/common/framework/config/prdfMembufDomain.H new file mode 100644 index 000000000..df4f08970 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/prdfMembufDomain.H @@ -0,0 +1,45 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/prdfMembufDomain.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 __PRDFMEMBUFDOMAIN_H +#define __PRDFMEMBUFDOMAIN_H + +#include <prdfRuleChipDomain.H> + +class PrdfMembufDomain : public PrdfRuleChipDomain +{ + public: + + /** + * @brief Constructor + * @param i_did The domain ID + * @param i_size The projected size of the domain + */ + PrdfMembufDomain( DOMAIN_ID i_did, uint32_t i_size = MEMBUF_DOMAIN_SIZE ) : + PrdfRuleChipDomain( i_did, i_size ) + {} + +}; + +#endif /* __PRDFMEMBUFDOMAIN_H */ + diff --git a/src/usr/diag/prdf/common/framework/config/prdfParentDomain.C b/src/usr/diag/prdf/common/framework/config/prdfParentDomain.C new file mode 100755 index 000000000..83c46a7ed --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/prdfParentDomain.C @@ -0,0 +1,106 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/prdfParentDomain.C $ */ +/* */ +/* 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 */ + +// Module Description ************************************************** +// +// Description: This module provides the implementation for the PRD +// DomainContainer class. +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- + +#include <iipglobl.h> +#include <iipDomain.h> +#include <prdfPllDomain.H> + +#include <prdfParentDomain.H> +#include <prdfExtensibleDomain.H> +#include <prdfPluginDef.H> + +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + + +//Constructor +template<class T> +ParentDomain<T>::ParentDomain() +{ + //TODO::Do I need to have this here to clear out the vector? + VectorOfDomainPointerType iv_childrenDomains(); +} + + +//This code is primarily for the configurator. +template<class T> +int32_t ParentDomain<T>::AddChild(TARGETING::TargetHandle_t i_pchipHandle, T * i_childDomain) +{ + int32_t l_rc = SUCCESS; + + ChipToDomainPointerPairType l_chipDomPtrPair + = ChipToDomainPointerPairType(i_pchipHandle, i_childDomain); + iv_childrenDomains.push_back(l_chipDomPtrPair); + return(l_rc); +} + +//Just getting an iterator to go through the vector of chip/domain pairs. +template<class T> +typename ParentDomain<T>::iterator ParentDomain<T>::getBeginIterator() +{ + return(iv_childrenDomains.begin()); +} + +template<class T> +typename ParentDomain<T>::iterator ParentDomain<T>::getEndIterator() +{ + return(iv_childrenDomains.end()); +} + + +//This instance of ParentDomain has to remain after the definition +// of the Templated class function or it won't link correctly. +template class ParentDomain<PrdfExtensibleDomain>; + diff --git a/src/usr/diag/prdf/common/framework/config/prdfParentDomain.H b/src/usr/diag/prdf/common/framework/config/prdfParentDomain.H new file mode 100755 index 000000000..79ef13097 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/prdfParentDomain.H @@ -0,0 +1,129 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/prdfParentDomain.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 prdfParentDomain_H +#define prdfParentDomain_H + +#include <prdfRuleChip.H> +#include <vector> + +/** + Template class that Define a domain Parent that contain other domains as children. + @par + @note Parent class: Domain + @par Usage Examples: + @code + @endcode +*/ +template <typename T> +class ParentDomain +{ +public: + + //The information stored for chaining Domains is two things. a Chip of origin. + // Also, a pointer the the child domain. The child domain is the next domain in + // a potential chain or string of domains. The chip is the original chip that started it. + + typedef std::pair< TARGETING::TargetHandle_t, T * > ChipToDomainPointerPairType; + typedef std::vector< ChipToDomainPointerPairType > VectorOfDomainPointerType; + // Need to add typename here to tell the compiler that vector< ... >::iterator is a type. + // Otherwise because of the T template parm it doesn't know it's a type yet. + typedef typename std::vector< ChipToDomainPointerPairType >::iterator iterator; + + /** + Constructor + <ul> + <br><b>Parameter: </b> domainId: Identifies the Domain (See iipconst.h) + <br><b>Parameter: </b> size: Estimate of max number of chips in domain + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Object created + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> + </ul><br> + */ + ParentDomain(); + + /** + Add Children to this chip in this domain. + <ul> + <br><b>Parameter: </b> domainId: Identifies the Domain (See iipconst.h) + <br><b>Parameter: </b> chip: Parent to add children to. + <br><b>Parameter: </b> chipList: List of children to add to this Parent. + <br><b>Returns: </b> SUCCESS or FAILURE. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Object created + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> + </ul><br> + */ + int32_t AddChild(TARGETING::TargetHandle_t i_pchipHandle, T * i_childDomain); + + /** + Returns a begin iterator to a list of children domains. + <ul> + <br><b>Parameter: </b> None. + <br><b>Returns: </b> begin iterator. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> + </ul><br> + */ + iterator getBeginIterator(); + + /** + Returns a end iterator to a list of children domains. + <ul> + <br><b>Parameter: </b> None. + <br><b>Returns: </b> end iterator. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> + </ul><br> + */ + iterator getEndIterator(); + + /** + Prints out the ids of the parent chip and children domains. + <ul> + <br><b>Parameter: </b> None + <br><b>Returns: </b> begin iterator. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> + </ul><br> + */ + void printChildrenIds(); + +protected: + +private: + + VectorOfDomainPointerType iv_childrenDomains; + +}; + +#endif diff --git a/src/usr/diag/prdf/common/framework/config/prdfPllDomain.C b/src/usr/diag/prdf/common/framework/config/prdfPllDomain.C new file mode 100755 index 000000000..3acd6c45c --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/prdfPllDomain.C @@ -0,0 +1,290 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/prdfPllDomain.C $ */ +/* */ +/* 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 */ + +/** @file prdfPllDomain.C + * @brief Definition of PllDomain class + */ + +#include <CcAutoDeletePointer.h> +#include <iipscr.h> +#include <iipsdbug.h> +#include <iipServiceDataCollector.h> +#include <prdfErrorSignature.H> +#include <prdfPllDomain.H> +#include <iipResolution.h> +#include <prdfPlatServices.H> +#include <prdfPluginDef.H> +#include <iipglobl.h> +#include <iipSystem.h> + +namespace PRDF +{ + +//------------------------------------------------------------------------------ + +int32_t PllDomain::Initialize(void) +{ + + int32_t rc = SUCCESS; + if(PlatServices::isMasterFSP()) + { +//@jl01 D-START +//Deleting the call of the ClearPll error. +//These errors used to have to be cleared before you tried to use the chips. +//However, the inits from other comps are better are cleaning up the PLL errors. +// for (unsigned int i = 0; i < GetSize() && rc == SUCCESS; ++i) +// { +// PrdfExtensibleChip * l_chip = LookUp(i); +// PrdfExtensibleFunction * l_clearPll = l_chip->getExtensibleFunction("ClearPll"); + // Call ClearPll on this chip (see prdfPluginDef.H for bindParm defn) +// (*l_clearPll)(l_chip,PrdfPluginDef::bindParm<void *>(NULL)); +//@jl01 D-END + +// Don't unmask 04/20/2006 Review +// PrdfExtensibleFunction * l_unmask = l_chip->getExtensibleFunction("UnmaskPll"); +// (*l_unmask)(l_chip,PrdfPluginDef::bindParm<void *>(NULL)); +// } + } + return(rc); +} + +//------------------------------------------------------------------------------ + +bool PllDomain::Query(ATTENTION_TYPE attentionType) +{ + bool atAttn = false; + // System always checks for RE's first, even if there is an XSTOP + // So we only need to check for PLL errors on RECOVERABLE type + if(attentionType == RECOVERABLE) + { + // check sysdbug for attention first + SYSTEM_DEBUG_CLASS sysdbug; + for(unsigned int index = 0; (index < GetSize()) && (atAttn == false); + ++index) + { + if(sysdbug.IsAttentionActive(LookUp(index)->GetChipHandle())) + { + PrdfExtensibleChip * l_chip = LookUp(index); + PrdfExtensibleChipFunction * l_query = + l_chip->getExtensibleFunction("QueryPll"); + int32_t rc = (*l_query)(l_chip,PrdfPluginDef::bindParm<bool &>(atAttn)); + // if rc then scom read failed - Error log has already been generated + if( PRD_POWER_FAULT == rc ) + { + PRDF_ERR( "prdfPllDomain::Query() Power Fault detected!" ); + break; + } + else if(SUCCESS != rc) + { + PRDF_ERR( "prdfPllDomain::Query() SCOM fail. RC=%x", rc ); + } + } + } + } + + return(atAttn); +} + +//------------------------------------------------------------------------------ + +int32_t PllDomain::Analyze(STEP_CODE_DATA_STRUCT & serviceData, + ATTENTION_TYPE attentionType) +{ + typedef PrdfExtensibleChip * ChipPtr; + CcAutoDeletePointerVector<ChipPtr> chip(new ChipPtr[GetSize()]); + int count = 0; + int32_t rc = SUCCESS; + + // Due to clock issues some chips may be moved to non-functional during + // analysis. In this case, these chips will need to be removed from their + // domains. + typedef std::vector<PrdfExtensibleChip *> NonFuncChips; + NonFuncChips nfchips; + + // Count # of chips that had PLL error + for(unsigned int index = 0; index < GetSize(); ++index) + { + PrdfExtensibleChip * l_chip = LookUp(index); + PrdfExtensibleChipFunction * l_query = l_chip->getExtensibleFunction("QueryPll"); + bool atAttn; + rc = (*l_query)(l_chip,PrdfPluginDef::bindParm<bool &>(atAttn)); + if(atAttn == true) + { + chip()[count] = LookUp(index); + ++count; + l_chip->CaptureErrorData(serviceData.service_data->GetCaptureData()); + } + else if ( !PlatServices::isFunctional(l_chip->GetChipHandle()) ) + { + // The chip is now non-functional. + nfchips.push_back( l_chip ); + } + } + + // Remove all non-functional chips. + for ( NonFuncChips::iterator i = nfchips.begin(); i != nfchips.end(); i++ ) + { + systemPtr->RemoveStoppedChips( (*i)->GetChipHandle() ); + } + + // always suspect the clock source + closeClockSource.Resolve(serviceData); // dg06c + if(&closeClockSource != &farClockSource) + { + farClockSource.Resolve(serviceData); // dg06c + } + + // If only one detected the error, add it to the callout list. + if ( 1 == count ) + { + const uint32_t tmpCount = serviceData.service_data->GetMruList().size(); + + // Call this chip's CalloutPll plugin if it exists. + PrdfExtensibleChipFunction * l_callout = + chip()[0]->getExtensibleFunction( "CalloutPll", true ); + if ( NULL != l_callout ) + { + (*l_callout)( chip()[0], + PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT &>(serviceData) ); + } + + if ( tmpCount == serviceData.service_data->GetMruList().size() ) + { + // No additional callouts were made so add this chip to the list. + serviceData.service_data->SetCallout( chip()[0]->GetChipHandle()); + } + } + + iv_threshold.Resolve(serviceData); + // Test for threshold + if(serviceData.service_data->IsAtThreshold()) + { + // Mask in all chips in domain + PrdfExtensibleDomainFunction * l_mask = getExtensibleFunction("MaskPll"); + (*l_mask)(this, + PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(serviceData)); + } + // Set Signature + serviceData.service_data->GetErrorSignature()->setChipId(chip()[0]->GetId()); + serviceData.service_data->GetErrorSignature()->setRegId(PRDF_PLL_ERROR); + +#ifndef __HOSTBOOT_MODULE + // Set dump flag dg09a + serviceData.service_data->SetDump(iv_dumpContent,chip()[0]->GetChipHandle()); +#endif + + // Clear PLLs from this domain. + PrdfExtensibleDomainFunction * l_clear = getExtensibleFunction("ClearPll"); + (*l_clear)(this, + PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(serviceData)); + + // Run any PLL Post Analysis functions from this domain. + for(int i = 0; i < count; i++) + { + PrdfExtensibleChip * l_chip = chip()[i]; + // Send any special messages indicating there was a PLL error. + PrdfExtensibleChipFunction * l_pllPostAnalysis = + l_chip->getExtensibleFunction("PllPostAnalysis", true); + (*l_pllPostAnalysis)(l_chip, + PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(serviceData)); + } + + return rc; +} + +//------------------------------------------------------------------------------ + +void PllDomain::Order(ATTENTION_TYPE attentionType) +{ + // Order is not important for PLL errors +} + +//------------------------------------------------------------------------------ + +int32_t PllDomain::ClearPll( PrdfExtensibleDomain * i_domain, + STEP_CODE_DATA_STRUCT i_sc ) +{ + PllDomain * l_domain = (PllDomain *) i_domain; + + // Clear children chips. + for ( uint32_t i = 0; i < l_domain->GetSize(); i++ ) + { + PrdfExtensibleChip * l_chip = l_domain->LookUp(i); + PrdfExtensibleChipFunction * l_clear = + l_chip->getExtensibleFunction("ClearPll"); + (*l_clear)( l_chip, + PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(i_sc) ); + } + + // Clear children domains. + // This looks like a recursive call. It calls other domains of Clear. + ParentDomain<PrdfExtensibleDomain>::iterator i; + for (i = l_domain->getBeginIterator(); i != l_domain->getEndIterator(); i++) + { + // Clear PLLs from this domain. + PrdfExtensibleDomainFunction * l_clear = + (i->second)->getExtensibleFunction("ClearPll"); + (*l_clear)( i->second, + PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(i_sc) ); + } + + return SUCCESS; +} +PRDF_PLUGIN_DEFINE( PllDomain, ClearPll ); + +//------------------------------------------------------------------------------ + +int32_t PllDomain::MaskPll( PrdfExtensibleDomain * i_domain, + STEP_CODE_DATA_STRUCT i_sc ) +{ + PllDomain * l_domain = (PllDomain *) i_domain; + + // Mask children chips. + for ( uint32_t i = 0; i < l_domain->GetSize(); i++ ) + { + PrdfExtensibleChip * l_chip = l_domain->LookUp(i); + PrdfExtensibleChipFunction * l_mask = + l_chip->getExtensibleFunction("MaskPll"); + (*l_mask)( l_chip, + PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(i_sc) ); + } + + // Mask children domains. + // This looks like a recursive call. It calls other domains of Mask. + ParentDomain<PrdfExtensibleDomain>::iterator i; + for (i = l_domain->getBeginIterator(); i != l_domain->getEndIterator(); i++) + { + PrdfExtensibleDomainFunction * l_mask = + (i->second)->getExtensibleFunction("MaskPll"); + (*l_mask)( i->second, + PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(i_sc) ); + } + + return SUCCESS; +} +PRDF_PLUGIN_DEFINE( PllDomain, MaskPll ); + +//------------------------------------------------------------------------------ + +} // end namespace PRDF + diff --git a/src/usr/diag/prdf/common/framework/config/prdfPllDomain.H b/src/usr/diag/prdf/common/framework/config/prdfPllDomain.H new file mode 100755 index 000000000..b5d55a206 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/prdfPllDomain.H @@ -0,0 +1,187 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/prdfPllDomain.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2006,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 prdfPllDomain_H +#define prdfPllDomain_H + +#include <iipDomain.h> +#include <iipResolutionFactory.h> +#include <prdfExtensibleDomain.H> +#include <prdfParentDomain.H> +#include <prdfRuleChipDomain.H> +#include <prdfThresholdResolutions.H> + +#ifndef __HOSTBOOT_MODULE + #include <hdctContent.H> // for hwTableContent +#endif + +namespace PRDF +{ + +//------------------------------------------------------------------------------ + +class PllDomain : public PrdfRuleChipDomain, public PrdfExtensibleDomain, + public ParentDomain<PrdfExtensibleDomain> +{ + public: + +#ifdef __HOSTBOOT_MODULE + + /** @fn PllDomain + * @brief Constructor + * @param DOMAIN_ID - the domain ID + * @param Resolution to callout the correct clock source + * @param ThresholdResolution::ThresholdPolicy + */ + PllDomain( DOMAIN_ID domain_id, Resolution & clockSource, + const ThresholdResolution::ThresholdPolicy & i_mfgThresh ); + +#else // not __HOSTBOOT_MODULE + + /** @fn PllDomain + * @brief Constructor + * @param DOMAIN_ID - the domain ID + * @param Resolution to callout the correct clock source + * @param Dump content + * @param ThresholdResolution::ThresholdPolicy + */ + PllDomain( DOMAIN_ID domain_id, Resolution & clockSource, + hwTableContent i_hwdc, + const ThresholdResolution::ThresholdPolicy & i_mfgThresh ); + +#endif // not __HOSTBOOT_MODULE + + /** + Perform any initialization required by the hardware + @returns error code + @post PLL errors cleared in hardware. + */ + virtual int32_t Initialize(void); + + /** + Query if anything in this domain is at the attention type specified + @param Attention type to query for. (@see iipsdbug.h) + @returns [true|false] + @pre Initialize() + @post NONE + */ + virtual bool Query(ATTENTION_TYPE attentionType); + + /** + Analyze errors within the domain + @param service data collector + @param attentiont type (@see iipsdbug.h) + @returns service data collector - completed + @return return code + @pre Initialize(); Query() == true + @post domain element order may be modified. + */ + virtual int32_t Analyze( STEP_CODE_DATA_STRUCT & serviceData, + ATTENTION_TYPE attentionType ); + + /** + * @brief Domain level plugin function used to clear PLL attentions in a + * domain and its subdomains. + * @param i_domain The target PLL domain. + * @param i_sc The step code data struct. + * @return SUCCESS + */ + static int32_t ClearPll( PrdfExtensibleDomain * i_domain, + STEP_CODE_DATA_STRUCT i_sc ); + + /** + * @brief Domain level plugin function used to mask PLL attentions in a + * domain and its subdomains. + * @param i_domain The target PLL domain. + * @param i_sc The step code data struct. + * @return SUCCESS + */ + static int32_t MaskPll( PrdfExtensibleDomain * i_domain, + STEP_CODE_DATA_STRUCT i_sc ); + +protected: + + /** + Order the domain - with detecting element at the top + @param Attention type (@see iipsdbug.h) + @post domain elemenet order may be altered + @note this is called by Analyze() + */ + virtual void Order(ATTENTION_TYPE attentionType); + +private: // functions +private: // Data + + enum {CONTAINER_SIZE = 8, PRDF_PLL_ERROR = 0xed}; + + Resolution & closeClockSource; + Resolution & farClockSource; + + Resolution & iv_threshold; + +#ifndef __HOSTBOOT_MODULE + hwTableContent iv_dumpContent; +#endif + +}; + +//------------------------------------------------------------------------------ + +#ifdef __HOSTBOOT_MODULE + +inline +PllDomain::PllDomain( DOMAIN_ID domain_id, Resolution & clockSource, + const ThresholdResolution::ThresholdPolicy& i_mfgThresh) : + PrdfRuleChipDomain( domain_id, PllDomain::CONTAINER_SIZE ), + PrdfExtensibleDomain("PllDomain"), + closeClockSource(clockSource), + farClockSource(clockSource), + iv_threshold( ResolutionFactory::Access().GetThresholdResolution( 1, + ThresholdResolution::cv_pllDefault, + i_mfgThresh ) ) +{} + +#else // not __HOSTBOOT_MODULE + +inline +PllDomain::PllDomain( DOMAIN_ID domain_id, Resolution & clockSource, + hwTableContent i_hwdc, + const ThresholdResolution::ThresholdPolicy& i_mfgThresh) : + PrdfRuleChipDomain( domain_id, PllDomain::CONTAINER_SIZE ), + PrdfExtensibleDomain("PllDomain"), + closeClockSource(clockSource), + farClockSource(clockSource), + iv_threshold( ResolutionFactory::Access().GetThresholdResolution( 1, + ThresholdResolution::cv_pllDefault, + i_mfgThresh ) ), + iv_dumpContent(i_hwdc) +{} + +#endif // not __HOSTBOOT_MODULE + +//------------------------------------------------------------------------------ + +} // end namespace PRDF + +#endif /* prdfPllDomain_H */ + diff --git a/src/usr/diag/prdf/common/framework/config/prdfRuleChipDomain.C b/src/usr/diag/prdf/common/framework/config/prdfRuleChipDomain.C new file mode 100755 index 000000000..212fbe993 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/prdfRuleChipDomain.C @@ -0,0 +1,193 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/prdfRuleChipDomain.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2008,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 */ + +#include <prdfRuleChipDomain.H> + +//#include <iipstep.h> +//#include <iipsdbug.h> +//#include <iipErrorRegister.h> +//#include <iipServiceDataCollector.h> +//#include <iipCallResolutionTemplate.h> + +//------------------------------------------------------------------------------ + +bool PrdfRuleChipDomain::Query( ATTENTION_TYPE i_attnType ) +{ + using namespace PRDF; + + bool o_rc = false; + + using PrdfPluginDef::bindParm; + SYSTEM_DEBUG_CLASS sysdbug; + + for ( uint32_t i = 0; i < GetSize(); i++ ) + { + PrdfRuleChip * chip = LookUp(i); + TARGETING::TargetHandle_t l_pchipHandle = LookUp(i)->GetChipHandle(); + + if ( sysdbug.IsAttentionActive(l_pchipHandle) ) + { + // First check if this chip is reporting the correct attention type. + if ( sysdbug.GetAttentionType(l_pchipHandle) == i_attnType ) + { + // If the attention type is a checkstop, check if the chip is + // reporting based on an externally signaled error condition. If + // so, ignore this chip (the chip reporting the checkstop will + // be found later). + + // If the attention type is RECOVERABLE and if the SN chip has an + // attached MC with a checkstop, ignore this Rec attn. + //mp01 c Start + const char * funcName; + + switch(i_attnType) + { + case CHECK_STOP: + case UNIT_CS: + funcName = "IgnoreCheckstopAttn"; + break; + case RECOVERABLE: + funcName = "IgnoreRecoveredAttn"; + break; + case SPECIAL: + funcName = "IgnoreSpecialAttn"; + break; + default: + continue; + } + + PrdfExtensibleChipFunction * ef + = chip->getExtensibleFunction( funcName, true ); + + bool ignore = false; + (*ef)( chip, bindParm<bool &, const ATTENTION_TYPE> + (ignore, i_attnType) ); + + if ( ignore ) + continue; + + o_rc = true; + break; + //mp01 c Stop + + } + + // If the attention type is recoverable and this chip is reporting a + // checkstop, check for recovereable errors on this chip. + if ( (i_attnType == RECOVERABLE) && + ( (sysdbug.GetAttentionType(l_pchipHandle) == CHECK_STOP) || + (sysdbug.GetAttentionType(l_pchipHandle) == UNIT_CS) ) ) + { + PrdfExtensibleChipFunction * ef + = chip->getExtensibleFunction("CheckForRecovered"); + (*ef)(chip, bindParm<bool &>(o_rc)); + + if ( o_rc ) break; + } + } + } + + return o_rc; +} + +//------------------------------------------------------------------------------ + +void PrdfRuleChipDomain::Order( ATTENTION_TYPE i_attnType ) +{ + using namespace PRDF; + + using PrdfPluginDef::bindParm; + SYSTEM_DEBUG_CLASS sysdbug; + const char * funcName; //mp01 a + + + for ( int32_t i = (GetSize() - 1); i >= 0; i-- ) + { + PrdfRuleChip * chip = LookUp(i); + TARGETING::TargetHandle_t l_pchipHandle = LookUp(i)->GetChipHandle(); + + if ( sysdbug.IsAttentionActive(l_pchipHandle) ) + { + // Move the first chip with this attention type to the front of the + // list. + if ( sysdbug.GetAttentionType(l_pchipHandle) == i_attnType ) + { + // If the attention type is a checkstop, check if the chip is + // reporting based on an externally signaled error condition. If + // so, ignore this chip (the chip reporting the checkstop will + // be found later). + + // If the attention type is RECOVERABLE and if the SN chip has an + // attached MC with a checkstop, ignore this Rec attn. + //mp01 c Start + switch(i_attnType) + { + case CHECK_STOP: + case UNIT_CS: + funcName = "IgnoreCheckstopAttn"; + break; + case RECOVERABLE: + funcName = "IgnoreRecoveredAttn"; + break; + case SPECIAL: + funcName = "IgnoreSpecialAttn"; + break; + default: + continue; + } + + PrdfExtensibleChipFunction * ef + = chip->getExtensibleFunction( funcName, true ); + + bool ignore = false; + (*ef)( chip, bindParm<bool &, const ATTENTION_TYPE> + (ignore, i_attnType) ); + + if ( ignore ) + continue; + + MoveToFront(i); + break; + //mp01 c Stop + } + + // If the attention type is recoverable and this chip is reporting a + // checkstop, check for recovereable errors on this chip. + if ( (i_attnType == RECOVERABLE) && + ( (sysdbug.GetAttentionType(l_pchipHandle) == CHECK_STOP) || + (sysdbug.GetAttentionType(l_pchipHandle) == UNIT_CS) ) ) + { + PrdfExtensibleChipFunction * ef + = chip->getExtensibleFunction("CheckForRecovered"); + bool hasRer = false; + (*ef)(chip, bindParm<bool &>(hasRer)); + + if ( hasRer ) + { + MoveToFront(i); + break; + } + } + } + } +} diff --git a/src/usr/diag/prdf/common/framework/config/prdfRuleChipDomain.H b/src/usr/diag/prdf/common/framework/config/prdfRuleChipDomain.H new file mode 100755 index 000000000..9b3fb7654 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/prdfRuleChipDomain.H @@ -0,0 +1,77 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/prdfRuleChipDomain.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2008,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 PRDFRULECHIPDOMAIN_H +#define PRDFRULECHIPDOMAIN_H + +#include <iipDomainContainer.h> +#include <prdfRuleChip.H> + +class PrdfRuleChipDomain : public DomainContainer<PrdfRuleChip> +{ + public: + + enum DefaultDomainSize + { + // At minimum, should allocate for a fully configured single P8 murano + // system. + + PROC_DOMAIN_SIZE = 1, + EX_DOMAIN_SIZE = PROC_DOMAIN_SIZE * 6, + MCS_DOMAIN_SIZE = PROC_DOMAIN_SIZE * 4, + + MEMBUF_DOMAIN_SIZE = MCS_DOMAIN_SIZE, + MBA_DOMAIN_SIZE = MEMBUF_DOMAIN_SIZE * 2, + + TOTAL_CHIPS = PROC_DOMAIN_SIZE + EX_DOMAIN_SIZE + MCS_DOMAIN_SIZE + + MEMBUF_DOMAIN_SIZE + MBA_DOMAIN_SIZE, + + TOTAL_DOMAINS = 5, + }; + + /** @fn PrdfRuleChipDomain + * @brief Constructor + * @param DOMAIN_ID - the domain ID + * @param uint32_t - the projected size of the domain + */ + PrdfRuleChipDomain( DOMAIN_ID i_did, uint32_t i_size ) : + DomainContainer<PrdfRuleChip>( i_did, i_size ) + {} + + /** @fn Query + * @brief Query for an attention of a specific type in this domain + * @param ATTENTION_TYPE [MACHINE_CHECK | RECOVERABLE | SPECIAL] + * @return TRUE if a chip in the domain is at attention. + */ + virtual bool Query( ATTENTION_TYPE i_attnType); + + protected: + + /** @fn Order + * @brief Prioritizes the components of this domain for Analysis + * @param ATTENTION_TYPE [MACHINE_CHECK | RECOVERABLE | SPECIAL] + */ + virtual void Order( ATTENTION_TYPE i_attnType); +}; + +#endif /* PRDFRULECHIPDOMAIN_H */ diff --git a/src/usr/diag/prdf/common/framework/config/prdfSystemSpecific.H b/src/usr/diag/prdf/common/framework/config/prdfSystemSpecific.H new file mode 100755 index 000000000..295c67486 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/prdfSystemSpecific.H @@ -0,0 +1,54 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/prdfSystemSpecific.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2008,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 prdfSystemSpecific.H + * @brief Redirection namespace for code specific for product families. + * + * The purpose of this namespace is to add an indirection between prdf_main + * and the various family implementations. This allows us to create a family + * specific library to reduce flash requirements when we have to support + * multiple families with the same code level. (P6 and P7 for example). + * + * There is a P6 implementation for eCLipz, P7 implementation for Apollo and + * P8 implementation for pegasus + * These are in the appropriate rule/<family> directory in P6/P7. + * For p8 these are defines in plat/<family> directory. + * + * For shipping code, only one implementation is in the shipped library. The + * eCLipz instance goes in the libprdfh_p6.so, etc. + * + */ + +#ifndef __PRDFSYSTEMSPECIFIC_H +#define __PRDFSYSTEMSPECIFIC_H + +#include <iipConfigurator.h> +#include <iipstep.h> + +namespace PrdfSystemSpecific +{ + PRDF::Configurator * getConfiguratorPtr(); + void postAnalysisWorkarounds(STEP_CODE_DATA_STRUCT & i_sdc); +}; + +#endif diff --git a/src/usr/diag/prdf/common/framework/config/xspprdAccessPllChip.C b/src/usr/diag/prdf/common/framework/config/xspprdAccessPllChip.C new file mode 100755 index 000000000..b1f2b91e9 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/xspprdAccessPllChip.C @@ -0,0 +1,206 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/xspprdAccessPllChip.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: +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define xspprdAccessPllChip_C + +#include <xspprdAccessPllChip.h> + +#if !defined(IIPSCR_H) +#include <iipscr.h> +#endif + +#if !defined(PRDFSCANFACILITY_H) +#include <prdfScanFacility.H> +#endif + +#include <iipServiceDataCollector.h> + +#undef xspprdAccessPllChip_C +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- +const uint32_t PLL_LOCK = 0x00800003; // Pll status address +const uint32_t PLL_MASK = 0x0080000C; // Pll Mask/Block reg address +const uint32_t PLL_ID = 0xeed; +// Pll status bit definitions +const uint32_t PLL0 = 8; +const uint32_t PLL1 = 9; +const uint32_t PLL2 = 10; +const uint32_t PLL3 = 11; +const uint32_t PLLBLK0 = 8; +const uint32_t PLLBLK1 = 9; +const uint32_t PLLBLK2 = 10; +const uint32_t PLLBLK3 = 11; + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +// -------------------------------------------------------------------- + +bool AccessPllChip::QueryPll(void) +{ + bool hasPll = false; + SCAN_COMM_REGISTER_CLASS & pll_lock_reg = + ScanFacility::Access().GetScanCommRegister(GetChipHandle(),PLL_LOCK,64); + SCAN_COMM_REGISTER_CLASS & pll_mask_reg = + ScanFacility::Access().GetScanCommRegister(GetChipHandle(),PLL_MASK,64); + + + // Read pll_lock register + int32_t rc = pll_lock_reg.Read(); + pll_mask_reg.Read(); + + if (rc == SUCCESS) { + const BIT_STRING_CLASS * lock = pll_lock_reg.GetBitString(); + const BIT_STRING_CLASS * mask = pll_mask_reg.GetBitString(); + + if ( (lock != NULL) && (mask != NULL) ) { + CPU_WORD senseBits = lock->GetField(PLL0, 4); + CPU_WORD blockBits = mask->GetField(PLLBLK0, 4); + if (senseBits & (~blockBits)) hasPll = true; + } + } + + return hasPll; +} + +// -------------------------------------------------------------------- + +int32_t AccessPllChip::ClearPll(void) +{ + int32_t rc = SUCCESS; + SCAN_COMM_REGISTER_CLASS & pll_lock_reg = + ScanFacility::Access().GetScanCommRegister(GetChipHandle(),PLL_LOCK,64); +// SCAN_COMM_REGISTER_CLASS & pll_mask_reg = +// ScanFacility::Access().GetScanCommRegister(GetId(),PLL_MASK,64); + + pll_lock_reg.Read(); + + // Need to also clear out status bits + pll_lock_reg.ClearBit(PLL0); + pll_lock_reg.ClearBit(PLL1); + pll_lock_reg.ClearBit(PLL2); + pll_lock_reg.ClearBit(PLL3); + + rc = pll_lock_reg.Write(); + + return rc; +} + +// -------------------------------------------------------------------- + +int32_t AccessPllChip::MaskPll(STEP_CODE_DATA_STRUCT & serviceData) +{ + int32_t rc = SUCCESS; +// SCAN_COMM_REGISTER_CLASS & pll_lock_reg = +// ScanFacility::Access().GetScanCommRegister(GetId(),PLL_LOCK,64); + SCAN_COMM_REGISTER_CLASS & pll_mask_reg = + ScanFacility::Access().GetScanCommRegister(GetChipHandle(),PLL_MASK,64); + + + //Read pll status reg mask to get current state + pll_mask_reg.Read(); + + // Set mask bits for pll + pll_mask_reg.SetBit(PLLBLK0); + pll_mask_reg.SetBit(PLLBLK1); + pll_mask_reg.SetBit(PLLBLK2); + pll_mask_reg.SetBit(PLLBLK3); + + // Write back to hardware + rc = pll_mask_reg.Write(); + + return rc; +} + +// -------------------------------------------------------------------- + +int32_t AccessPllChip::UnMaskPll(void) +{ + int32_t rc = SUCCESS; +// SCAN_COMM_REGISTER_CLASS & pll_lock_reg = +// ScanFacility::Access().GetScanCommRegister(GetId(),PLL_LOCK,64); + SCAN_COMM_REGISTER_CLASS & pll_mask_reg = + ScanFacility::Access().GetScanCommRegister(GetChipHandle(),PLL_MASK,64); + + //Read pll status reg mask to get current state + pll_mask_reg.Read(); + + // Set mask bits for pll + pll_mask_reg.ClearBit(PLLBLK0); + pll_mask_reg.ClearBit(PLLBLK1); + pll_mask_reg.ClearBit(PLLBLK2); + pll_mask_reg.ClearBit(PLLBLK3); + + // Write back to hardware + rc = pll_mask_reg.Write(); + + return rc; +} +// -------------------------------------------------------------------- + +void AccessPllChip::CapturePll(STEP_CODE_DATA_STRUCT & serviceData) +{ + SCAN_COMM_REGISTER_CLASS & pll_lock_reg = + ScanFacility::Access().GetScanCommRegister(GetChipHandle(),PLL_LOCK,64); + (serviceData.service_data->GetCaptureData()).Add(GetChipHandle(), PLL_ID ,pll_lock_reg); +} + +// -------------------------------------------------------------------- +// -------------------------------------------------------------------- + + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- --------- ---- -------- -------- ------------------------------ +// v5r2 04/14/00 mkobler Initial Creation +// 512857 fips240 07/29/05 dgilbert add AccessPllChip +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/config/xspprdAccessPllChip.h b/src/usr/diag/prdf/common/framework/config/xspprdAccessPllChip.h new file mode 100755 index 000000000..7abc4d237 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/config/xspprdAccessPllChip.h @@ -0,0 +1,144 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/config/xspprdAccessPllChip.h $ */ +/* */ +/* 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 */ + +#ifndef xspprdAccessPllChip_h +#define xspprdAccessPllChip_h + +// Class Description ************************************************* +// +// Name: xspprdAccessPllChip +// Base class: PllChip +// +// Description: Provide PLL support for chips that have Access jtag interface +// Usage: +// +// End Class Description ********************************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#include <iipchip.h> + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +/** + * Provide PLL support for chips that have Access jtag interface + * + * @author Doug Gilbert + */ +class AccessPllChip : public CHIP_CLASS +{ + public: + + /** + * @brief Constructor + * @param i_target A chip target. + */ + explicit AccessPllChip( TARGETING::TargetHandle_t i_target ); + + /** + Query hardware to see if there is a PLL error reported by this chip + <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> + */ + virtual bool QueryPll(); + + /** + Clear the pll check bit(s) in the hardware + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> return code + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual int32_t ClearPll(); + + /** + Disable the reporting of PLL errors in the hardware + <ul> + <br><b>Parameters: </b> serviceData + <br><b>Returns: </b> return code + <br><b>Requirements:</b> none. + <br><b>Promises: </b> serviceData may be modified + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual int32_t MaskPll(STEP_CODE_DATA_STRUCT & serviceData); + + /** + Enable the reporting of PLL errors in the hardware + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> return code + <br><b>Requirements:</b> none. + <br><b>Promises: </b> none. + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual int32_t UnMaskPll(); + + /** + * Add the PLL status register to the service Capturedata + * @param Service Data collector + * @pre none + * @post service data collectors' capture data has the content of the PLL + * status reg + */ + void CapturePll(STEP_CODE_DATA_STRUCT & serviceData); + + private: // functions + + /** + Copy constructor - Forbidden + <ul> + <br><b>Notes: </b> No definitions should exist + </ul><br> + */ + AccessPllChip(const AccessPllChip &); + /** + Assignment operator - Forbidden + <ul> + <br><b>Notes: </b> No definitions should exist + </ul><br> + */ + AccessPllChip & operator=(const AccessPllChip &); + + private: // Data + +}; + +inline AccessPllChip::AccessPllChip( TARGETING::TargetHandle_t i_target ) : + CHIP_CLASS(i_target) +{} + +#endif /* xspprdAccessPllChip_h */ diff --git a/src/usr/diag/prdf/common/framework/register/iipCaptureData.h b/src/usr/diag/prdf/common/framework/register/iipCaptureData.h new file mode 100755 index 000000000..eaa25b163 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipCaptureData.h @@ -0,0 +1,367 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipCaptureData.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 iipCaptureData_h +#define iipCaptureData_h + +// Class Specification ************************************************* +// +// Class name: CaptureData +// Parent class: None. +// +// Summary: This class provides a queue-like buffer for recording Scan +// Comm Register data. +// +// When this class is constructed or the Clear() member +// function is called, the buffer is empty. The Add() +// function adds data to the front or back of this buffer. +// The data is ordered according to the sequence of Add() +// calls and the Place parameter (FRONT or BACK). A Scan +// Comm Register is passed to the Add() function and the +// register is read during the Add() function. The data is +// then stored internally. Whenever the Copy() member +// function is called, the current internal data is copied to +// the specified buffer with respect to the current ordering. +// Only the number of bytes specified are copied. Therefore, +// any data that MUST be copied should be added using the +// FRONT placement. +// +// Cardinality: N +// +// Performance/Implementation: +// Space Complexity: Linear based on the number of Add() calls +// Time Complexity: All member functions constant unless otherwise +// stated. +// +// Usage Examples: +// +// BIT8 data[BUFFER_SIZE]; +// +// void foo(TARGETING::TargetHandle_t chipId, ScanCommRegisterAccess & scr) +// { +// CaptureData captureData; +// +// captureData.Add(chipId, scr, CaptureData::FRONT); +// captureData.Add(chipId, scr, CaptureData::BACK); +// +// int bytesCopied = captureData.Copy(data, BUFFER_SIZE); +// } +// +// End Class Specification ********************************************* + +/*--------------------------------------------------------------------*/ +/* Reference the virtual function tables and inline function + defintions in another translation unit. */ +/*--------------------------------------------------------------------*/ + +#include <list> + +#ifndef IIPCONST_H +#include <iipconst.h> +#endif +#include <prdfPlatServices.H> +#include <functional> // @jl04 a Needed for the unary function in new predicate. + +// Forward Declarations +class SCAN_COMM_REGISTER_CLASS; +class ScanCommRegisterAccess; +class BIT_STRING_CLASS; + +// @jl04 a start +// @jl04 a Added this enumeration for error log compression, elimination of secondary regs. + enum RegType + { + PRIMARY = 1, + SECONDARY = 2 + }; +// @jl04 a Stop + +/** + Capture data class + @author Doug Gilbert + @version V5R2 +*/ +class CaptureData +{ +public: + + enum Place + { + FRONT, + BACK + }; + + enum + { + INITIAL_DATA_COUNT = 80, + ENTRY_FIXED_SIZE = 8, + MAX_ENTRY_SIZE = 128 + }; + + /** + Constructor + */ + CaptureData(void); + + /* + Copy constructor - default is ok + */ +// CaptureData(const CaptureData & c); + + /* + Assignment operator - default is ok + */ +// CaptureData & operator=(const CaptureData & c); + + /** + Destructor + */ +// dg05d ~CaptureData(void); // compiler default is ok + + /** + Clear out capture data + <ul> + <br><b>Paramters:None + <br><b>Returns:Nothing + <br><b>Requirments:None. + <br><b>Promises: All capture data cleared ( copy(...) == 0 ) + </ul><br> + */ + void Clear(void); + + // dg00 start + /** + Add scr & data to capture log + <ul> + <br><b>Paramter: chipHandle target handle of chip object + <br><b>Paramter: scan comm id (unique one btye code representing scan comm address) + <br><b>Paramter: Scan comm register object + <br><b>Paramter: Optional location in capure vector [FRONT | BACK] def = BACK + <br><b>Returns: Nothing + <br><b>Requires: Nothing + <br><b>Promises: scr.Read() + <br><b>Notes: This is the required Add() method for Regatta and beyond + </ul><br> + */ + void Add( TARGETING::TargetHandle_t i_pchipHandle, int scomId, + SCAN_COMM_REGISTER_CLASS & scr, Place place = BACK, + RegType type = PRIMARY); // @jl04 c. Changed this to add the type to the end of the parms. + // dg00 end + + /* REMOVE for FSP + Add scr & data to capture log + <ul> + <br><b>Paramter: chipHandle target handle of chip object + <br><b>Paramter: Scan comm register object + <br><b>Paramter: Optional location in capure vector [FRONT | BACK] def = BACK + <br><b>Returns: Nothing + <br><b>Requires: Nothing + <br><b>Promises: scr.Read() + <br><b>Notes: This is the required Add() method for pre-Regatta + </ul><br> + + void Add(TARGETING::TargetHandle_t chipId, SCAN_COMM_REGISTER_CLASS & scr, + Place place = BACK); +*/ + + /** + Add scr & data to capture log (defunct) + <ul> + <br><b>Paramter: chipid (or chip enum) + <br><b>Paramter: Scan comm register object + <br><b>Paramter: Optional location in capure vector [FRONT | BACK] def = BACK + <br><b>Returns: Nothing + <br><b>Requires: Nothing + <br><b>Promises: scr.Read() + <br><b>Notes: This method is no longer implemented + </ul><br> + */ + void Add(ScanCommRegisterAccess & scr, Place place = BACK); + + // dg02 start + /** + Add scr & data to capture log + <ul> + <br><b>Paramter: i_pchipHandle Handle of chip object + <br><b>Paramter: scan comm id (unique one btye code representing scan comm address) + <br><b>Paramter: BIT_STRING_CLASS + <br><b>Paramter: Optional location in capure vector [FRONT | BACK] def = BACK + <br><b>Returns: Nothing + <br><b>Requires: Nothing + <br><b>Promises: + <br><b>Notes: This is available for Regatta and beyond. Not implemented on Condor + </ul><br> + */ + void Add( TARGETING::TargetHandle_t i_pchipHandle, int scomId, + BIT_STRING_CLASS & bs, Place place = BACK); + + // dg02 end + // dg06a start + /** + Add scr & data to capture log + <ul> + <br><b>Paramter: i_pTargetHandle Handle of chip object + <br><b>Paramter: scan comm id (unique code representing scan comm address) + <br><b>Paramter: Scan comm register address + <br><b>Paramter: Scan comm register bit length length + <br><b>Paramter: Optional location in capure vector [FRONT | BACK] def = BACK + <br><b>Returns: Nothing + <br><b>Requires: Nothing + <br><b>Promises: + <br><b>Notes: This is available for Regatta and beyond. Not implemented on Condor + </ul><br> + */ + void Add( TARGETING::TargetHandle_t i_pTargetHandle , int iScomId, + uint64_t iScomAddress, uint32_t iScomBitLength , + Place iplace = BACK); + // dg06a end + +// start @jl04a + /** + Drop scr & data from capture log + <ul> + <br><b>Paramter: Type of capture vector [PRIMARY | SECONDARY] def = PRIMARY. SECONDARIES dropped on connected. + <br><b>Returns: Nothing + <br><b>Requires: Nothing + <br><b>Promises: + </ul><br> + */ +void Drop(RegType type); //@jl04a +// end @jl04a + + /** + Copy caputre data to buffer + <ul> + <br><b>Paramter: ptr to buffer to place capture data + <br><b>Paramter: maxsize of buffer area + <br><b>Returns: Returns the number of bytes copied + <br><b>Requirements: None + <br><b>Promises: bytes copied <= bufferSize + <br><b>Notes: Caputure data is placed in the buffer in the order it exists + in the vector until done or buffer is full + <ul><br> + */ + unsigned int Copy(uint8_t * buffer, unsigned int bufferSize) const; + + // dg08a --> + /** + Reconstruct data from flat data + <ul> + <br><b>Paramter: i_flatdata ptr to flat data + <br><b>Returns: reference to the new capture data + <br><b>Requirements: None + <br><b>Promises: CaptureData created form flatdata + <br><b>Note: i_flatdata -> (uin32_t)size + data created by Copy() + data is network ordered bytes. + <ul><br> + */ + CaptureData & operator=(const uint8_t *i_flatdata); + // <-- dg08a + +private: + + // Notes ************************************************************* + // + // Instead of maintaining an actual data buffer, an auxilliary data + // structure is used to maintain data in a specific order. The main + // reason for this is that since data can be entered in the front or + // back of the buffer, the data must be copied to maintain the order. + // It is more efficient to copy a number of pointers than a large + // data buffer. However, there is added complexity since the data + // structure contains a pointer to dynamic data that must be + // allocated/deallocated properly. + // + // A vector of data structures is maintained that is given an initial + // size. The vector can grow dynamically, but this can be expensive + // in terms of copying and memory fragmentation. To prevent this, the + // number of calls to Add() between calls to Clear() should not exceed + // the enum INITIAL_DATA_COUNT. + // + // End Notes ********************************************************* + + class Data + { + public: + // Ctor + Data(TARGETING::TargetHandle_t i_pchipHandle= NULL, // dg01 + uint16_t a = 0, + uint16_t dbl = 0, + uint8_t * dPtr = NULL) + : + chipHandle(i_pchipHandle), + address(a), + dataByteLength(dbl), + dataPtr(dPtr) + {} + + ~Data(void) // dg05a + { // dg05a + if(dataPtr != NULL) // dg05a + { // dg05a + delete [] dataPtr; // pw01 + } // dg05a + } // dg05a + // Data + TARGETING::TargetHandle_t chipHandle; + uint16_t address; + uint16_t dataByteLength; + uint8_t * dataPtr; + + RegType registerType; // @jl04a + + Data(const Data & d); + Data & operator=(const Data & d); + }; + +// We should probably use a link list instead of a vector + typedef std::list<Data> DataContainerType; + typedef DataContainerType::iterator DataIterator; + typedef DataContainerType::const_iterator ConstDataIterator; + + DataContainerType data; + + /** + Private function to facilitate the adding of caputre data to the internal vector + */ + void AddDataElement(Data &dataElement, SCAN_COMM_REGISTER_CLASS & scr, Place place, RegType type); + //$TEMP @jl04 Changed AddDataElement to include a Register type. + + // Predicate for deciding to delete an element of data from a Capture Data list. + class prdfCompareCaptureDataType : public std::unary_function<Data &, bool> + { + public: + prdfCompareCaptureDataType(RegType i_ctor_input) : __private_storage(i_ctor_input){}; + bool operator() (Data &i) + { + return (i.registerType == __private_storage); + }; + + + private: + //Private storage for value passed in. + RegType __private_storage; + //Constructor allows a value to be passed in to compare against. + }; +}; + +#endif diff --git a/src/usr/diag/prdf/common/framework/register/iipErrorRegister.h b/src/usr/diag/prdf/common/framework/register/iipErrorRegister.h new file mode 100755 index 000000000..82508fe19 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipErrorRegister.h @@ -0,0 +1,224 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipErrorRegister.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 */ + +/** + @file iipErrorRegister.h + @brief ErrorRegister class declaration +*/ +#ifndef iipErrorRegister_h +#define iipErrorRegister_h + +// Class Description ************************************************* +// +// Name: ErrorRegister +// Base class: ErrorRegisterType +// Concrete class that can be used as a base class +// +// Description: Error register declairation +// Usage: +// +// foo(SCAN_COMM_REGISTER &scr, ResolutionMap &resMap, +// STEP_CODE_DATA_STRUCT &error_data) +// { +// ErrorRegister er(scr,resMap); +// . +// . +// SINT32 rc = er.Analyze(error_data); +// } +// +// Notes: +// +// +// End Class Description ********************************************* +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#if !defined(iipErrorRegisterType_h) +#include "iipErrorRegisterType.h" +#endif + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +class SCAN_COMM_REGISTER_CLASS; +class ResolutionMap; + +class ErrorRegister : public ErrorRegisterType +{ +public: + /** + Constructor + <ul> + <br><b>Parameter: </b> Scan comm register + <br><b>Parameter: </b> Resolution Map + <br><b>Parameter: </b> Opt: ScrId [0 to 0xfe] - used with ErrorSignature + <br><b>Notes: </b> If no ScrId is provided then the scan + Comm register address is used + </ul><br> + */ + ErrorRegister(SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, uint16_t scrId = 0x0fff); + + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: Compiler default is ok + // Objects do not not own ptr to scan comm register and table + // + // End Function Specification **************************************** + // ~ErrorRegister(); + + /** + Analyse the error register + <ul> + <br><b>Parameters: </b> ServiceData object (error.service_data) + <br><b>Returns: </b> return code + <br><b>Requirements:</b> NoErrorOnZeroRead() if don't want rc == DD02 when no bits on in scr + <br><b>Promises: </b> error.service_data points to completed serviceData + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> optional + </ul><br> + */ + virtual int32_t Analyze(STEP_CODE_DATA_STRUCT & error); + + /** + Make is so Analyze() does not consider a Scr bit string of all zeros an error + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Analyze() == SUCCESS when scr data has no bits on + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Normaly Anayze() returns DD02 if scr data is zero + </ul><br> + */ + void NoErrorOnZeroScrRead(void) { xNoErrorOnZeroScr = true; } + + +protected: + + /** + Read the scan comm register, apply any masks, and return the resulting bit string + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> a Bit String + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Bit string contains data from hardware with masked bits zeroed + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Any class that overides Read() but does not + override Analyze() should set src_rc + return code from mops scr access + </ul><br> + */ + virtual const BIT_STRING_CLASS & Read(ATTENTION_TYPE i_attn); + + /** + Filter the bit string (if a filter is provided) & convert it to a BitList + <ul> + <br><b>Parameters: </b> Bit String + <br><b>Returns: </b> Bit List + <br><b>Requirements:</b> Read() + <br><b>Promises: </b> Bit list representation of the (filtered) bit string + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> The default implementation does not have a filter + </ul><br> + */ + virtual BIT_LIST_CLASS Filter(const BIT_STRING_CLASS & bs); + + virtual bool FilterUndo(prdfBitKey & i_bit_list) { return false; } + /** + Find a resolution for the Bit List + <ul> + <br><b>Parameters: </b> reference to ServiceDataCollector to act on + <br><b>Parameter: </b> Bit List + <br><b>Requirements:</b> Filter() + <br><b>Promises: </b> The bit list may be modified if the search + algoithm modified it to find a match. (as in a fuzzy search) + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> If no match for the Bit List is found in the + Resolution Map then the ResolutionMap default is used + </ul><br> + */ + virtual int32_t Lookup(STEP_CODE_DATA_STRUCT & scd, BIT_LIST_CLASS & bl); // dg02c - pass bl by value + + /** + Reset the hardware (if needed) + <ul> + <br><b>Parameters: </b> Bit List, ServiceData (error.service_data) + <br><b>Returns: </b> return code + <br><b>Requirements:</b> LookUp() + <br><b>Promises: </b> Hardware may be modified, internal Mask may be modified + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Default implementation does nothing + </ul><br> + */ + virtual int32_t Reset(const BIT_LIST_CLASS & bit_list,STEP_CODE_DATA_STRUCT & error); + +private: // functions + + int32_t SetErrorSignature(STEP_CODE_DATA_STRUCT & error, BIT_LIST_CLASS & bl); // dg02a + /** + Copy forbidden + */ + ErrorRegister(const ErrorRegister & er); + /** + Assignment forbidden + */ + ErrorRegister & operator=(const ErrorRegister & er); + +protected: // Data + + SCAN_COMM_REGISTER_CLASS & scr; + int32_t scr_rc; + +private: // Data + + ResolutionMap & rMap; + bool xNoErrorOnZeroScr; + uint16_t xScrId; + +}; + + + +#endif /* iipErrorRegister_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- ----- ------------------------------- +// 04/05/96 DRG Initial Creation +// p4902214 v4r1m0 05/09/97 DRG Added service data parm to Reset +// v4r1 01/07/98 DRG Add NoErrorOnZeroScrRead() +// d49274.2 V4R5 09/23/98 DRG Add scrId option +// 423599 fsp 10/27/03 dgilbert make scrid a bit16 +// dg02 482244 fips225 11/05/04 dgilbert add SetErrorSignture() +// 558003 fips310 06/21/06 dgilbert add FilterUndo() +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/register/iipErrorRegisterFilter.h b/src/usr/diag/prdf/common/framework/register/iipErrorRegisterFilter.h new file mode 100755 index 000000000..71b016926 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipErrorRegisterFilter.h @@ -0,0 +1,189 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipErrorRegisterFilter.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2001,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 iipErrorRegisterFilter_h +#define iipErrorRegisterFilter_h + +/** + @file iipErrorRegisterFileter.h + @brief ErrorRegisterFilter class declaration +*/ + +// Class Description ************************************************* +// +// Name: ErrorRegisterFilter +// Base class: ErrorRegister +// +// Description: Error register with a filter +// Usage: (see iipErrorRegisterMask.h) +// +// +// End Class Description ********************************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#if !defined(iipErrorRegister_h) +#include <iipErrorRegister.h> +#endif +#include <prdfFilters.H> + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +/** + Error register class with filtering capabilities + @author Doug Gilbert + */ +class ErrorRegisterFilter : public ErrorRegister +{ +public: + + /** + Constructor + <ul> + <br><b>Parameter: </b> Scan comm register to get bitString from hardware + <br><b>Parameter: </b> Resolution map to map bit pattern to a resolution + <br><b>Parameter: </b> scan comm register id for error signature + <br><b>Returns: </b> Nothing + <br><b>Requirements:</b> None + <br><b>Promises: </b> Object created + <br><b>Exceptions: </b> None + <br><b>Notes: </b> + </ul><br> + */ + ErrorRegisterFilter(SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, uint16_t scrId = 0x0fff); + + /** + Constructor + <ul> + <br><b>Parameter: </b> Scan comm register to get bitString from hardware + <br><b>Parameter: </b> Resolution map to map bit pattern to a resolution + <br><b>Parameter: </b> Filter to apply to bit string before mapping it + <br><b>Parameter: </b> scan comm register id + <br><b>Returns: </b> Nothing + <br><b>Requirements:</b> None + <br><b>Promises: </b> Object created + <br><b>Exceptions: </b> None + <br><b>Notes: </b> + </ul><br> + */ + ErrorRegisterFilter(SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, prdfFilter * f, uint16_t scrId = 0x0fff); + + /* + 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 OK + </ul><br> + */ + //~ErrorRegisterFilter(); + + /** + * @brief Get the stored filter associated with this resolution map. + * @returns Currently assigned filter. + */ + prdfFilter * getFilter() const { return filter; }; + + /** + * @brief Store a new filter with this resolution map. + * @param i - Filter to store. + */ + void setFilter(prdfFilter * i_filter) { filter = i_filter; }; + +protected: // functions + + /** + Filter the bit string (if a filter is provided) & convert it to a BitList + <ul> + <br><b>Parameters: </b> Bit String + <br><b>Returns: </b> Bit List + <br><b>Requirements:</b> Read() + <br><b>Promises: </b> Bit list representation of the (filtered) bit string + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> filter is called only if provided + - DEFINTION in iipErrorRegisterMask.C + </ul><br> + */ + virtual prdfBitKey Filter(const BIT_STRING_CLASS & bs); + + /** + * Certain filters need to be reversed in order for Reset() to work right + * @return bit_list modified ? [true|false] + * @see prdfFilters.H + */ + virtual bool FilterUndo(prdfBitKey & i_bit_list) + { + bool modified = false; + if(filter) modified = filter->Undo(i_bit_list); + return modified; + } + +private: // functions + + /** Copy forbidden - no definition exists */ + ErrorRegisterFilter(const ErrorRegisterFilter & er); + /** Assignment forbidden - no definition exists */ + ErrorRegisterFilter & operator=(const ErrorRegisterFilter & er); + +protected: // data + + prdfFilter * filter; + +private: // Data + +}; + +inline +ErrorRegisterFilter::ErrorRegisterFilter(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + uint16_t scrId) +: ErrorRegister(r,rm,scrId), filter(NULL) +{} + +inline +ErrorRegisterFilter::ErrorRegisterFilter(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + prdfFilter * f, + uint16_t scrId) +: ErrorRegister(r,rm,scrId), filter(f) +{} + + +#endif /* iipErrorRegisterFilter_h */ + +// Change Log ************************************************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------------------------------- +// P4907878 v5r2 04/27/01 dgilbert Initial Creation +// 423599 fsp 10/28/03 dgilbert make scrId a uint16_t +// 558003 fips310 06/21/06 dgilbert add get/setFilter() and FilterUndo +// +// End Change Log ********************************************************************************* diff --git a/src/usr/diag/prdf/common/framework/register/iipErrorRegisterMask.h b/src/usr/diag/prdf/common/framework/register/iipErrorRegisterMask.h new file mode 100755 index 000000000..c5b9087b3 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipErrorRegisterMask.h @@ -0,0 +1,232 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipErrorRegisterMask.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 iipErrorRegisterMask_h +#define iipErrorRegisterMask_h + +/** + @file iipErrorRegisterMask.h + @brief ErrorRegisterMask class declaration +*/ + +// Class Description ************************************************* +// +// Name: ErrorRegisterMask +// Base class: ErrorRegister +// Concrete class that can be used as a base class +// +// Description: Maskable & Filterable Error register declairation +//-------------- +// Usage: +// foo(SCAN_COMM_REGISTER &scr, ResolutionMap &resMap, +// STEP_CODE_DATA_STRUCT &error_data) +// { +// ErrorRegisterMask erm(scr,resMap); +// uint32_t mask_data[] = {0x00000000, 0xFFFFFFFF}; +// erm.SetMaskBits(BIT_STRING_ADDRESS_CLASS(0,64,mask_data)); +// ... +// int32_t rc = er.Analyze(error_data); +// ... +// erm.SetMaskBit(15); +// } +//-------------------- +// Filter example +// +// FILTER_PRIORITY_CLASS filter(BIT_LIST_STRING_1); // bit 1 takes priority +// ErrorRegisterMask erm(scr,resMap,&filter); // if it's on +// ... +// int32_t rc = erm.Analyze(error_data); +// +// Notes: +// +// +// End Class Description ********************************************* +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#if !defined(iipErrorRegisterFilter_h) +#include <iipErrorRegisterFilter.h> +#endif + +#ifndef IIPBITS_H +#include <iipbits.h> +#endif +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +/** + Error register with bit masking capabilities + @version V4R5 +*/ +class ErrorRegisterMask : public ErrorRegisterFilter +{ +public: + + /** + Constructor + <ul> + <br><b>Parameter: </b> ScanCommRegister + <br><b>Parameter: </b> Resolution map + <br><b>Parameter: </b> Optional Filter + <br><b>Parameter: </b> Optional scrId + <br><b>Parameter: </b> Optional maskScan comm register + <br><b>Notes: </b> If no ScrId is provided then the scan + Comm register address is used + </ul><br> + */ + ErrorRegisterMask(SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, FILTER_CLASS * f = NULL, uint16_t scrId = 0x0fff, SCAN_COMM_REGISTER_CLASS & maskScr = *((SCAN_COMM_REGISTER_CLASS *) NULL)); // dg00 + + /** + Constructor + <ul> + <br><b>Parameter: </b> ScanCommRegister + <br><b>Parameter: </b> Resolution map + <br><b>Parameter: </b> scrId - for the signature + <br><b>Parameter: </b> Optional maskScan comm register + </ul><br> + */ + ErrorRegisterMask(SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, uint16_t scrId, SCAN_COMM_REGISTER_CLASS & maskScr = *((SCAN_COMM_REGISTER_CLASS *) NULL)); // dg00 + + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: Compiler default is ok + // + // End Function Specification **************************************** + // ~ErrorRegisterMask(); + + /** + Set a mask bit + <ul> + <br><b>Parameters: </b> bit position + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> bitStringMask.IsSet(bitPosition) == true. + + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> The bitstring read from hardware during Read() + will have this bitpos reset (zeroed) prior to using + it for any Analysis. + </ul><br> + */ + void SetMaskBit(uint32_t bitPosition); + + /** + Set mask bits + <ul> + <br><b>Parameters: </b> BitString + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> bitStringMask != bitString; + + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> The bitstring read from hardware during Read() + will have the bit positions reset (zeroed) as + specified in the bitStringMask (by 1's) prior + to using it for any Analysis. + </ul><br> + */ + void SetMaskBits(const BIT_STRING_CLASS & bitString); + +protected: + + /** + Read the scan comm register, apply the mask, and return the resulting bit string + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> a Bit String + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Bit string contains data from hardware with masked bits zeroed + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Any class that overides Read() but does not + override Analyze() should set src_rc + return code from mops scr access + </ul><br> + */ + virtual const BIT_STRING_CLASS & Read(); + + + /** + Reset the error register and set mask bit if sdc is at theshold + <ul> + <br><b>Parameters: </b> BitList + <br><b>Returns: </b> return code + <br><b>Requirements:</b> Filter() + <br><b>Promises: </b> if xMaskScr == NULL then + bitStringMask bit(s) set if error.service_data->IsAtThreshold() + ELSE bitStringMask remains unchanged + Hardware may be modified + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> + </ul><br> + */ + virtual int32_t Reset(const BIT_LIST_CLASS & bit_list,STEP_CODE_DATA_STRUCT & error); + +private: // functions + /** Copy forbidden - no definition (code) exists*/ + ErrorRegisterMask(const ErrorRegisterMask & er); + /** Assignment forbidden - no definition (code) exists */ + ErrorRegisterMask & operator=(const ErrorRegisterMask & er); + +protected: // Data + + BIT_STRING_BUFFER_CLASS bitString; + BIT_STRING_BUFFER_CLASS bitStringMask; + +private: // Data + + SCAN_COMM_REGISTER_CLASS & xMaskScr; // dg00 +// bool maskIt; + +}; + +inline void ErrorRegisterMask::SetMaskBit(uint32_t bitPosition) +{ bitStringMask.Set(bitPosition); } + +inline void ErrorRegisterMask::SetMaskBits(const BIT_STRING_CLASS & bitString) +{ bitStringMask.SetBits(bitString); } + +#endif /* iipErrorRegisterMask_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- ----- ------------------------------- +// 05/03/96 DRG Initial Creation +// d49127.1 v4r1m0 05/31/96 DRG Added Analyze() Reset() & maskIt +// p4902214 v4r1m0 05/09/97 DRG Added service data parm to Reset +// Removed maskIt +// D49274.2 v4r5 09/24/98 DRG Added scrId +// dg00 v5r2 04/05/00 DRG Added maskScr +// P4907878 v5r2 04/27/01 drg factor out filter into ErrorRegisterFilter +// class +// 423599 fsp 10/28/03 dgilbert make scrId a uint16_t +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/register/iipErrorRegisterSet.h b/src/usr/diag/prdf/common/framework/register/iipErrorRegisterSet.h new file mode 100755 index 000000000..0d91dd719 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipErrorRegisterSet.h @@ -0,0 +1,124 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipErrorRegisterSet.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1997,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 iipErrorRegisterSet_h +#define iipErrorRegisterSet_h + +// Class Description ************************************************* +// +// Name: ErrorRegisterSet +// Base class: ErrorRegisterMask +// +// Description: To be used when the bits on in the error register +// represent a set of errors reported and the error +// analysis is to a union of the Resolutions +// for each error bit. +// +// Usage: See iipErrorRegister.h +// +// Warning: +// If this class is used with recoverable errors then all bits on are +// masked when ANY threshold is detected, therefore the chip should +// mask the hardware accordingly. +// +// End Class Description ********************************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#if !defined(iipErrorRegisterMask_h) +#include <iipErrorRegisterMask.h> +#endif + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +class ErrorRegisterSet: public ErrorRegisterMask +{ +public: + ErrorRegisterSet(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + FILTER_CLASS * f = NULL); + // Function Specification ******************************************** + // + // Purpose: Constructor + // Parameters: None + // Returns: Nothing + // Requirements: None + // Promises: Object created + // Exceptions: None + // Concurrency: synchronous + // Notes: + // + // End Function Specification **************************************** + + //~ErrorRegisterSet(); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: + // + // End Function Specification **************************************** + + virtual int32_t Analyze(STEP_CODE_DATA_STRUCT & error); + // Function Specification ******************************************** + // + // Purpose: Analyze the error(s) reported by this error register + // Parameters: Reference to area to return Service Data + // Returns: Return code + // Requirements: None. + // Promises: At least one Resolution called (See notes) + // Service data error signature scrid and error code modified + // if register has no bits on then + // rc = PRD_SCAN_COMM_REGISTER_ZERO (iipconst.h) + // If rc != SUCCESS then no promises + // Exceptions: Simulator may throw TBD otherwise none. + // Concurrency: + // Notes: + // A Resolution called for Each bit that's on in the error + // register. + // If no resolutions exist for a bit then the + // ResolutionMap default Resolution is Called. + // + // End Function Specification **************************************** +private: // functions +private: // Data + +}; + +#endif /* iipErrorRegisterSet_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// p4901848 v4r1 02/20/97 DGILBERT Initial Creation +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/register/iipErrorRegisterType.h b/src/usr/diag/prdf/common/framework/register/iipErrorRegisterType.h new file mode 100755 index 000000000..85c5a3309 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipErrorRegisterType.h @@ -0,0 +1,180 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipErrorRegisterType.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 iipErrorRegisterType_h +#define iipErrorRegisterType_h + +// Class Description ************************************************* +// +// Name: iipErrorRegisterType ABC +// Base class: None +// +// Description: +// Usage: +// +// End Class Description ********************************************* +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#if !defined(IIPBTLST_H) +#include <prdfBitKey.H> +#endif + +#if !defined(iipResolution_h) +#include <iipResolution.h> +#endif + +#include <iipsdbug.h> +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +class BIT_STRING_CLASS; +struct STEP_CODE_DATA_STRUCT; + +class ErrorRegisterType +{ + public: +// ERROR_REGISTER_CLASS(); + // Function Specification ******************************************** + // + // Purpose: Constructor + // Parameters: None + // Returns: Nothing + // Requirements: None + // Promises: Object created + // Exceptions: None + // Concurrency: synchronous + // Notes: Compiler default = ok + // + // End Function Specification **************************************** + + virtual ~ErrorRegisterType() {} + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: + // + // End Function Specification **************************************** + + virtual int32_t Analyze(STEP_CODE_DATA_STRUCT & error) = 0; + // Function Specification ******************************************** + // + // Purpose: Analyze the error reported by this error register + // Parameters: Reference to area to return Service Data + // Returns: Return code + // Requirements: None. + // Promises: Provide service data for the error condition reported + // by the hardware error register this object represents + // Exceptions: Simulator may throw TBD otherwise None. + // Concurrency: + // Notes: + // + // End Function Specification **************************************** + +protected: + + virtual const BIT_STRING_CLASS & Read(ATTENTION_TYPE i_attn) = 0; + // Function Specification ******************************************** + // + // Purpose: Read data in from hardware for this error register + // Parameters: None + // Returns: Reference to a bit string containing the data read + // Requirements: None. + // Promises: Returns a reference to the bit string containing the + // value read . May return NULL if hardware access failed. + // Exceptions: None. (Future: May throw Ereg_Read_Failure) + // Concurrency: + // Notes: + // + // End Function Specification **************************************** + + virtual prdfBitKey Filter(const BIT_STRING_CLASS & bs) = 0; + // Function Specification ******************************************** + // + // Purpose: Filter out unwanted bits in the bit string. + // Parameters: References to the bit string read in. + // Returns: Reference to a bit list + // Requirements: None. + // Promises: Return a bit list containing the desired pattern to + // use to find an Resolution to execute. + // Exceptions: None. + // Concurrency: + // Notes: + // + // End Function Specification **************************************** + + virtual bool FilterUndo(prdfBitKey & i_bit_list) = 0; + + /** + Find a resolution for the Bit List + <ul> + <br><b>Parameters: </b> reference to ServiceDataCollector to act on + <br><b>Parameter: </b> Bit List + <br><b>Requirements:</b> Filter() + <br><b>Promises: </b> The bit list may be modified if the search + algoithm modified it to find a match. (as in a fuzzy search) + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> If no match for the Bit List is found in the + Resolution Map then the ResolutionMap default is used + </ul><br> + */ + virtual int32_t Lookup(STEP_CODE_DATA_STRUCT & sdc, prdfBitKey & bl) = 0; //dg02c + + virtual int32_t Reset(const prdfBitKey & bit_list,STEP_CODE_DATA_STRUCT & error) = 0; + // Function Specification ******************************************** + // + // Purpose: Reset the hardware & perform any other actions needed + // to prepare for the next Analysis + // Parameters: Reference to a bit list + // Returns: Return code + // Requirements: None. + // Promises: Hardware register may be modified + // May do nothing if nothing is needed. + // Exceptions: None. + // Concurrency: + // Notes: + // + // End Function Specification **************************************** + +}; + + +#endif /* iipErrorRegisterType_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- ----- ------------------------------- +// v4r1m0 04/03/96 DRG Initial Creation from iiperst.h +// Abstraction of error register class +// p4902214 v4r1m0 05/09/97 DRG Added service data parm to Reset +// dg02 482244 fips225 11/05/04 dgilbert change Lookup() to pass bl by value +// 558003 fips310 06/21/06 dgilbert add FilterUndo() +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.C b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.C new file mode 100755 index 000000000..66977cb13 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.C @@ -0,0 +1,68 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.C $ */ +/* */ +/* 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 */ + +// Module Description ************************************************** +// +// Description: This module provides the implementation for the PRD MOP +// Register Access class. +// +// End Module Description ********************************************** + +/*--------------------------------------------------------------------*/ +/* Emit the virtual function tables and inline function defintions in + this translation unit. */ +/*--------------------------------------------------------------------*/ +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define iipMopRegisterAccess_C + +#include <iipMopRegisterAccess.h> + +#undef iipMopRegisterAccess_C + +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + + diff --git a/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.h b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.h new file mode 100755 index 000000000..dd08c14b9 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.h @@ -0,0 +1,189 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.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 iipMopRegisterAccess_h +#define iipMopRegisterAccess_h + +// Class Specification ************************************************* +// +// Class name: MopRegisterAccess +// Parent class: None. +// +// Summary: This class provides access to hardware register via +// a MOP routine. A single pure virtual function Access() +// is declared for this purpose. +// +// Cardinality: 0 +// +// Performance/Implementation: +// Space Complexity: Constant +// Time Complexity: All member functions constant unless otherwise +// stated. +// +// Usage Examples: +// +// +// void foo(MopRegisterAccess & mra) +// { +// BIT_STRING_BUFFER_CLASS bitString(80); // 80 bits +// +// mra.Access(bitString, READ); +// ... +// +// } +// +// +// End Class Specification ********************************************* + +// Includes +#if !defined(IIPCONST_H) +#include <iipconst.h> +#endif +#include <prdfPlatServices.H> + +// Forward References +class BIT_STRING_CLASS; + +class MopRegisterAccess +{ +public: + + enum Operation + { + READ = 0, + WRITE = 1 + }; + + // MopRegisterAccess(void); + // Function Specification ******************************************** + // + // Purpose: Initialization + // Parameters: None. + // Returns: No value returned. + // Requirements: None. + // Promises: All data members are initialized. + // Exceptions: None. + // Concurrency: N/A + // Notes: This constructor is not declared. This compiler generated + // default definition is sufficient. + // + // End Function Specification ////////////////////////////////////// + + // MopRegisterAccess(const MopRegisterAccess & scr); + // Function Specification ******************************************** + // + // Purpose: Copy + // Parameters: scr: Reference to instance to copy + // Returns: No value returned. + // Requirements: None. + // Promises: All data members will be copied (Deep copy). + // Exceptions: None. + // Concurrency: N/A. + // Notes: This constructor is not declared. This compiler generated + // default definition is sufficient. + // + // End Function Specification **************************************** + + virtual ~MopRegisterAccess(void); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: N/A + // + // End Function Specification **************************************** + + // MopRegisterAccess & operator=(const MopRegisterAccess & scr); + // Function Specification ******************************************** + // + // Purpose: Assigment + // Parameters: d: Reference to instance to assign from + // Returns: Reference to this instance + // Requirements: None. + // Promises: All data members are assigned to + // Exceptions: None. + // Concurrency: N/A. + // Notes: This assingment operator is not declared. The compiler + // generated default definition is sufficient. + // + // End Function Specification **************************************** + + virtual uint32_t Access(BIT_STRING_CLASS & bs, + uint64_t registerId, + Operation operation) const = 0; + // Function Specification ******************************************** + // + // Purpose: This function reads or writes the hardware according + // to the specified operation. + // Parameters: bs: Bit string to retrieve(for write) or store data + // (from read) + // registerId: SCR Address or scan offset + // operation: Indicates either read or write operation + // Returns: Hardware OPs return code + // Requirements: bs.Length() == long enough + // Promises: For read operation, bs is modified to reflect hardware + // register state + // Exceptions: None. + // Concurrency: Nonreentrant. + // Note: The first bs.Length() bits from the Hardware OPs read + // are set/reset in bs (from left to right) + // For a write, the first bs.Length() bits are written + // to the hardware register with right padded 0's if + // needed + // + // End Function Specification **************************************** + //Get Ids and count + virtual const TARGETING::TargetHandle_t * GetChipIds(int & count) const = 0; + // Function Specification ******************************************** + // + // Purpose: Access Chip Ids and # of chips to access + // Parameters: count: Var to return chip count of valid IDs + // Returns: ptr to Chip ids + // Requirements: None + // Promises: None + // Exceptions: None. + // Concurrency: Reentrant. + // + // End Function Specification **************************************** + + private: + + }; + +#include <iipMopRegisterAccess.inl> + +// Change Log ********************************************************** +// +// Flag PTR/DCR# Userid Date Description +// ---- -------- -------- -------- ----------- +// n/a n/a JST 09/08/95 Created. +// d DGILBERT 05/19/95 Modified Access() parms +// +// End Change Log ****************************************************** + + +#endif diff --git a/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.inl b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.inl new file mode 100755 index 000000000..1bb95f597 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.inl @@ -0,0 +1,63 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.inl $ */ +/* */ +/* 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 */ + +// Module Description ************************************************** +// +// Description: This module provides the inline implementation for the +// PRD MOP Register Access class. +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +inline +MopRegisterAccess::~MopRegisterAccess(void) + { + } + diff --git a/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccessScanComm.h b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccessScanComm.h new file mode 100755 index 000000000..1824ac174 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccessScanComm.h @@ -0,0 +1,164 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipMopRegisterAccessScanComm.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 iipMopRegisterAccessScanComm_h +#define iipMopRegisterAccessScanComm_h + +// Class Specification ************************************************* +// +// Class name: MopRegisterAccessScanComm +// Parent class: MopRegisterAccess. +// +// Summary: This class provides access to hardware register data via +// a MOP Scan Comm routine. +// +// Cardinality: 0 +// +// Performance/Implementation: +// Space Complexity: Constant +// Time Complexity: All member functions constant unless otherwise +// stated. +// +// Usage Examples: +// +// +// +// End Class Specification ********************************************* + +// Includes + +#pragma interface + +#ifndef iipMopRegisterAccess_h +#include <iipMopRegisterAccess.h> +#endif + +// Forward References +class MopRegisterAccessScanComm : public MopRegisterAccess +{ +public: + + // Function Specification ******************************************** + // + // Purpose: CTOR + // Parameters: None + // Returns: No value returned. + // Requirements: None. + // Promises: All data members are initialized. + // Exceptions: None. + // Concurrency: N/A + // Note: Multiple chip IDs are for chips that MOPs must + // access at the same time when performing a Scan + // Comm operation (ie STINGER & ARROW chips) + // + // End Function Specification ////////////////////////////////////// + + // MopRegisterAccessScanComm(const MopRegisterAccessScanComm & scr); + // Function Specification ******************************************** + // + // Purpose: Copy + // Parameters: scr: Reference to instance to copy + // Returns: No value returned. + // Requirements: None. + // Promises: All data members will be copied (Deep copy). + // Exceptions: None. + // Concurrency: N/A. + // Notes: This constructor is not declared. This compiler generated + // default definition is sufficient. + // + // End Function Specification **************************************** + + // virtual ~MopRegisterAccessScanComm(void); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: N/A + // Notes: This destructor is not declared. This compiler generated + // default definition is sufficient. + // + // End Function Specification **************************************** + + // MopRegisterAccessScanComm & operator=(const MopRegisterAccessScanComm & scr); + // Function Specification ******************************************** + // + // Purpose: Assigment + // Parameters: d: Reference to instance to assign from + // Returns: Reference to this instance + // Requirements: None. + // Promises: All data members are assigned to + // Exceptions: None. + // Concurrency: N/A. + // Notes: This assingment operator is not declared. The compiler + // generated default definition is sufficient. + // + // End Function Specification **************************************** + + virtual uint32_t Access(BIT_STRING_CLASS & bs, + uint32_t registerId, + Operation operation) const; + // Function Specification ******************************************** + // + // Purpose: This function reads or writes the hardware according + // to the specified operation. + // Parameters: bs: Bit string to retrieve(for write) or store data + // (from read) + // registerId: ScanComm register address + // operation: Indicates either read or write operation + // Returns: Hardware OPs return code + // Requirements: bs.Length() == long enough + // Promises: For read operation, bs is modified to reflect hardware + // register state + // Exceptions: None. + // Concurrency: Nonreentrant. + // Note: The first bs.Length() bits from the Hardware OPs read + // are set/reset in bs (from left to right) + // For a write, the first bs.Length() bits are written + // to the hardware register with right padded 0's if + // needed + // + // End Function Specification **************************************** + + +private: // DATA + +}; + +//#include <iipMopRegisterAccessScanComm.inl> // dg00 + +// Change Log ********************************************************** +// +// Flag PTR/DCR# Userid Date Description +// ---- -------- -------- -------- ----------- +// n/a n/a JST 09/08/95 Created. +// v4r3 DGILBERT 05/19/96 Modified Access() +// dg00 365764 dgilbert 04/19/02 remove inlines +// +// End Change Log ****************************************************** + + +#endif diff --git a/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccessScanComm.inl b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccessScanComm.inl new file mode 100755 index 000000000..7d1c59227 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccessScanComm.inl @@ -0,0 +1,64 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipMopRegisterAccessScanComm.inl $ */ +/* */ +/* 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 */ + +// Module Description ************************************************** +// +// Description: This module provides the inline implementation for the +// PRD MOP Register Access Scan Comm class. +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +inline +MopRegisterAccessScanComm::MopRegisterAccessScanComm(void) + { + } + + diff --git a/src/usr/diag/prdf/common/framework/register/iipResetErrorRegister.h b/src/usr/diag/prdf/common/framework/register/iipResetErrorRegister.h new file mode 100755 index 000000000..90e17d47d --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipResetErrorRegister.h @@ -0,0 +1,316 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipResetErrorRegister.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 iipResetErrorRegister_h +#define iipResetErrorRegister_h + +/** + @file iipResetErrorRegister.h + @brief ResetErrorRegister declaration +*/ + +// Class Description ************************************************* +// +// Name: ResetErrorRegister +// Base class: ErrorRegisterMask +// +// Description: Reset the error register after analysis by turning off +// the bits in the SCR that were used for the analysis +// Usage: Initialization +// ScanCommRegisterChip scr1(...), scr2(...); +// ResolutionMap rm(...); +// *** Reset SCR same as One used to read error reg *** +// ErrorRegister * er = new ResetErrorRegister(scr1,rm); +// +// *** Reset SCR different from one used to read error reg *** +// ErrorRegister * er1 = new ResetErrorRegister(scr1,rm,scr2); +// +// *** Using a Filter **** +// Filter * f = new PriorityFileter(...); +// ErrorRegister * er = new ResetErrorRegister(scr1,rm,f); +// ErrorRegister *er1 = new ResetErrorRegister(scr1,rm,scr2,f); +// +// Regular usage same as ErrorRegister +// +// RESET: +// if scr2 is not given then turn off bits in scr1 specified by bit_list +// and scr1.Write(); +// if scr2 then copy bitlist from scr1 to scr2 then set off bits +// in scr2 specified by bit_list then scr2.Write(); +// +// End Class Description ********************************************* +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#ifndef iipErrorRegisterMask_h +#include <iipErrorRegisterMask.h> +#endif + +#include <vector> +#include <prdfResetOperators.H> + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +class ResetErrorRegister : public ErrorRegisterMask +{ +public: + /** + Constructor + <ul> + <br><b>Parameter: </b> Scan comm register associated with the error register + <br><b>Parameter: </b> ResolutionMap + <br><b>Parameter: </b> Optional filter + <br><b>Parameter: </b> Optional scrId - to use in the error signature + <br><b>Notes: </b> If no scrId is provided than the address of the scan comm register is used + </ul><br> + */ + ResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, FILTER_CLASS * f = NULL, uint16_t scrID = 0x0fff, SCAN_COMM_REGISTER_CLASS & maskScr = *((SCAN_COMM_REGISTER_CLASS *) NULL)); + + /** + Constructor + <ul> + <br><b>Parameter: </b> Scan comm register associated with the error register + <br><b>Parameter: </b> ResolutionMap + <br><b>Parameter: </b> scrId - used in the error signature + <br><b>Notes: </b> If no scrId is provided than the address of the scan comm register is used + </ul><br> + */ + ResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, uint16_t scrID, SCAN_COMM_REGISTER_CLASS & maskScr = *((SCAN_COMM_REGISTER_CLASS *) NULL)); + + /** + Constructor - Where scan comm register to read is different from the scan comm register to write to reset + <ul> + <br><b>Parameter: </b> Scan comm register associated with the error register + <br><b>Parameter: </b> ResolutionMap + <br><b>Parameter: </b> Scan comm register to write to reset the error + <br><b>Parameter: </b> Optional filter + <br><b>Parameter: </b> Optional scrId - to use in the error signature + <br><b>Notes: </b> If no scrId is provided than the address of the scan comm register is used + </ul><br> + */ + ResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, SCAN_COMM_REGISTER_CLASS & reset, FILTER_CLASS * f = NULL, uint16_t scrID = 0x0fff); + + /** + Constructor - Where scan comm register to read is different from the scan comm register to write to reset + <ul> + <br><b>Parameter: </b> Scan comm register associated with the error register + <br><b>Parameter: </b> ResolutionMap + <br><b>Parameter: </b> Scan comm register to write to reset the error + <br><b>Parameter: </b> scrId - to use in the error signature + <br><b>Notes: </b> If no scrId is provided than the address of the scan comm register is used + </ul><br> + */ + ResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, SCAN_COMM_REGISTER_CLASS & reset, uint16_t scrID); + + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: Compiler default is sufficient + // + // End Function Specification **************************************** + //~ResetErrorRegister(); + +protected: // functions + + /** + Reset the error register and set mask bit if sdc is at theshold + <ul> + <br><b>Parameters: </b> BitList + <br><b>Returns: </b> return code + <br><b>Requirements:</b> Filter() + <br><b>Promises: </b> bitStringMask bit(s) set if error.service_data->IsAtThreshold() + Hardware modified + <br><b>Exceptions: </b> None + <br><b>Notes: </b> Zeros written to hardware + </ul><br> + */ + virtual int32_t Reset(const BIT_LIST_CLASS & bit_list, STEP_CODE_DATA_STRUCT & error); + +private: // functions + + /** Copy prohibited */ + ResetErrorRegister(const ResetErrorRegister & er); + /** Assignment prohibited */ + ResetErrorRegister & operator=(const ResetErrorRegister & er); + +private: // Data + + SCAN_COMM_REGISTER_CLASS * resetScr; + +}; + + +inline +ResetErrorRegister::ResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + FILTER_CLASS * f, + uint16_t scrId, + SCAN_COMM_REGISTER_CLASS & maskScr) +: ErrorRegisterMask(r,rm,f,scrId,maskScr), resetScr(&r) +{} + +inline +ResetErrorRegister::ResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + SCAN_COMM_REGISTER_CLASS & reset, + FILTER_CLASS * f, + uint16_t scrId) +: ErrorRegisterMask(r,rm,f,scrId), resetScr(&reset) +{} + +inline +ResetErrorRegister::ResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + uint16_t scrId, + SCAN_COMM_REGISTER_CLASS & maskScr) +: ErrorRegisterMask(r,rm,scrId,maskScr), resetScr(&r) +{} + +inline +ResetErrorRegister::ResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + SCAN_COMM_REGISTER_CLASS & reset, + uint16_t scrId) +: ErrorRegisterMask(r,rm,scrId), resetScr(&reset) +{} + + +/** + * @class ResetAndMaskErrorRegister + * ErrorRegister to reset and mask errors. + * + * Similar to ResetErrorRegister, but adds mask capability and multiple + * reset/mask registers. + * + * Will do masking if isAtThreshold(). + * Always does resets. (TODO: Should this be done only on recov?) + */ +class ResetAndMaskErrorRegister : public ErrorRegisterMask +{ + public: + /** + * @struct ResetRegisterStruct + * Stores information required to do reset/mask. + */ + struct ResetRegisterStruct + { + RegisterResetOperator * op; + SCAN_COMM_REGISTER_CLASS * read; + SCAN_COMM_REGISTER_CLASS * write; + + bool operator<(const ResetRegisterStruct & rhs) const + { + if (this->op != rhs.op) + return (this->op < rhs.op); + else if (this->read != rhs.read) + return (this->read < rhs.read); + else + return (this->write < rhs.write); + }; + + bool operator==(const ResetRegisterStruct & rhs) const + { + return (this->op == rhs.op) && + (this->read == rhs.read) && + (this->write == rhs.write); + }; + }; + + typedef std::vector<ResetRegisterStruct> ResetRegisterVector; + + public: + /** + * Constructor + * @param r : Register for error isolation. + * @param rm : Resolution map for error. + * @param f : Register filter. + * @param scrId : ScanComm register ID. + */ + ResetAndMaskErrorRegister(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + FILTER_CLASS * f = NULL, + uint16_t scrId = 0x0fff) + : ErrorRegisterMask(r, rm, f, scrId), cv_resets(), cv_masks() {}; + + /** + * Constructor + * @param r : Register for error isolation. + * @param rm : Resolution map for error. + * @param scrId : ScanComm register ID. + */ + ResetAndMaskErrorRegister(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + uint16_t scrId = 0x0fff) + : ErrorRegisterMask(r, rm, scrId), cv_resets(), cv_masks() {}; + + /** + * Add additional reset register to list. + */ + void addReset(ResetRegisterStruct i_reset) + { cv_resets.push_back(i_reset); }; + + /** + * Add additional mask register to list. + */ + void addMask(ResetRegisterStruct i_mask) + { cv_masks.push_back(i_mask); }; + + protected: + /** + * Reset/Mask error after error isolation. + * + * @param bl : bit list of errors detected. + * @param sdc : current STEP_CODE. + */ + virtual int32_t Reset(const BIT_LIST_CLASS & bl, + STEP_CODE_DATA_STRUCT & sdc); + + private: + // prohibit copy, assignment. + ResetAndMaskErrorRegister(const ResetAndMaskErrorRegister &); + ResetAndMaskErrorRegister& operator=(const ResetAndMaskErrorRegister&); + + private: + + /** + * List of resets. + */ + ResetRegisterVector cv_resets; + /** + * List of masks. + */ + ResetRegisterVector cv_masks; +}; + + + +#endif /* iipResetErrorRegister_h */ diff --git a/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.C b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.C new file mode 100755 index 000000000..675bff0a2 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.C @@ -0,0 +1,215 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.C $ */ +/* */ +/* 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 */ + +// Module Description ************************************************** +// +// Description: This module provides the implementation for the PRD Scan +// Comm Register Access class. +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define iipScanCommRegisterAccess_C + +#include <CcSynch.h> +#include <iipconst.h> +#include <iipbits.h> +#include <iipMopRegisterAccess.h> +#include <iipScanCommRegisterAccess.h> +#include <prdfMain.H> +#undef iipScanCommRegisterAccess_C + +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- +// +#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) +#if (GCC_VERSION >= 3004) +template<> +#endif +ScanCommRegisterAccess::SynchType::StepType + ScanCommRegisterAccess::SynchType::step = + ScanCommRegisterAccess::SynchType::STATIC_INITIAL_VALUE; + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +uint32_t ScanCommRegisterAccess::UnSync(void) +{ + uint32_t l_rc = SUCCESS; + synch.Advance(); // make everything out of synch + return(l_rc); +} + +uint32_t ScanCommRegisterAccess::Read(void) +{ + uint32_t rc = SUCCESS; + + if(!synch.IsCurrent()) + { +// BIT_STRING_BUFFER_CLASS bs(GetBitLength(), GetBufferByteSize()); + BIT_STRING_CLASS & bs = AccessBitString(); + + rc = Access(bs,GetAddress(), MopRegisterAccess::READ); + // dg01 start + if (rc != SUCCESS) + { + synch.Advance(); // make everything out of synch if failed + } + // dg01 end + +// if(rc == SUCCESS) +// { +// SetBitString(&bs); +// } + } + + return(rc); +} + +// ---------------------------------------------------------------------------- +// dg00 start +uint32_t ScanCommRegisterAccess::ForceRead(void) +{ + uint32_t rc = SUCCESS; + + BIT_STRING_CLASS & bs = AccessBitString(); + rc = Access(bs,GetAddress(), MopRegisterAccess::READ); + synch.IsCurrent(); + + return rc; +} +// dg00 end +//------------------------------------------------------------------------------- + +uint32_t ScanCommRegisterAccess::Write(void) +{ + uint32_t rc = (uint32_t) FAIL; + +// const BIT_STRING_CLASS * bit_string_ptr = GetBitString(); + + BIT_STRING_CLASS & bs = AccessBitString(); +// if(bit_string_ptr != NULL) +// { +// BIT_STRING_BUFFER_CLASS bs(GetBitLength(), GetBufferByteSize()); + +// bs.SetBits(*bit_string_ptr); + + rc = Access(bs, GetAddress(),MopRegisterAccess::WRITE); +// } + + return(rc); +} + +// unsigned int ScanCommRegisterAccess::GetBufferByteSize(void) const +// { +// return(BUFFER_BYTE_SIZE); +// } + +uint32_t ScanCommRegisterAccess::Access(BIT_STRING_CLASS & bs, uint64_t registerId, + MopRegisterAccess::Operation op) const +{ + using namespace PRDF; + + uint32_t rc = SCR_ACCESS_FAILED; + if(hops != NULL) + { + rc = hops->Access(bs, registerId, op); + } + return(rc); +} + +// #ifdef _USE_IOSTREAMS_ + +// ostream & operator<<(ostream & out, const ScanCommRegisterAccess & scr) +// { +// out << "Address: " << scr.GetAddress() << " Chip: "; // << hops; + + +// uint32_t count; +// const uint32_t * values = scr.GetChipSelectValues(count); + +// if(count) +// { +// for(uint32_t i = 0;i < count;i++) +// { +// out << values[i] << " "; +// } +// } +// else +// { +// out << "None "; +// } + +// const BIT_STRING_CLASS * bit_string_ptr = scr.GetBitString(); + +// if(bit_string_ptr == NULL) +// { +// out << " No Data"; +// } +// else +// { +// out << " Data: " << (*bit_string_ptr); +// } + +// return(out); +// } + +// #endif + +// Change Log ********************************************************** +// +// Flag PTR/DCR# Userid Date Description +// ---- -------- -------- -------- ----------- +// n/a n/a JST ??/??/95 Created. +// D24747.4 JFP 02/23/95 Added #include <CuLib.h> +// DGILBERT 05/23/97 Access()/Read()/Write() change +// dg01 aix343882 dgilbert 07/16/01 Make out of synch if Read fails +// +// End Change Log ****************************************************** + + + + + + + diff --git a/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.h b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.h new file mode 100755 index 000000000..965d34fe6 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.h @@ -0,0 +1,340 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1997,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 iipScanCommRegisterAccess_h +#define iipScanCommRegisterAccess_h + +// Class Specification ************************************************* +// +// Class name: ScanCommRegisterAccess +// Parent class: SCAN_COMM_REGISTER_CLASS +// +// Summary: This class provides access to the Scan Comm Register +// physical hardware. The member functions Read() and Write() +// both call the common function Access(). Access() is +// implemented to use a MopRegisterAccessScanComm instance to +// access the hardware. +// +// This class contains an instance of the CcSynch class. This +// data member is used to ensure that the Read() function will +// only call the Access() function once for any given synch +// value. An external thread must ensure that the synch value +// is advanced at appropriate times. AN eclosed class id is +// used to ensure that the class template CcSynch +// specialization is unique. See the specification of the +// CcSynch class for more details +// +// Cardinality: 0 +// +// Performance/Implementation: +// Space Complexity: Constant +// Time Complexity: All member functions constant unless otherwise +// stated. +// +// Usage Examples: +// +// void foo(ScanCommRegisterAccess & scr) +// { +// scr.Read(); +// scr.Write(); +// } +// +// +// End Class Specification ********************************************* + + +// Includes +#ifndef IIPSCR_H +#include <iipscr.h> +#endif + +#ifndef CcSynch_h +#include <CcSynch.h> +#endif + +#if !defined(IIPCONST_H) +#include <iipconst.h> +#endif + +#ifndef iipMopRegisterAccess_h +#include <iipMopRegisterAccess.h> +#endif + +// // Forward References +// #ifdef _USE_IOSTREAMS_ +// class ostream; +// #endif + +class ScanCommRegisterAccess : public SCAN_COMM_REGISTER_CLASS +{ +public: + + struct id {}; + typedef CcSynch<uint16_t, id> SynchType; + + /** + Constructor + <ul> + <br><b>Parameter: </b> ar: Scan Comm Register address. + <br><b>Parameter: </b> mopsAccess object + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Heap memory may be allocated + <br><b>Exceptions: </b> None. + </ul><br> + */ + ScanCommRegisterAccess(uint64_t ra, MopRegisterAccess &hopsAccessor); + + // Function Specification ******************************************** + // + // Purpose: Copy + // Parameters: scr: Reference to instance to copy + // Returns: No value returned. + // Requirements: None. + // Promises: All data members will be copied (Deep copy). + // Exceptions: None. + // Concurrency: N/A. + // Notes: This constructor is not declared. This compiler generated + // default definition is sufficient. + // + // End Function Specification **************************************** + // ScanCommRegisterAccess(const ScanCommRegisterAccess & scr); + + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: N/A + // Notes: This destructor is not declared. This compiler generated + // default definition is sufficient. + // + // End Function Specification **************************************** + // virtual ~ScanCommRegisterAccess(void); + + // Function Specification ******************************************** + // + // Purpose: Assigment + // Parameters: d: Reference to instance to assign from + // Returns: Reference to this instance + // Requirements: None. + // Promises: All data members are assigned to + // Exceptions: None. + // Concurrency: N/A. + // Notes: This assingment operator is not declared. The compiler + // generated default definition is sufficient. + // + // End Function Specification **************************************** + // ScanCommRegisterAccess & operator=(const ScanCommRegisterAccess & scr); + + // virtual const uint32_t * GetChipSelectValues( retired + // unsigned int & chipSelectCount) const = 0; retired + + // Function Specification ******************************************** + // + // Purpose: This function returns the size (in bytes) of the + // buffer needed for accesses. + // Parameters: None. + // Returns: Buffer size. + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant. + // + // End Function Specification **************************************** + // virtual unsigned int GetBufferByteSize(void) const; + + // dg00 start + /** + Read hardware register (pure virtual) + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> [SUCCESS | MOPs return code] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Internal bit string represents the value of the + hardware register (if rc == SUCCESS) + <br><b>Sideaffects: </b> Value guarrenteed to be read from hardware. + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual uint32_t ForceRead(void); + // dg00 end + + /** + Read hardware register + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> [SUCCESS | MOPs return code] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Internal bit string represents the value of the + hardware register (if rc == SUCCESS) + <br><b>Sideaffects: </b> The bit string value may or may not be retrieved + from hardware; a buffered copy may be used. + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual uint32_t Read(void); + + /** + Unsynchronize the register access to recollect reg contents. + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> [SUCCESS] + <br><b>Requirements:</b> None. + </ul><br> + */ + virtual uint32_t UnSync(void); + + /** + Write hardware register + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> [SUCCESS | MOPs return code] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Internal bit string value written to hardware + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> If internal bitstring was never read/set/modified then + zeros are written to corresponding hardware register. + </ul><br> + */ + virtual uint32_t Write(void); + + /** + Access a copy of the short id for signatures. + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> ID. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual uint16_t GetId(void) const { return cv_shortId; }; + + /** + Set the short id for signatures. + <ul> + <br><b>Parameters: </b> ID. + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> For virtual registers, this is not required to have + any effect. + </ul><br> + */ + virtual void SetId(uint16_t i_id) { cv_shortId = i_id; }; + + + /** + Access the chipid(s) of the chip + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> ptr to const array of chipIds + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None + <br><b>Exceptions: </b> None. + </ul><br> + */ + const TARGETING::TargetHandle_t * GetChipIds(int & chipCount) const + { return hops->GetChipIds(chipCount); } + + const MopRegisterAccess & GetHops(void)const { return *hops; } + +protected: + ScanCommRegisterAccess() : SCAN_COMM_REGISTER_CLASS(0xffffffff), hops(NULL) {} +private: // Functions + + /** + This function reads or writes the hardware according to the specified operation. + <ul> + <br><b>Parameter: </b> bufferPtr: Pointer to buffer for input + <br><b>Parameter: </b> (write operation) or output (read operation) + <br><b>Paramter: </b> op: Indicates either read or write operation + <br><b>Returns: </b> None. + <br><b>Requirements:</b> Buffer must be valid. + <br><b>Promises: </b> For read operation, buffer is modified. + <br><b>Exceptions: </b> None. + </ul><br> + */ + uint32_t Access(BIT_STRING_CLASS & bs, uint64_t registerId, + MopRegisterAccess::Operation op) const; + +// #ifdef _USE_IOSTREAMS_ + +// friend ostream & operator<<(ostream & out, +// const ScanCommRegisterAccess & scr); + +// #endif + +private: // Data + +// enum +// { +// BUFFER_BYTE_SIZE = 12 +// }; + SynchType synch; + + MopRegisterAccess * hops; + + uint16_t cv_shortId; +}; + +// #ifdef _USE_IOSTREAMS_ + +// // Function Specification ******************************************** +// // +// // Purpose: This function outputs the Scan Comm Register data +// // members to the specified output stream. +// // Parameters: out: Output Stream +// // scr: Reference to a Scan Comm Register instance +// // Returns: Parameter output stream +// // Requirements: None. +// // Promises: Output stream will be written to. +// // Exceptions: None. +// // Concurrency: Reentrant. +// // +// // End Function Specification **************************************** +// ostream & operator<<(ostream & out, +// const ScanCommRegisterAccess & scr); + +// #endif + + +#include <iipScanCommRegisterAccess.inl> + +// Change Log ********************************************************** +// +// Flag PTR/DCR# Userid Date Description +// ---- -------- -------- -------- ----------- +// n/a n/a JST 05/05/95 Created. +// D49127.7 DGILBERT 09/19/96 Ctor changed +// DGILBERT 05/23/97 Access change +// dg00 D49420.1 DGILBERT 08/21/00 Add ForceRead() +// f510901 iawillia 06/29/05 Add GetId/SetId +// +// End Change Log ****************************************************** + + +#endif diff --git a/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.inl b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.inl new file mode 100755 index 000000000..f78d46708 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.inl @@ -0,0 +1,68 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.inl $ */ +/* */ +/* 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 */ + +// Module Description ************************************************** +// +// Description: This module provides the inline implementation for the +// PRD Scan Comm Register Access class. +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +inline +ScanCommRegisterAccess::ScanCommRegisterAccess( + uint64_t ra, + MopRegisterAccess & hopsAccessor) +: +SCAN_COMM_REGISTER_CLASS(ra), +synch(), +hops(&hopsAccessor) +{ +} diff --git a/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterChip.C b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterChip.C new file mode 100755 index 000000000..72300c691 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterChip.C @@ -0,0 +1,117 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipScanCommRegisterChip.C $ */ +/* */ +/* 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 */ + +// Module Description ************************************************** +// +// Description: This module provides the implementation for the PRD Scan +// Comm Register Chip class. +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- + +#define iipScanCommRegisterChip_C + +#include <iipchip.h> +// #include <iipMopRegisterAccessScanCommSingle.h> +#include <iipScanCommRegisterChip.h> + +#undef iipScanCommRegisterChip_C + +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +ScanCommRegisterChip::ScanCommRegisterChip(uint64_t ra, + unsigned int bl, + MopRegisterAccess & hopsAccess) + : + ScanCommRegisterAccess(ra,hopsAccess), + xBitString(bl) +{ + xBitString.Pattern(0); // Clear +} + +// -------------------------------------------------------------------- + + +// --------------------------------------------------------------------- + +void ScanCommRegisterChip::SetBitString(const BIT_STRING_CLASS *bs) +{ + xBitString.SetBits(*bs); +} + +// --------------------------------------------------------------------- + +// const uint32_t * ScanCommRegisterChip::GetChipSelectValues +// (unsigned int & chipSelectCount) const +// { +// const uint32_t * chipSelectValues = NULL; + +// if(chipPtr) +// { +// chipSelectCount = chipPtr->GetChipSelectCount(); +// chipSelectValues = chipPtr->GetChipSelectValues(); +// } +// else +// { +// chipSelectCount = 0; +// } + +// return(chipSelectValues); +// } + +// Change Log ********************************************************** +// +// Flag PTR/DCR# Userid Date Description +// ---- -------- -------- -------- ----------- +// n/a n/a JST 04/18/95 Created. +// D49127.7 DGILBERT 09/20/96 Added xBitString, Get/SetBitString() +// AccessBitString() +// DGILBERT 05/27/97 V4R3 changes +// +// End Change Log ****************************************************** + diff --git a/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterChip.h b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterChip.h new file mode 100755 index 000000000..035cb42d0 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterChip.h @@ -0,0 +1,226 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipScanCommRegisterChip.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 iipScanCommRegisterChip_h +#define iipScanCommRegisterChip_h + +// Class Specification ************************************************* +// +// Class name: ScanCommRegisterChip +// Parent class: ScanCommRegisterAccess +// +// Summary: This class provides access to a Scan Comm Register +// associated with a specific chip. +// +// A pointer to a CHIP_CLASS is maintained. The member +// function GetChipSelectValues() is implemented to use the +// CHIP_CLASS instance to return the values. +// +// Cardinality: N +// +// Performance/Implementation: +// Space Complexity: Constant +// Time Complexity: All member functions constant unless otherwise +// stated. +// +// Usage Examples: +// +// void foo(CHIP_CLASS * chipPtr, unsigned int registerAddress, +// unsigned int bitLength) +// { +// ScanCommRegisterChip scr(chipPtr, registerAddress, bitLength); +// scr.Read(); +// scr.Write(); +// } +// +// End Class Specification ********************************************* + +// Includes +#if !defined(iipScanCommRegisterAccess_h) +#include <iipScanCommRegisterAccess.h> +#endif + +#if !defined(IIPBITS_H) +#include <iipbits.h> +#endif + + +// Forward References +class CHIP_CLASS; +class MopsRegisterAccess; + +class ScanCommRegisterChip : public ScanCommRegisterAccess +{ +public: + + ScanCommRegisterChip(uint64_t ra, + unsigned int bl, + MopRegisterAccess &hopsAccess); + ScanCommRegisterChip() : ScanCommRegisterAccess(), xBitString((uint32_t)0) {} + // Function Specification ******************************************** + // + // Purpose: Initialization (preferred Ctor) + // Parameters: chid: Chip Id of chip on which the hardware register resides + // ra: Scan com register address or Register Id + // bl: Number of bits in register + // hopsAccess: object to access Hardware Ops + // Returns: No value returned. + // Requirements: None. + // Promises: All data members are initialized + // Exceptions: None. + // Concurrency: N/A + // + // End Function Specification ////////////////////////////////////// + + + //ScanCommRegisterChip(const ScanCommRegisterChip & scr); + // Function Specification ******************************************** + // + // Purpose: Copy + // Parameters: scr: Reference to instance to copy + // Returns: No value returned. + // Requirements: None. + // Promises: All data members will be copied (Deep copy). + // Exceptions: None. + // Concurrency: N/A. + // Notes: This constructor is not declared. This compiler generated + // default definition is sufficient. + // + // End Function Specification **************************************** + + //virtual ~ScanCommRegisterChip(void); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: N/A + // Notes: This destructor is not declared. This compiler generated + // default definition is sufficient. + // + // End Function Specification **************************************** + + // ScanCommRegisterChip & operator=(const ScanCommRegisterChip & scr); + // Function Specification ******************************************** + // + // Purpose: Assigment + // Parameters: d: Reference to instance to assign from + // Returns: Reference to this instance + // Requirements: None. + // Promises: All data members are assigned to + // Exceptions: None. + // Concurrency: N/A. + // Notes: This assingment operator is not declared. The compiler + // generated default definition is sufficient. + // + // End Function Specification **************************************** + +// virtual const uint32_t * GetChipSelectValues(unsigned int & chipSelectCount) const; + // Function Specification ******************************************** + // + // Purpose: This function returns the chip select values. + // Parameters: chipSelectCount: Number of chip select values in + // returned array + // Returns: Pointer to an array of chip select values + // Requirements: None. + // Promises: Parameter chipSelectCount is modified. + // Exceptions: None. + // Concurrency: Reentrant. + // Notes: If the chipPtr is NULL, then the count will be zero and + // NULL is returned. + // + // End Function Specification **************************************** + + virtual const BIT_STRING_CLASS * GetBitString(ATTENTION_TYPE i_type = PRDF::INVALID_ATTENTION_TYPE) const + { return &xBitString; } + // Function Specification ******************************************** + // + // Purpose: Access the bit string + // Parameters: None + // Returns: the bit string + // Requirements: none + // Promises: a bit string + // Exceptions: None. + // Notes: + // + // End Function Specification **************************************** + + virtual void SetBitString(const BIT_STRING_CLASS * bs); + // Function Specification ******************************************** + // + // Purpose: Modify the internal bit string + // Parameters: a Bit string + // Returns: Nothing + // Requirements: none + // Promises: Internal bit string == *bs for first len bits where + // len is the smaller of the two lengths + // Exceptions: None. + // Notes: + // + // End Function Specification **************************************** + +protected: // Functions + + virtual BIT_STRING_CLASS & AccessBitString(void) { return(xBitString); } + // Function Specification ******************************************** + // + // Purpose: Get non-cost referece to bit string + // Parameters: None. + // Returns: BIT_STRING_CLASS & + // Requirements: none. + // Promises: Direct access to the Bit string + // Exceptions: None + // Notes: + // + // End Function Specification **************************************** + + +private: // functions + + friend class CaptureData; + +private: // Data + +// CHIP_CLASS * chipPtr; + BIT_STRING_BUFFER_CLASS xBitString; +// MopRegisterAccessScanCommSingle xHopsAccess; + +}; + +// Change Log ********************************************************** +// +// Flag PTR/DCR# Userid Date Description +// ---- -------- -------- -------- ----------- +// n/a n/a JST 04/18/95 Created. +// D49127.7 DGILBERT 09/20/96 Added xBitString, Get/SetBitString() +// AccessBitString() +// DGILBERT 05/27/97 V4R3 changes +// dgilbert 10/02/02 fips changes +// +// End Change Log ****************************************************** + + +#endif diff --git a/src/usr/diag/prdf/common/framework/register/iipXorResetErrorRegister.h b/src/usr/diag/prdf/common/framework/register/iipXorResetErrorRegister.h new file mode 100755 index 000000000..ce41875aa --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipXorResetErrorRegister.h @@ -0,0 +1,143 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipXorResetErrorRegister.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1997,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 iipXorResetErrorRegister_h +#define iipXorResetErrorRegister_h + +/** + @file iipXorResetErrorRegister.h + @brief XorResetErrorRegister declaration +*/ + +// Class Description ************************************************* +// +// Name: XorResetErrorRegister +// Base class: ErrorRegisterMask +// +// Description: Reset error register after analyze. Hardware register +// is reset by XORing value written. +// +// Usage: See iipResetErrorRegister.h +// +// Implementation in iipResetErrorRegister.C +// +// End Class Description ********************************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#ifndef iipErrorRegisterMask_h +#include <iipErrorRegisterMask.h> +#endif + + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +class XorResetErrorRegister : public ErrorRegisterMask +{ +public: + XorResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + FILTER_CLASS * f = NULL); + + // Function Specification ******************************************** + // + // Purpose: Constructor + // Parameters: r: scan comm register associated with error register + // rm: Map of bitList to Resolutions + // reset: scan comm register to write reset to + // f: ptr to a bitList filter object + // Returns: Nothing + // Requirements: None + // Promises: Object created + // Exceptions: None + // Concurrency: synchronous + // Notes: + // + // End Function Specification **************************************** + + //~XorResetErrorRegister(); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: Compiler default is sufficient + // + // End Function Specification **************************************** + +protected: // functions + + virtual int32_t Reset(const BIT_LIST_CLASS & bit_list, STEP_CODE_DATA_STRUCT & error); + // Function Specification ******************************************** + // + // Purpose: Reset the hardware & perform any other actions needed + // to prepare for the next Analysis + // Parameters: Reference to a bit list + // Returns: Return code + // Requirements: None. + // Promises: Hardware Registers modified + // Bits in bit_list are turned off in SCR then SCR::Write() + // Mask bits set if theshold was reached (see parent class) + // Exceptions: None. + // Concurrency: + // Notes: bit_list.GetListLength() may be zero + // + // End Function Specification **************************************** + +private: // functions + + XorResetErrorRegister(const XorResetErrorRegister & er); // Copy not allowed + // Assignment not allowed + XorResetErrorRegister & operator=(const XorResetErrorRegister & er); + +private: // Data + +}; + + +inline +XorResetErrorRegister::XorResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + FILTER_CLASS * f) +: ErrorRegisterMask(r,rm,f) +{} + + +#endif /* iipXorResetErrorRegister_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- --------- ---- -------- ----- ------------------------------- +// D49127.12 v4r1 02/13/97 DRG Initial Creation +// p4902214 v4r1 05/09/97 DRG Added service data parm to Reset +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/register/iipscr.C b/src/usr/diag/prdf/common/framework/register/iipscr.C new file mode 100755 index 000000000..0462f2a51 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipscr.C @@ -0,0 +1,286 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipscr.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1997,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 */ + +#define IIPSCR_C + +/* Module Description *************************************************/ +/* */ +/* Description: This module contains the implementation for the */ +/* Processor Runtime Diagnostics Scan Communication */ +/* Register class. */ +/* */ +/* Notes: Unless stated otherwise, assume that each function */ +/* specification has no side-effects, no dependencies, and */ +/* constant time complexity. */ +/* */ +/* End Module Description *********************************************/ + +/*--------------------------------------------------------------------*/ +/* Includes */ +/*--------------------------------------------------------------------*/ + +#include <iipbits.h> +#include <iipscr.h> +#include <iipconst.h> + +/*--------------------------------------------------------------------*/ +/* User Types */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Constants */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Macros */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Internal Function Prototypes */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Global Variables */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Static Variables */ +/*--------------------------------------------------------------------*/ + +// Function Specification ////////////////////////////////////////// +// +// Title: ~SCAN_COMM_REGISTER_CLASS (Virtual destructor) +// +// Purpose: This destructor deallocates the Bit String. +// +// Side-effects: Memory is deallocated. +// +// Dependencies: None. +// +// End Function Specification ////////////////////////////////////// + +SCAN_COMM_REGISTER_CLASS::~SCAN_COMM_REGISTER_CLASS +( + void + /*!i No parameters */ + ) +/*!o No value returned */ +{ +} + +// Function Specification /////////////////////////////////////////// +// +// Title: Read +// +// Purpose: This function reads the actual hardware register and +// sets the Bit String data member values. The specified +// Bit String is then used to mask the Bit String data +// member. If an error occur, then the error is reported +// and the Bit String values are undefined. +// +// Side-effects: Hardware register is read. +// Bit String data member is modified. +// Memory is reallocated. +// +// End Function Specification ////////////////////////////////////// + +uint32_t SCAN_COMM_REGISTER_CLASS::Read +( + BIT_STRING_CLASS & mask + /*!i Reference to Bit String mask */ + ) +/*!o Error return code */ +{ + uint32_t rc = Read(); + + if(rc == SUCCESS) + { + BIT_STRING_CLASS & bitString = AccessBitString(); + bitString.Mask(mask); + } + + return(rc); +} + + +uint32_t SCAN_COMM_REGISTER_CLASS::UnSync(void){return(SUCCESS);} + +// Function Specification ////////////////////////////////////////// +// +// Title: Set Bit +// +// Purpose: This function sets(1) the specified bit position in +// the Bit String. If the Bit String is NULL, then a +// new Bit String is allocated and cleared to all zero +// before setting the bit. +// +// Side-effects: Bit String is modified. +// Memory may be allocated. +// +// Dependencies: bit_position must be in the string +// +// End Function Specification ////////////////////////////////////// + +void SCAN_COMM_REGISTER_CLASS::SetBit +( + uint32_t bit_position + /*!i Bit position in string */ + ) +/*!o No value returned */ +{ + + BIT_STRING_CLASS & bitString = AccessBitString(); + bitString.Set(bit_position); +} + +// Function Specification ////////////////////////////////////////// +// +// Title: Clear Bit +// +// Purpose: This function clears(0) the specified bit position in +// the Bit String. If the Bit String is NULL, then a +// new Bit String is allocated and cleared to all zeros. +// +// Side-effects: Bit String is modified. +// Memory may be allocated. +// +// Dependencies: bit_position must be in the string +// +// End Function Specification ////////////////////////////////////// + +void SCAN_COMM_REGISTER_CLASS::ClearBit +( + uint32_t bit_position + /*!i Bit position in string */ + ) +/*!o No value returned */ +{ + BIT_STRING_CLASS & bitString = AccessBitString(); + bitString.Clear(bit_position); +} + +// Function Specification ////////////////////////////////////////// +// +// Title: SCAN_COMM_REGISTER_CLASS (Copy constructor) +// +// Purpose: This constuctor initializes the data members. This +// copy constructor uses a "deep" copy. +// +// Side-effects: This instance is initialized. +// +// Dependencies: None. +// +// Time Complexity: Constant + time complexity of SetBitString() +// +// End Function Specification ////////////////////////////////////// + +SCAN_COMM_REGISTER_CLASS::SCAN_COMM_REGISTER_CLASS +( + const SCAN_COMM_REGISTER_CLASS & scr + /*!i Scan Comm Register reference to copy */ + ) : +/*!o No value returned */ +address(scr.address) +{ +} + +// Function Specification /////////////////////////////////////////// +// +// Title: operator= (Assignment operator) +// +// Purpose: This assignment operator assigns the Bit String data +// member. +// +// Side-effects: Bit String data member is modified. +// Memory is reallocated. +// +// Dependencies: None. +// +// Time Complexity: Constant +// +// End Function Specification ////////////////////////////////////// + +SCAN_COMM_REGISTER_CLASS & SCAN_COMM_REGISTER_CLASS::operator= +( + const SCAN_COMM_REGISTER_CLASS & scr + /*!i Scan Comm Register instance to assign from */ + ) +/*!o Reference to this Scan Comm Register instance */ +{ + // Check for assignment to self + if(this != &scr) + { + address = scr.address; + } + + return(*this); +} + +// Function Specification /////////////////////////////////////////// +// +// Title: Clear Bit String +// +// Purpose: This function clears the Bit String. If the data +// member is NULL, then a new Bit String is allocated. +// Upon return, the state of the Bit String is all zero. +// +// Side-effects: Bit String data member is modified. +// Memory is allocated or reallocated. +// +// End Function Specification ////////////////////////////////////// + +void SCAN_COMM_REGISTER_CLASS::clearAllBits() +{ + BIT_STRING_CLASS & bitString = AccessBitString(); + bitString.Pattern( 0, bitString.GetLength(), 0x00000000, 32 ); +} + +void SCAN_COMM_REGISTER_CLASS::setAllBits() +{ + BIT_STRING_CLASS & bitString = AccessBitString(); + bitString.Pattern( 0, bitString.GetLength(), 0xffffffff, 32 ); +} + +// Function Specification ////////////////////////////////////////// +// +// Title: SCAN_COMM_REGISTER_CLASS (Constructor) +// +// Purpose: This constuctor initializes the data members. +// +// Side-effects: This instance is initialized. Memory may be allocated +// +// Dependencies: None. +// +// End Function Specification ////////////////////////////////////// + +SCAN_COMM_REGISTER_CLASS::SCAN_COMM_REGISTER_CLASS +( + uint64_t a + /*!i Physical address of register */ + ) : +/*!o No value returned */ +address(a) +{ +} + +#undef IIPSCR_C diff --git a/src/usr/diag/prdf/common/framework/register/iipscr.h b/src/usr/diag/prdf/common/framework/register/iipscr.h new file mode 100755 index 000000000..cd4fb4f83 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipscr.h @@ -0,0 +1,445 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipscr.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1997,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 IIPSCR_H +#define IIPSCR_H + +// Module Description ************************************************** +// +// Description: This module contains the declarations for the +// Processor Runtime Diagnostics Scan Communication +// Register class. +// +// Notes: Unless stated otherwise, assume that each function +// specification has no side-effects, no dependencies, and +// constant time complexity. +// +// End Module Description ********************************************** + + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- + +#if !defined(IIPBITS_H) +#include <iipbits.h> +#endif + +#include <iipsdbug.h> +#include <prdfMain.H> + + +/*--------------------------------------------------------------------*/ +/* Forward References */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* User Types */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Constants */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Macros */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Global Variables */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Function Prototypes */ +/*--------------------------------------------------------------------*/ + +// Class Specification ************************************************* +// +// Name: SCAN_COMM_REGISTER_CLASS +// +// Title: Scan Communication Register +// +// Purpose: SCAN_COMM_REGISTER_CLASS provides the representation +// and access to a physical register. +// +// Usage: This is an abstract base class. +// +// Side-effects: Memory is allocated. +// +// Dependencies: None. +// +// Notes: The Scan Communication Register is a model of an actual +// physical register. The bits in the register are represented by the +// bit_string data member which is modified dynamically as operations +// are preformed. It acts as a temporarily cached value of the +// register. When a read is performed, the bit values are updated in +// the bit string. When a write is performed, the current value of the +// bits are used as the value to write. The current value of this +// cached bit string can be accessed or modified by other objects via +// the public interface. The physical address and bit length of the +// hardware register are set during intialization and used on all +// acceses. +// +// The basic Read() and Write() functions are virtual. The +// actual implemenations are dependent on the actual hardware +// and the software Hardware Manual Ops Scan Control Routines. +// These function specifications describe a common behaviour +// that every derived class must follow. Additional, +// information may also be specified. +// +// A Read() function is also provided that has a Bit String +// mask parameter. This function calls the virtual Read() +// and then applies the mask so that the internal Bit String +// contains the hardware register contents with certain bits +// ignored (masked off). +// +// Cardinality: 0 +// +// Space Complexity: Linear +// K + Mn where K and M are constants and n is the +// number of bits in the register. +// +// End Class Specification ********************************************* + +/** + SCAN_COMM_REGISTER_CLASS + @author Doug Gilbert + @V5R2 + */ +class SCAN_COMM_REGISTER_CLASS +{ +public: + + /** + Destructor + */ + virtual ~SCAN_COMM_REGISTER_CLASS(void); + + // dg00 start + /** + Read hardware register (virtual) + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> [SUCCESS | MOPs return code] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Internal bit string represents the value of the + hardware register (if rc == SUCCESS) + <br><b>Sideaffects: </b> Value guarenteed to be read from hardware. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Default is to call Read(). If a child class cannot + guarentee hardware access everytime Read() is called + then the function ForceRead() should be overridden. + </ul><br> + */ + virtual uint32_t ForceRead(void) { return Read(); }; + // dg00 end + + /** + Read hardware register (pure virtual) + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> [SUCCESS | MOPs return code] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Internal bit string represents the value of the + hardware register (if rc == SUCCESS) + <br><b>Sideaffects: </b> The bit string value may or may not be retrieved + from hardware; a buffered copy may be used. + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual uint32_t Read(void) = 0; + + virtual uint32_t UnSync(void); + + /** + Read hardware register and apply a mask + <ul> + <br><b>Parameters: </b> Mask to apply + <br><b>Returns: </b> [SUCCESS | MOPs return code] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Internal bit string represents the value of the + hardware register with the bits turned off as + specified by the mask. + <br><b>Sideaffects: </b> The bit string value may or may not be retrieved + from hardware. a buffered copy may be used. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> if bits read from hardware = '00110100' + and mask = '01110000' + then internal bit sting = '00000100' + + if mask.Length() < GetBitString()->Length() + then mask is right extended with 0's + if mask.Length() > GetBitString()->Length() + then extra mask bits are ignored. + </ul><br> + */ + uint32_t Read(BIT_STRING_CLASS & mask); + + /** + Write hardware register (pure virtual) + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> [SUCCESS | MOPs return code] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Internal bit string value written to hardware + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> If internal bitstring was never read/set/modified then + zeros are written to corresponding hardware register. + </ul><br> + */ + virtual uint32_t Write(void) = 0; + + /** + Access a copy of the scan comm address + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> Scan Comm address + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + uint64_t GetAddress(void) const { return address; } + + /** + Access a copy of the short id for signatures. + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> ID. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual uint16_t GetId(void) const = 0; + + /** + Set the short id for signatures. + <ul> + <br><b>Parameters: </b> ID. + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> For virtual registers, this is not required to have + any effect. + </ul><br> + */ + virtual void SetId(uint16_t) = 0; + + + /** + Access the bit length of the register + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> bit length of the register + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + uint32_t GetBitLength(void) const { return (GetBitString())->GetLength();} + + /** + Access the internal bit string (pure virtual) + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> ptr to the internal bit string (const) + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> If the internal bit string was never read/modified then + all bits are zero + </ul><br> + */ + virtual + const BIT_STRING_CLASS * GetBitString(ATTENTION_TYPE + i_type = PRDF::INVALID_ATTENTION_TYPE + ) const = 0; + + /** + Modify the internal bit string (pure virtual) + <ul> + <br><b>Parameters: </b> a bit string + <br><b>Returns: </b> Nothing + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Internal bit string == *bs for first len bits where + len is the smaller of the two lengths. + Memory may be (re)allocated + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> The hardware register value is not modified until + Write() is called + </ul><br> + */ + virtual void SetBitString(const BIT_STRING_CLASS * bs) = 0; + + /** + SetBit + <ul> + <br><b>Parameters: </b> Position of bit to set (= 1) + <br><b>Returns: </b> None. + <br><b>Requirements:</b> bit position < GetBitString()->Length() + <br><b>Promises: </b> GetBitString()->IsSet(bit_position) == true + <br><b>Exceptions: </b> None. + <br><b> Notes: </b> Register value is not reflected in hardware until + Write() is called + </ul><br> + */ + void SetBit(uint32_t bit_position); + + /** + ClearBit (reset bit) + <ul> + <br><b>Parameters: </b> Position of bit to clear (= 0) + <br><b>Returns: </b> None. + <br><b>Requirements:</b> bit position < GetBitString()->Length() + <br><b>Promises: </b> GetBitString()->IsSet(bit_position) == false + <br><b>Exceptions: </b> None. + <br><b> Notes: </b> Register value is not reflected in hardware until + Write() is called + </ul><br> + */ + void ClearBit(uint32_t bit_position); + + /** + * @brief Will query if a bit is set. + * @param i_bitPos The bit position to query. + * @pre The bit position must be less than GetBitString()->Length() + * @return TRUE if the bit is set, FALSE otherwise. + */ + bool IsBitSet( uint32_t i_bitPos ) + { return GetBitString()->IsSet(i_bitPos); } + + /** @brief Flushes all bits to 0. */ + void clearAllBits(); + + /** @brief Flushes all bits to 1. */ + void setAllBits(); + + /** + Get a field within the bitstring (right justified) + <ul> + <br><b>Parameters: </b> start bit position, length of field + <br><b>Returns: </b> CPU_WORD containing requested bits (right justified) + <br><b>Requirements:</b> bit_position < GetBitLength(), + length <= sizeof(CPU_WORD) (32 bits for 603/403) + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + CPU_WORD GetBitFieldJustified(uint32_t bit_position,uint32_t length) const + { return GetBitString()->GetFieldJustify(bit_position,length); } + + /** + Set a field within the bitstring with a value (from right to left in bit string) + <ul> + <br><b>Parameters: </b> start bit position, length of field, value + <br><b>Returns: </b> Nothing + <br><b>Requirements:</b> bit_position < GetBitLength(), + length <= sizeof(CPU_WORD) (32 bits for 603/403), + length must be large enought to hold the value. + <br><b>Promises: </b> GetBitFieldJustified(bitPosition,length) == value + <br><b>Exceptions: </b> None. + </ul><br> + */ + void SetBitFieldJustified(uint32_t bitPosition,uint32_t length,CPU_WORD value) + { AccessBitString().SetFieldJustify(bitPosition,length,value); } + + /** + Query if bit string is all zeros + <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 BitStringIsZero() + { return GetBitString()->IsZero(); } + +protected: + + /** + Constructor + <ul> + <br><b>Parameters: </b> Scan Comm Address + <br><b>Promises: </b> Heap memory may be allocated + </ul><br> + */ + SCAN_COMM_REGISTER_CLASS( uint64_t a); + + /** + Copy Constructor + <ul> + <br><b>Parameters: </b> SCAN_COMM_REGISTER_CLASS + <br><b>Promises: </b> Heap memory may be (re)allocated + </ul><br> + */ + SCAN_COMM_REGISTER_CLASS(const SCAN_COMM_REGISTER_CLASS & scr); + + /** + Assignment operator + <ul> + <br><b>Parameters: </b> SCAN_COMM_REGISTER_CLASS + <br><b>Promises: </b> Heap memory may be (re)allocated + (*this) == scr; + </ul><br> + */ + SCAN_COMM_REGISTER_CLASS & operator= ( const SCAN_COMM_REGISTER_CLASS & scr); + + /** + Get modifiable reference to internal bit string (don't even thing about making this public!!!) + <ul> + <br><b>Paramters: </b> None. + <br><b>Returns </b> Reference to the internal bit string + <br><b>Requirments </b> None. + <br><b>Promises </b> None. + </ul><br> + */ + virtual BIT_STRING_CLASS & AccessBitString(void) = 0; + +private: // Data + + // Enum Specification ////////////////////////////////////////////// + // + // Purpose: These enumerated constants specify implementation data. + // + // End Enum Specification ////////////////////////////////////////// + + enum + { + ODD_PARITY_SET_BIT_POSITION = 16 + }; + + // Data Specification ////////////////////////////////////////////// + // + // Purpose: These data members specify the physical properties of + // register. + // + // End Data Specification ////////////////////////////////////////// + + uint64_t address; + +}; + +#endif diff --git a/src/usr/diag/prdf/common/framework/register/prdfCaptureData.C b/src/usr/diag/prdf/common/framework/register/prdfCaptureData.C new file mode 100755 index 000000000..29b62f596 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfCaptureData.C @@ -0,0 +1,436 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfCaptureData.C $ */ +/* */ +/* 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 */ + +/** + @file prdfCaptureData.C + @brief Squadrons implementation of capture data +*/ +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- + +#ifdef __HOSTBOOT_MODULE + +// For hostboot, these are no-ops +#define htonl(foo) (foo) +#define htons(foo) (foo) +#define ntohl(foo) (foo) +#define ntohs(foo) (foo) + +#else + +// for hton funcs. +#include <netinet/in.h> + +#endif + +#ifndef IIPBITS_H +#include <iipbits.h> +#endif + +// 3 dg06d +#include <prdfHomRegisterAccess.H> // dg06a +#include <iipScanCommRegisterChip.h> // dg06a + +#ifndef IIPCHIP_H +#include <iipchip.h> +#endif + +#ifndef IIPCAPTUREDATA_H +#include <iipCaptureData.h> +#endif + +#include <string.h> + +#include <algorithm> // @jl04 a Add this for the Drop function. + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +CaptureData::CaptureData(void):data() +{ +// data.reserve(INITIAL_DATA_COUNT); +} + +// dg05d CaptureData::~CaptureData(void) +// dg05d { +// dg05d if(!data.empty()) +// dg05d { +// dg05d Clear(); +// dg05d } +// dg05d } + +void CaptureData::Clear(void) +{ + + if(!data.empty()) + { +// dg05d for(DataContainerType::iterator i = data.begin();i != data.end();i++) +// dg05d { +// dg05d delete [] (*i).dataPtr; +// dg05d } + + data.erase(data.begin(), data.end()); + + } /* if not empty */ +} + + +// @jl04 c Changed this to add the type parm. +void CaptureData::Add( TARGETING::TargetHandle_t i_pchipHandle, int scomId, + SCAN_COMM_REGISTER_CLASS & scr, Place place, RegType type) +{ + uint16_t bufferLength = scr.GetBitLength() / 8; + + if((scr.GetBitLength() % 8) != 0) + bufferLength += 1; + + Data dataElement(i_pchipHandle, scomId, bufferLength, NULL); + + AddDataElement(dataElement, scr, place, type); +} + +// start dg02 +void CaptureData::Add( TARGETING::TargetHandle_t i_pchipHandle, int scomId, + BIT_STRING_CLASS & bs, Place place) +{ + uint16_t bufferLength = bs.GetLength() / 8; + + if((bs.GetLength() % 8) != 0) + bufferLength += 1; + + Data dataElement(i_pchipHandle, scomId, bufferLength, NULL); + + DataIterator dataIterator; + + if(place == FRONT) + { + data.insert(data.begin(), dataElement); + dataIterator = data.begin(); + } + else + { + data.push_back(dataElement); + dataIterator = data.end(); + dataIterator--; + } + if(!bs.IsZero()) + { + uint8_t *bufferPtr = new uint8_t[(*dataIterator).dataByteLength]; + BIT_STRING_ADDRESS_CLASS bitString(0, bs.GetLength(), (CPU_WORD *) bufferPtr); + + bitString.SetBits(bs); + (*dataIterator).dataPtr = bufferPtr; + } + else + { + (*dataIterator).dataByteLength = 0; + } + + +} + +// end dg02 + +// start dg06a +void CaptureData::Add( TARGETING::TargetHandle_t i_pchipHandle, + int iScomId, uint64_t iScomAddress, + uint32_t iScomBitLength, Place iplace ) +{ + PRDF::HomRegisterAccessScom hops(i_pchipHandle); + ScanCommRegisterChip scrc(iScomAddress, iScomBitLength, hops); + + Add(i_pchipHandle, iScomId, scrc, iplace); +} + +// end dg06a + +// start jl04a +void CaptureData::Drop(RegType i_type) +{ + // Function below requires a predicate function above to Drop + // a data element from the capture data if it is + // defined as secondary data instead of primary data in the rule files. + // This predicate has to exist within the CaptureData Class because the + // class "Data" is defined within CaptureData class. + data.erase( std::remove_if(data.begin(),data.end(), + prdfCompareCaptureDataType(i_type)), data.end() ); +} +// end jl04a + +// @jl04 c Changed the AddDataElement to include a type. +void CaptureData::AddDataElement( Data & dataElement, + SCAN_COMM_REGISTER_CLASS & scr, + Place place, RegType type ) +{ + DataIterator dataIterator; + + if(place == FRONT) + { + data.insert(data.begin(), dataElement); + dataIterator = data.begin(); + } + else + { + data.push_back(dataElement); + dataIterator = data.end(); + dataIterator--; + } + +//$TEMP @jl04 or @jl05. + (*dataIterator).registerType = type; +//$TEMP @jl04 or @jl05. + + if(scr.Read() == SUCCESS) + { + const BIT_STRING_CLASS *bitStringPtr = scr.GetBitString(); + + if(!bitStringPtr->IsZero()) + { + uint8_t *bufferPtr = new uint8_t[(*dataIterator).dataByteLength]; + BIT_STRING_ADDRESS_CLASS bitString(0, bitStringPtr->GetLength(), + (CPU_WORD *) bufferPtr); + + bitString.SetBits(*bitStringPtr); + (*dataIterator).dataPtr = bufferPtr; + } + else + { + (*dataIterator).dataByteLength = 0; + } + } + else + { + // Zero out data length if SCRs failed + (*dataIterator).dataByteLength = 0; + } + +} +// ------------------------------------------------------------------------------------------------ + +/* CaptureData Format: + * capture data -> ( <chip header> <registers> )* + * chip header -> ( <chip id:32> <# registers:32> ) + * registers -> ( <reg id:16> <reg byte len:16> <bytes>+ ) + */ +unsigned int CaptureData::Copy(uint8_t *i_buffer, unsigned int i_bufferSize) const +{ + using namespace TARGETING; + using namespace PRDF; + + TargetHandle_t l_pcurrentChipHandle =NULL ; + uint8_t * l_entryCountPos = NULL; + uint32_t l_regEntries = 0; + + uint32_t l_bytesWritten = 0; + for (ConstDataIterator i = data.begin(); i != data.end(); i++) + { + // Check for new chip. + if (i->chipHandle != l_pcurrentChipHandle) + { // Update previous header, write new header. + + if (NULL != l_entryCountPos) // Update previous entry count. + { + l_regEntries = htonl(l_regEntries); + memcpy(l_entryCountPos, &l_regEntries, sizeof(l_regEntries)); + l_regEntries = 0; + } + + // Update chip Handles.... + TargetHandle_t l_ptempHandle = l_pcurrentChipHandle = i->chipHandle; + HUID l_chipHuid =PlatServices::getHuid(l_ptempHandle); + const size_t l_huidSize = sizeof(l_chipHuid); + l_chipHuid = htonl(l_chipHuid); + + // Verify space. + if (i_bufferSize < l_bytesWritten + 2 * l_huidSize) + { + break; + } + // Write header. + memcpy(&i_buffer[l_bytesWritten], + &l_chipHuid, l_huidSize); + l_bytesWritten += l_huidSize; + l_entryCountPos = &i_buffer[l_bytesWritten]; + l_ptempHandle = NULL; + memcpy(l_entryCountPos, &l_chipHuid, l_huidSize); + l_bytesWritten += l_huidSize; + } + + // Go to next entry if 0 data length. + if (0 == i->dataByteLength) + continue; + + // Check room. + if ((l_bytesWritten + 2*sizeof(uint16_t) + i->dataByteLength) > + i_bufferSize) + continue; + + // Write register ID. + uint16_t l_regId = htons(i->address); + memcpy(&i_buffer[l_bytesWritten], &l_regId, sizeof(l_regId)); + l_bytesWritten += sizeof(l_regId); + + // Write register length. + uint16_t l_regLen = htons(i->dataByteLength); + memcpy(&i_buffer[l_bytesWritten], &l_regLen, sizeof(l_regLen)); + l_bytesWritten += sizeof(l_regLen); + + // Write register data. + uint32_t l_dataWritten = 0; + while ((l_dataWritten + 4) <= i->dataByteLength) + { + uint32_t l_temp32; + memcpy(&l_temp32, &i->dataPtr[l_dataWritten], sizeof(l_temp32)); + l_temp32 = htonl(l_temp32); + memcpy(&i_buffer[l_bytesWritten], &l_temp32, 4); + l_dataWritten += 4; l_bytesWritten += 4; + } + if (l_dataWritten != i->dataByteLength) + { + uint32_t l_temp32; + memcpy(&l_temp32, &i->dataPtr[l_dataWritten], sizeof(l_temp32)); + l_temp32 = htonl(l_temp32); + memcpy(&i_buffer[l_bytesWritten], + &l_temp32, i->dataByteLength - l_dataWritten); + l_bytesWritten += i->dataByteLength - l_dataWritten; + } + + // Update entry count. + l_regEntries++; + } + + // Update previous entry count. + if (NULL != l_entryCountPos) + { + l_regEntries = htonl(l_regEntries); + memcpy(l_entryCountPos, &l_regEntries, sizeof(l_regEntries)); + l_regEntries = 0; + } + + return l_bytesWritten; +} + +// dg08a --> +CaptureData & CaptureData::operator=(const uint8_t *i_flatdata) +{ + using namespace TARGETING; + using namespace PRDF; + + uint32_t l_tmp32 = 0; + uint16_t l_tmp16 = 0; + + HUID l_chipHuid =PRDF::INVALID_HUID ; + const size_t l_huidSize = sizeof(l_chipHuid); + + // Read size. + memcpy(&l_tmp32, i_flatdata, sizeof(uint32_t)); + uint32_t size = ntohl(l_tmp32); + i_flatdata += sizeof(uint32_t); + + Clear(); + + // Calculate end of buffer. + const uint8_t *eptr = i_flatdata + size; + + while(i_flatdata < eptr) + { + // Read chip Handle. + memcpy(&l_chipHuid , i_flatdata,l_huidSize ); + i_flatdata += l_huidSize ; + TargetHandle_t l_pchipHandle =NULL; + l_chipHuid = ntohl(l_chipHuid); + l_pchipHandle = PlatServices::getTarget(l_chipHuid ); + if(NULL ==l_pchipHandle) + { + continue; + } + + // Read # of entries. + memcpy(&l_tmp32, i_flatdata, sizeof(uint32_t)); + i_flatdata += sizeof(l_tmp32); + uint32_t entries = ntohl(l_tmp32); + + // Input each entry. + for(uint32_t i = 0; i < entries; ++i) + { + // Read register id. + memcpy(&l_tmp16, i_flatdata, sizeof(uint16_t)); + i_flatdata += sizeof(uint16_t); + int regid = ntohs(l_tmp16); + + // Read byte count. + memcpy(&l_tmp16, i_flatdata, sizeof(uint16_t)); + i_flatdata += sizeof(uint16_t); + uint32_t bytecount = ntohs(l_tmp16); + + // Read data for register. + prdfBitStringBuffer bs(bytecount * 8); + for(uint32_t bc = 0; bc < bytecount; ++bc) + { + bs.SetFieldJustify(bc*8,8,(CPU_WORD)(*(i_flatdata+bc))); //mp01a + } + i_flatdata += bytecount; + + // Add to capture data. + Add(l_pchipHandle, regid, bs); + } + } + + return *this; +} + +// <-- dg08a + +// copy ctor for Data class +CaptureData::Data::Data(const Data & d): +chipHandle(d.chipHandle), address(d.address), +dataByteLength(d.dataByteLength), dataPtr(NULL) +{ + if(d.dataPtr != NULL) + { + dataPtr = new uint8_t[dataByteLength]; + + memcpy(dataPtr, d.dataPtr, dataByteLength); + } +} + +CaptureData::Data & CaptureData::Data::operator=(const Data & d) +{ + chipHandle = d.chipHandle; + address = d.address; + dataByteLength = d.dataByteLength; + if(dataPtr != NULL) + { + delete[]dataPtr; + dataPtr = NULL; + } + if(d.dataPtr != NULL) + { + dataPtr = new uint8_t[dataByteLength]; + memcpy(dataPtr, d.dataPtr, dataByteLength); + } + + return *this; +} diff --git a/src/usr/diag/prdf/common/framework/register/prdfErrorRegister.C b/src/usr/diag/prdf/common/framework/register/prdfErrorRegister.C new file mode 100755 index 000000000..9d5488678 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfErrorRegister.C @@ -0,0 +1,227 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfErrorRegister.C $ */ +/* */ +/* 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 */ + +/** + @file iipErrorRegister.C + @brief ErrorRegister class definition +*/ +// Module Description ************************************************** +// +// Description: Definition of ErrorRegister class +// +// End Module Description ********************************************** +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define iipErrorRegister_C + +#include <prdfMain.H> +#include <prdfAssert.h> +#include <iipstep.h> +#include <iipbits.h> +#include <iipResolution.h> +#include <iipscr.h> +#include <prdfErrorSignature.H> +#include <iipServiceDataCollector.h> +#include <prdfResolutionMap.H> +#include <iipErrorRegister.h> + +#include <iipconst.h> +#include <iipglobl.h> +#undef iipErrorRegister_C +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +int32_t ErrorRegister::SetErrorSignature(STEP_CODE_DATA_STRUCT & error,prdfBitKey & bl) +{ + using namespace PRDF; + + int32_t rc = SUCCESS; + ErrorSignature * esig = error.service_data->GetErrorSignature(); + uint32_t blen = bl.size(); + switch(blen) + { + case 0: + (error.service_data->GetErrorSignature())->setErrCode(PRD_SCAN_COMM_REGISTER_ZERO); + if(xNoErrorOnZeroScr != true) rc = PRD_SCAN_COMM_REGISTER_ZERO; + break; + + case 1: + esig->setErrCode(bl.getListValue(0)); + break; + + default: + for(uint32_t index = 0; index < blen; ++index) //dg01a + { //dg01a + esig->setErrCode(bl.getListValue(index)); //dg01a + } //dg01a + esig->setErrCode(PRD_MULTIPLE_ERRORS); + }; + return rc; +} + +/*---------------------------------------------------------------------*/ + +ErrorRegister::ErrorRegister +(SCAN_COMM_REGISTER_CLASS & r, prdfResolutionMap & rm, uint16_t scrId) +: ErrorRegisterType(), scr(r), scr_rc(SUCCESS), rMap(rm), xNoErrorOnZeroScr(false), xScrId(scrId) +{ + PRDF_ASSERT(&r != NULL); + PRDF_ASSERT(&rm != NULL); +} + +/*---------------------------------------------------------------------*/ + +int32_t ErrorRegister::Analyze(STEP_CODE_DATA_STRUCT & error) +{ + using namespace PRDF; + + int32_t rc = SUCCESS; + + uint32_t l_savedErrSig = 0; // @pw01 + + if(xScrId == 0x0fff) + { + (error.service_data->GetErrorSignature())->setRegId(scr.GetAddress()); + } + else + { + (error.service_data->GetErrorSignature())->setRegId(xScrId); + } + + // Get Data from hardware + const BIT_STRING_CLASS &bs = Read(error.service_data->GetCauseAttentionType()); // @pw02 + prdfBitKey bl; // null bit list has length 0 + + if (scr_rc == SUCCESS) + { + bl = Filter(bs); + rc = SetErrorSignature(error,bl); //dg02c - made function of this block of code + // @pw01 + // Save signature to determine if it changes during resolution execution. + l_savedErrSig = (error.service_data->GetErrorSignature())->getSigId(); + } + + uint32_t res_rc = Lookup(error, bl); // lookup and execute the resolutions + if(SUCCESS == rc) rc = res_rc; // previous rc has prioity over res_rc + + + // @pw01 + // If we had a DD02 and the signature changes, ignore DD02. + if ((rc == PRD_SCAN_COMM_REGISTER_ZERO) && + ((error.service_data->GetErrorSignature())->getSigId() + != l_savedErrSig) + ) + { + // Found a better answer during the DD02 analysis. + rc = res_rc; + } + + + if(scr_rc == SUCCESS) + { + FilterUndo(bl); // dg03a + // NOTE: This is an unusual work-a-round for NOT clearing + // particular FIR bits in a register because they are cleared + // in another part of the plugin code. jl01 + if(rc == PRD_NO_CLEAR_FIR_BITS) + { + rc = SUCCESS; //Return success to indicate that we understand the DDFF + } + else + { + int32_t reset_rc; + reset_rc = Reset(bl,error); + if(rc == SUCCESS)rc = reset_rc; + } + } + else // scr read failed + { + (error.service_data->GetErrorSignature())->setErrCode(PRD_SCANCOM_FAILURE); + rc = scr_rc; + } + + return(rc); +} + +/*---------------------------------------------------------------------*/ + +const BIT_STRING_CLASS & ErrorRegister::Read(ATTENTION_TYPE i_attn) +{ + scr_rc = scr.Read(); + return (*scr.GetBitString(i_attn)); +} + +/*---------------------------------------------------------------------*/ + +prdfBitKey ErrorRegister::Filter +(const BIT_STRING_CLASS & bs) +{ + prdfBitKey bit_list; + bit_list = bs; + return(bit_list); +} + +/*---------------------------------------------------------------------*/ + +int32_t ErrorRegister::Lookup(STEP_CODE_DATA_STRUCT & sdc, prdfBitKey & bl) // dg02c dg03c +{ + int32_t rc = SUCCESS; +// if (bl.GetListLength() == 0) return(rMap.GetDefault()); /dg00d + prdfResolutionList rList; + rMap.LookUp(rList,bl,sdc); // dg04c + // SetErrorSignature(sdc,bl); // LookUp may have changed bl dg02a dg04d + for(prdfResolutionList::iterator i = rList.begin(); i != rList.end(); ++i) + { + rc |= (*i)->Resolve(sdc); + } + return rc; +} + +/*---------------------------------------------------------------------*/ + +int32_t ErrorRegister::Reset(const prdfBitKey & bit_list, STEP_CODE_DATA_STRUCT & error) +{ + return(SUCCESS); +} diff --git a/src/usr/diag/prdf/common/framework/register/prdfErrorRegisterMask.C b/src/usr/diag/prdf/common/framework/register/prdfErrorRegisterMask.C new file mode 100755 index 000000000..680dfde66 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfErrorRegisterMask.C @@ -0,0 +1,178 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfErrorRegisterMask.C $ */ +/* */ +/* 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 */ + +/** + @file prdfErrorRegisterMask.C + @brief ErrorRegisterMask class definition +*/ + +// Module Description ************************************************** +// +// Description: +// +// End Module Description ********************************************** +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define prdfErrorRegisterMask_C + +#include <iipscr.h> +#include <prdfFilters.H> +#include <iipErrorRegisterMask.h> +#include <iipServiceDataCollector.h> + +#undef prdfErrorRegisterMask_C +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- +ErrorRegisterMask::ErrorRegisterMask +( + SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + FILTER_CLASS * f, + uint16_t scrId, + SCAN_COMM_REGISTER_CLASS & maskScr // dg00 + ) +: +ErrorRegisterFilter(r,rm,f,scrId), +bitString(r.GetBitLength()), +bitStringMask(r.GetBitLength()), +xMaskScr(maskScr) +{ + bitStringMask.Pattern(0); +} + +ErrorRegisterMask::ErrorRegisterMask +( + SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + uint16_t scrId, + SCAN_COMM_REGISTER_CLASS & maskScr // dg00 +) +: +ErrorRegisterFilter(r,rm,scrId), +bitString(r.GetBitLength()), +bitStringMask(r.GetBitLength()), +xMaskScr(maskScr) +{ + bitStringMask.Pattern(0); // clear software mask +} + +// ********************************************************************** + +const BIT_STRING_CLASS & ErrorRegisterMask::Read() +{ + scr_rc = scr.Read(); + bitString = *scr.GetBitString(); + // apply software mask + bitString.Mask(bitStringMask); + // apply hardware mask - if scan comm register for it was specified + if(&xMaskScr != NULL) /*constant condition*/ // dg00 + { // dg00 + int32_t rc = xMaskScr.Read(); // dg00 + if(rc == SUCCESS) // dg00 + { // dg00 + bitString.Mask(*(xMaskScr.GetBitString())); // dg00 + } // dg00 + } // dg00 + + return(bitString); +} + +// *********************************************************************** + +int32_t ErrorRegisterMask::Reset(const BIT_LIST_CLASS & bit_list, + STEP_CODE_DATA_STRUCT & error) +{ + int32_t rc = SUCCESS; + if(error.service_data->IsAtThreshold()) + { + int32_t blLength = bit_list.size(); + int i = 0; + if(&xMaskScr == NULL) /* constant condition*/ // dg00 + { // dg00 + for(i = 0; i < blLength; ++i) + { + SetMaskBit(bit_list.getListValue(i)); + } + } // dg00 +// else // valid maskSCR // dg00 +// { // dg00 +// for(i = 0; i < blLength; ++i) // dg00 +// { // dg00 +// xMaskScr.SetBit(bit_list.GetListValue(i)); // dg00 +// } // dg00 +// rc = xMaskScr.Write(); // dg00 +// } // dg00 + } + return rc; +} + +// *************************************************************************** + +BIT_LIST_CLASS ErrorRegisterFilter::Filter +(const BIT_STRING_CLASS & bs) +{ + BIT_LIST_CLASS bit_list; + bit_list = bs; + if(filter) filter->Apply(bit_list); + return bit_list; +} + + + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ------ -------- -------- ------------------------------ +// v4r1mo 05/03/96 DGILBERT Initial Creation +// d49127.1 v4r1m0 05/31/96 DGILBERT Added Analyze() and Reset() +// p4902214 v4r1m0 05/09/97 DGILBERT Added service data to Reset() +// Removed Analyse() +// D49274.2 v4r5 09/24/98 DGILBERT Added scrId +// dg00 v5r2 04/05/00 DGILBERT Added maskScr +// P4907878 v5r2 04/27/01 DGILBERT factor out filter into +// ErrorRegisterFilter class +// 423599 fsp 10/28/03 dgilbert make scrId a uint16_t +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.C b/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.C new file mode 100755 index 000000000..aaca68beb --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.C @@ -0,0 +1,457 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.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 prdfHomRegisterAccess.C + @brief definition of HomRegisterAccess +*/ +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define prdfHomRegisterAccess_C + +#ifdef __HOSTBOOT_MODULE + #include <ecmdDataBufferBase.H> + #include <fapi.H> + #include <errlmanager.H> + #include <devicefw/userif.H> + #include <targeting/common/targetservice.H> +#else + #include <ecmdDataBuffer.H> + #include <hwsvScanScom.H> + #include <chicservlib.H> + #include <hwsvExecutionService.H> +#endif + +#include <prdfHomRegisterAccess.H> +#include <prdf_service_codes.H> +#include <iipbits.h> +#include <iipglobl.h> +#include <prdfMain.H> +#include <prdfPlatServices.H> + +#undef prdfHomRegisterAccess_C + + +namespace PRDF +{ + +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//------------------------------------------------------------------------------ +// Member Function Specifications +//------------------------------------------------------------------------------ + +ScomService& getScomService() +{ + return PRDF_GET_SINGLETON(theScomService); +} + +ScomService::ScomService() : + iv_ScomAccessor(NULL) +{ + PRDF_DTRAC("ScomService() initializing default iv_ScomAccessor"); + iv_ScomAccessor = new ScomAccessor(); +} + +ScomService::~ScomService() +{ + if(NULL != iv_ScomAccessor) + { + PRDF_DTRAC("~ScomService() deleting iv_ScomAccessor"); + delete iv_ScomAccessor; + iv_ScomAccessor = NULL; + } +} + +void ScomService::setScomAccessor(ScomAccessor & i_ScomAccessor) +{ + PRDF_DTRAC("ScomService::setScomAccessor() setting new scom accessor"); + + if(NULL != iv_ScomAccessor) + { + PRDF_TRAC("ScomService::setScomAccessor() deleting old iv_ScomAccessor"); + delete iv_ScomAccessor; + iv_ScomAccessor = NULL; + } + + iv_ScomAccessor = &i_ScomAccessor; +} + +uint32_t ScomService::Access(TARGETING::TargetHandle_t i_target, + BIT_STRING_CLASS & bs, + uint64_t registerId, + MopRegisterAccess::Operation operation) const +{ + PRDF_DENTER("ScomService::Access()"); + + uint32_t rc = iv_ScomAccessor->Access(i_target, + bs, + registerId, + operation); + + PRDF_DEXIT("ScomService::Access(): rc=%d", rc); + + return rc; +} + + +uint32_t ScomAccessor::Access(TARGETING::TargetHandle_t i_target, + BIT_STRING_CLASS & bs, + uint64_t registerId, + MopRegisterAccess::Operation operation) const +{ + PRDF_DENTER("ScomAccessor::Access()"); + + uint32_t rc = SUCCESS; + errlHndl_t errH = NULL; + uint32_t bsize = bs.GetLength(); + uint32_t l_ecmdRc = ECMD_DBUF_SUCCESS; + + if(i_target != NULL) + { + #ifdef __HOSTBOOT_MODULE + + ecmdDataBufferBase buffer(bsize); + uint64_t l_data = 0; + size_t l_size = sizeof(uint64_t); + + #else + + ecmdDataBuffer buffer(bsize); + + #endif + + switch (operation) + { + case MopRegisterAccess::WRITE: + for(unsigned int i = 0; i < bsize; ++i) + { + if(bs.IsSet(i)) buffer.setBit(i); + } + + // FIXME: If register is in a EX chiplet, need to also update + // PORE image ???? + + #ifdef __HOSTBOOT_MODULE + + l_data = buffer.getDoubleWord(0); + errH = deviceWrite( i_target, + &l_data, + l_size, + DEVICE_SCOM_ADDRESS(registerId)); + + #else + + errH = HWSV::hwsvPutScom(i_target, registerId, buffer); + + #endif + + break; + + case MopRegisterAccess::READ: + bs.Pattern(0x00000000); // clear all bits + + #ifdef __HOSTBOOT_MODULE + + errH = deviceRead( i_target, &l_data, l_size, + DEVICE_SCOM_ADDRESS(registerId) ); + l_ecmdRc = buffer.setDoubleWord(0, l_data); + + #else + + errH = HWSV::hwsvGetScom(i_target, registerId, buffer); + + #endif + + for(unsigned int i = 0; i < bsize; ++i) + { + if(buffer.isBitSet(i)) bs.Set(i); + } + + break; + + default: + PRDF_ERR("ScomAccessor::Access() unsuppported scom op: 0x%08X", operation); + break; + + } // end switch operation + + } + else // Invalid target + { + /*@ + * @errortype + * @subsys EPUB_FIRMWARE_SP + * @reasoncode PRDF_CODE_FAIL + * @moduleid PRDF_HOM_SCOM + * @userdata1 PRD Return code = SCR_ACCESS_FAILED + * @userdata2 The invalid ID causing the fail + * @devdesc Access SCOM failed due to NULL target handle + * @procedure EPUB_PRC_SP_CODE + */ + + // create an error log + PRDF_CREATE_ERRL(errH, + ERRL_SEV_PREDICTIVE, // error on diagnostic + ERRL_ETYPE_NOT_APPLICABLE, + SRCI_MACH_CHECK, + SRCI_NO_ATTR, + PRDF_HOM_SCOM, // module id + FSP_DEFAULT_REFCODE, // refcode What do we use??? + PRDF_CODE_FAIL, // Reason code + SCR_ACCESS_FAILED, // user data word 1 + PlatServices::getHuid(i_target), // user data word 2 + 0x0000, // user data word 3 + 0x0000 // user data word 4 + ); + } + + if(errH) + { + rc = PRD_SCANCOM_FAILURE; + PRDF_ADD_SW_ERR(errH, rc, PRDF_HOM_SCOM, __LINE__); + PRDF_ADD_PROCEDURE_CALLOUT(errH, SRCI_PRIORITY_MED, EPUB_PRC_SP_CODE); + + bool l_isAbort = false; + PRDF_ABORTING(l_isAbort); + if (!l_isAbort) + { + PRDF_COMMIT_ERRL(errH, ERRL_ACTION_SA|ERRL_ACTION_REPORT); + } + else + { + delete errH; + errH = NULL; + } + } + if (l_ecmdRc != ECMD_DBUF_SUCCESS) + { + PRDF_ERR( "ScomAccessor::Access ecmdDataBuffer " + "operation failed with ecmd_rc = 0x%.8X", l_ecmdRc ); + /*@ + * @errortype + * @subsys EPUB_FIRMWARE_SP + * @reasoncode PRDF_ECMD_DATA_BUFFER_FAIL + * @moduleid PRDF_HOM_SCOM + * @userdata1 ecmdDataBuffer return code + * @userdata2 Chip HUID + * @userdata3 unused + * @userdata4 unused + * @devdesc Low-level data buffer support returned a failure. Probable firmware error. + * @procedure EPUB_PRC_SP_CODE + */ + errlHndl_t ecmd_rc_errl = NULL; + PRDF_CREATE_ERRL(ecmd_rc_errl, + ERRL_SEV_PREDICTIVE, // error on diagnosticERRL_ETYPE_NOT_APPLICABLE + ERRL_ETYPE_NOT_APPLICABLE, + SRCI_MACH_CHECK, // B1xx src + SRCI_NO_ATTR, + PRDF_HOM_SCOM, // module id + FSP_DEFAULT_REFCODE, // refcode + PRDF_ECMD_DATA_BUFFER_FAIL, // Reason code - see prdf_service_codes.H + l_ecmdRc, // user data word 1 + PlatServices::getHuid(i_target), // user data word 2 + 0, // user data word 3 + 0 // user data word 4 + ); + + PRDF_ADD_PROCEDURE_CALLOUT(ecmd_rc_errl, SRCI_PRIORITY_MED, EPUB_PRC_SP_CODE); + PRDF_COMMIT_ERRL(ecmd_rc_errl, ERRL_ACTION_REPORT); + + rc = FAIL; + } + + PRDF_DEXIT("ScomAccessor::Access(): rc=%d", rc); + + return rc; +} + +//------------------------------------------------------------------------------ + +uint32_t HomRegisterAccessScom::Access( BIT_STRING_CLASS & bs, + uint64_t registerId, + Operation operation) const +{ + PRDF_DENTER("HomRegisterAccessScom::Access()"); + + uint32_t rc = getScomService().Access(iv_ptargetHandle, + bs, + registerId, + operation); + + PRDF_DEXIT("HomRegisterAccessScom::Access() rc=%d", rc); + + return rc; +} + +//------------------------------------------------------------------------------ + +HomRegisterAccessScan::HomRegisterAccessScan( + TARGETING::TargetHandle_t i_ptargetHandle, + ScanRingField * start, ScanRingField * end ) +: MopRegisterAccess(), iv_punitHandle(i_ptargetHandle) +{ + iv_aliasIds.reserve(end-start); + while(start != end) + { + iv_aliasIds.push_back(*start); + ++start; + } +} + +//------------------------------------------------------------------------------ + +uint32_t HomRegisterAccessScan::Access(BIT_STRING_CLASS & bs, + uint64_t registerId, + Operation operation) const +{ + + uint32_t rc = SUCCESS; + errlHndl_t errH = NULL; + HUID l_chipHUID = PlatServices::getHuid(iv_punitHandle); + if(operation == MopRegisterAccess::READ) + { + if(iv_punitHandle != NULL) + { + #ifdef __HOSTBOOT_MODULE + ecmdDataBufferBase buf(bs.GetLength()); + #else + ecmdDataBuffer buf(bs.GetLength()); + #endif + + uint32_t curbit = 0; + bs.Pattern(0x00000000); // clear desination bit string + for(AliasIdList::const_iterator i = iv_aliasIds.begin(); i != iv_aliasIds.end(); ++i) + { + for(uint32_t j = 0; j != i->length; ++j) + { + if(buf.isBitSet(j)) bs.Set(j+curbit); + } + curbit += i->length; + } + } + else + { + + /*@ + * @errortype + * @subsys EPUB_FIRMWARE_SP + * @reasoncode PRDF_CODE_FAIL + * @moduleid PRDF_HOM_SCAN + * @userdata1 PRD Return code = SCR_ACCESS_FAILED + * @userdata2 The invalid ID causing the fail + * @userdata3 Code location = 0x0001 + * @devdesc Access Scan failed due to an invalid function unit + * @procedure EPUB_PRC_SP_CODE + */ + // create an error log + PRDF_CREATE_ERRL(errH, + ERRL_SEV_PREDICTIVE, // error on diagnostic + ERRL_ETYPE_NOT_APPLICABLE, + SRCI_MACH_CHECK, + SRCI_NO_ATTR, + PRDF_HOM_SCAN, // module id + FSP_DEFAULT_REFCODE, // refcode What do we use??? + PRDF_CODE_FAIL, // Reason code + SCR_ACCESS_FAILED, // user data word 1 + l_chipHUID, // user data word 2 + 0x0001, // user data word 3 + 0x0000 // user data word 4 + ); + } + } + // PRD does not ever expect to write scan rings - create an error log + else + { + PRDF_ERR( "HomRegisterAccessScan::Access " + "only scan read is supported. Invalid Scan Op: 0x%.8X", operation ); + + /*@ + * @errortype + * @subsys EPUB_FIRMWARE_SP + * @reasoncode PRDF_UNSUPPORTED_SCAN_WRITE + * @moduleid PRDF_HOM_SCAN + * @userdata1 PRD Return code = SCR_ACCESS_FAILED + * @userdata2 The ID for the scan + * @userdata3 Code location = 0x0002 + * @devdesc Access Scan failed. PRD does not ever expect to write scan rings. + * @procedure EPUB_PRC_SP_CODE + */ + // create an error log + PRDF_CREATE_ERRL(errH, + ERRL_SEV_PREDICTIVE, // error on diagnostic + ERRL_ETYPE_NOT_APPLICABLE, + SRCI_MACH_CHECK, + SRCI_NO_ATTR, + PRDF_HOM_SCAN, // module id + FSP_DEFAULT_REFCODE, // refcode What do we use??? + PRDF_UNSUPPORTED_SCAN_WRITE, // Reason code + SCR_ACCESS_FAILED, // user data word 1 + l_chipHUID, // user data word 2 + 0x0002, // user data word 3 + 0x0000 // user data word 4 + ); + } + if(errH) + { + rc = PRD_SCANCOM_FAILURE; + PRDF_ADD_SW_ERR(errH, rc, PRDF_HOM_SCAN, __LINE__); + PRDF_ADD_PROCEDURE_CALLOUT(errH, SRCI_PRIORITY_MED, EPUB_PRC_SP_CODE); + + bool l_isAbort = false; + PRDF_ABORTING(l_isAbort); + if (!l_isAbort) + { + PRDF_COMMIT_ERRL(errH, ERRL_ACTION_SA|ERRL_ACTION_REPORT); + + } + else + { + delete errH; + errH = NULL; + } + } + + return rc; +} + +} // End namespace PRDF diff --git a/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.H b/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.H new file mode 100755 index 000000000..1427dcb4d --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.H @@ -0,0 +1,311 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.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 PRDFHOMREGISTERACCESS_H +#define PRDFHOMREGISTERACCESS_H +/** + @file prdfHomRegisterAccess.H + @brief Provide access to scan & scan com registers via the HOM +*/ + + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#include <iipMopRegisterAccess.h> +#include <vector> +#include <prdfPlatServices.H> +#include <iipglobl.h> + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +namespace PRDF +{ + +class ScomAccessor +{ + public: + + /** + * @brief ctor + */ + inline ScomAccessor() {} + + /** + * @brief dtor + */ + inline virtual ~ScomAccessor() {} + + /** + Access the scan com register + @param i_target Target to access the register + @param BIT_STRING_CLASS - holds data read or to write + @param register address + @param [READ|WRITE] + @returns [SUCCESS|FAIL] + @pre bs.Length() must be size of register data to read/write + @post For read operation, bs is modified to reflect hardware register state + @note + */ + virtual uint32_t Access(TARGETING::TargetHandle_t i_target, + BIT_STRING_CLASS & bs, + uint64_t registerId, + MopRegisterAccess::Operation operation) const; + + private: + + /** + * @brief disable copy + */ + ScomAccessor(const ScomAccessor &); + + /** + * @brief disable assignment + */ + ScomAccessor & operator=(const ScomAccessor &); + +}; + +/** + * @brief Singleton to access the only ScomService + */ +class ScomService; +PRDF_DECLARE_SINGLETON(ScomService, theScomService); + +/** + * @brief Returns a reference to the ScomService singleton + * + * @return Reference to the ScomService + */ +ScomService& getScomService(); + +/** + * @brief ScomService class + */ +class ScomService +{ + public: + + /** + * @brief Construct ScomService + */ + ScomService(); + + /** + * @brief Destroys ScomService + */ + ~ScomService(); + + /** + * @brief set the scom accessor to be used + * + * @param[in] i_ScomAccessor new scom accessor + */ + void setScomAccessor(ScomAccessor & i_ScomAccessor); + + /** + Access the scan com register + @param i_target Target to access the register + @param BIT_STRING_CLASS - holds data read or to write + @param register address + @param [READ|WRITE] + @returns [SUCCESS|FAIL] + @pre bs.Length() must be size of register data to read/write + @post For read operation, bs is modified to reflect hardware register state + @note + */ + virtual uint32_t Access(TARGETING::TargetHandle_t i_target, + BIT_STRING_CLASS & bs, + uint64_t registerId, + MopRegisterAccess::Operation operation) const; + + private: + + // Disable copy constructor / assignment operator + ScomService(const ScomService& i_right); + ScomService& operator=(const ScomService& i_right); + + // Scom access to actual HW or Sim + ScomAccessor * iv_ScomAccessor; +}; + +/** + Access Scan comm via the HOM + @author Doug Gilbert + @par + @code + @endcode +*/ +class HomRegisterAccessScom : public MopRegisterAccess +{ +public: + /** + Constructor + @param + @returns + @pre + @post + @see + @note + */ + inline HomRegisterAccessScom(TARGETING::TargetHandle_t i_ptargetHandle ); + inline HomRegisterAccessScom(void); + + /* + Destructor + */ + // ~HomRegisterAccessScom(); + + /** + Access the scan com register + @param BIT_STRING_CLASS - holds data read or to write + @param register address + @param [READ|WRITE] + @returns [SUCCESS|FAIL] + @pre bs.Length() must be size of register data to read/write + @post For read operation, bs is modified to reflect hardware register state + @note + */ + virtual uint32_t Access(BIT_STRING_CLASS & bs, + uint64_t registerId, + Operation operation) const; + + /** + Get the handle used to pass to access (obsolite???) + @param returnes number of targethandles in TargetHandle list + @returns list of targethandles + @pre none + @post none + @note Can this be removed from the framework??? + */ + inline virtual const TARGETING::TargetHandle_t * GetChipIds(int & count) const { count = 0; return NULL;} + + bool operator==(const HomRegisterAccessScom & hrm) + { + return (hrm.iv_ptargetHandle == iv_ptargetHandle); + } + +private: // functions +private: // Data + + // maybe we should store the functionalUnitPtr instead + TARGETING::TargetHandle_t iv_ptargetHandle; + +}; + +struct ScanRingField +{ + uint64_t registerId; + uint32_t length; +}; +/** + Access Scan ring registers via the HOM + @author Doug Gilbert + @par + @code + @endcode +*/ +class HomRegisterAccessScan : public MopRegisterAccess +{ +public: + /** + Constructor + @param + @returns + @pre + @post + @see + @note + */ + HomRegisterAccessScan(TARGETING::TargetHandle_t i_ptargetHandle ,ScanRingField * start, ScanRingField * end); + inline HomRegisterAccessScan(void); + + /* + Destructor + */ + // ~HomRegisterAccessScan(); + + /** + Access the scan com register + @param BIT_STRING_CLASS - holds data read or to write + @param register address + @param [READ|WRITE] + @returns [SUCCESS|FAIL] + @pre bs.Length() must be size of register data to read/write + @post For read operation, bs is modified to reflect hardware register state + @note + */ + virtual uint32_t Access(BIT_STRING_CLASS & bs, + uint64_t registerId, + Operation operation) const; + + + /** + Get the Id(s) used to pass to access (obsolite???) + @param returnes number of targetHandle + @returns list of targetHandles + @pre none + @post none + @note Can this be removed from the framework??? + */ + inline virtual const TARGETING::TargetHandle_t * GetChipIds(int & count) const { count = 0; return NULL;} + + bool operator==(const HomRegisterAccessScan & hrm) + { + return (hrm.iv_punitHandle == iv_punitHandle); + } + +private: // functions +private: // Data + + typedef std::vector<ScanRingField> AliasIdList; + + // maybe we should store the functionalUnitPtr instead + TARGETING::TargetHandle_t iv_punitHandle; + + // list of fields to extract + AliasIdList iv_aliasIds; + +}; + + + + +inline HomRegisterAccessScom::HomRegisterAccessScom(TARGETING::TargetHandle_t i_ptargetHandle ) +: MopRegisterAccess(), iv_ptargetHandle(i_ptargetHandle ) +{} + +inline HomRegisterAccessScom::HomRegisterAccessScom() +: MopRegisterAccess(), iv_ptargetHandle(NULL) +{} + +inline HomRegisterAccessScan::HomRegisterAccessScan() +: MopRegisterAccess(),iv_punitHandle(NULL) +{} + +} // End namespace PRDF + +#endif /* PRDFHOMREGISTERACCESS_H */ diff --git a/src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H b/src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H new file mode 100755 index 000000000..266999f25 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H @@ -0,0 +1,584 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H $ */ +/* */ +/* 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 */ + +#ifndef __PRDFOPERATORREGISTER_H +#define __PRDFOPERATORREGISTER_H + +#include <algorithm> + +#include <iipscr.h> +#include <prdrCommon.H> + +class PrdfNotRegister : public SCAN_COMM_REGISTER_CLASS +{ + public: + PrdfNotRegister() : + SCAN_COMM_REGISTER_CLASS(0), iv_child(NULL), iv_iBS(0) + { + iv_bs = &iv_iBS; + } + + PrdfNotRegister(SCAN_COMM_REGISTER_CLASS & i_arg) : + SCAN_COMM_REGISTER_CLASS(0), iv_child(&i_arg), + iv_iBS(i_arg.GetBitString()->GetLength()) + { + iv_bs = &iv_iBS; + } + + PrdfNotRegister & operator=(const PrdfNotRegister & r) + { + iv_child = r.iv_child; + iv_iBS = r.iv_iBS; + //iv_bs = r.iv_bs; <-- don't do this! + return *this; + } + + virtual uint32_t Read() { return iv_child->Read(); } + virtual uint32_t Write() { return iv_child->Write(); } + + const BIT_STRING_CLASS * GetBitString( + ATTENTION_TYPE i_type = PRDF::INVALID_ATTENTION_TYPE) const + { + (*iv_bs) = ~(*iv_child->GetBitString(i_type)); + return iv_bs; + } + + virtual uint16_t GetId() const { return iv_child->GetId(); } + virtual void SetId(uint16_t i_id) {} + + bool operator==(const PrdfNotRegister & r) const + { return r.iv_child == iv_child; } + + bool operator<(const PrdfNotRegister & r) const + { return iv_child < r.iv_child; } + + bool operator>=(const PrdfNotRegister & r) const + { return iv_child >= r.iv_child; } + + protected: + BIT_STRING_CLASS & AccessBitString(void) { return iv_iBS; } + void SetBitString(const BIT_STRING_CLASS *) {} + + private: + SCAN_COMM_REGISTER_CLASS * iv_child; + + prdfBitStringBuffer * iv_bs; + prdfBitStringBuffer iv_iBS; +}; + +class PrdfLeftShiftRegister : public SCAN_COMM_REGISTER_CLASS +{ + public: + PrdfLeftShiftRegister() : + SCAN_COMM_REGISTER_CLASS(0), iv_child(NULL), iv_amount(0), iv_iBS(0) + { + iv_bs = &iv_iBS; + } + + PrdfLeftShiftRegister(SCAN_COMM_REGISTER_CLASS & i_arg, uint16_t i_amount) : + SCAN_COMM_REGISTER_CLASS(0), iv_child(&i_arg), iv_amount(i_amount), + iv_iBS(i_arg.GetBitString()->GetLength()) + { + iv_bs = &iv_iBS; + } + + PrdfLeftShiftRegister & operator=(const PrdfLeftShiftRegister & r) + { + iv_child = r.iv_child; + iv_amount = r.iv_amount; + iv_iBS = r.iv_iBS; + //iv_bs = r.iv_bs; <-- don't do this! + return *this; + } + + virtual uint32_t Read() { return iv_child->Read(); } + virtual uint32_t Write() { return iv_child->Write(); } + + const BIT_STRING_CLASS * GetBitString( + ATTENTION_TYPE i_type = PRDF::INVALID_ATTENTION_TYPE) const + { + (*iv_bs) = (*iv_child->GetBitString(i_type)) << iv_amount; + return iv_bs; + } + + virtual uint16_t GetId() const { return iv_child->GetId(); } + virtual void SetId(uint16_t i_id) {} + + bool operator==(const PrdfLeftShiftRegister & r) const + { return (r.iv_child == iv_child) && (r.iv_amount == iv_amount); } + + bool operator<(const PrdfLeftShiftRegister & r) const + { + if (iv_child == r.iv_child) + return iv_amount < r.iv_amount; + return iv_child < r.iv_child; + } + + bool operator>=(const PrdfLeftShiftRegister & r) const + { + if (iv_child == r.iv_child) + return iv_amount >= r.iv_amount; + return iv_child >= r.iv_child; + } + + protected: + BIT_STRING_CLASS & AccessBitString(void) { return iv_iBS; } + void SetBitString(const BIT_STRING_CLASS *) {} + + private: + SCAN_COMM_REGISTER_CLASS * iv_child; + uint16_t iv_amount; + + prdfBitStringBuffer * iv_bs; + prdfBitStringBuffer iv_iBS; +}; + +class PrdfRightShiftRegister : public SCAN_COMM_REGISTER_CLASS +{ + public: + PrdfRightShiftRegister() : + SCAN_COMM_REGISTER_CLASS(0), iv_child(NULL), iv_amount(0), iv_iBS(0) + { + iv_bs = &iv_iBS; + } + + PrdfRightShiftRegister(SCAN_COMM_REGISTER_CLASS & i_arg, + uint16_t i_amount) : + SCAN_COMM_REGISTER_CLASS(0), iv_child(&i_arg), iv_amount(i_amount), + iv_iBS(i_arg.GetBitString()->GetLength()) + { + iv_bs = &iv_iBS; + } + + PrdfRightShiftRegister & operator=(const PrdfRightShiftRegister & r) + { + iv_child = r.iv_child; + iv_amount = r.iv_amount; + iv_iBS = r.iv_iBS; + //iv_bs = r.iv_bs; <-- don't do this! + return *this; + } + + virtual uint32_t Read() { return iv_child->Read(); } + virtual uint32_t Write() { return iv_child->Write(); } + + const BIT_STRING_CLASS * GetBitString( + ATTENTION_TYPE i_type = PRDF::INVALID_ATTENTION_TYPE) const + { + (*iv_bs) = (*iv_child->GetBitString(i_type)) >> iv_amount; + return iv_bs; + } + + virtual uint16_t GetId() const { return iv_child->GetId(); } + virtual void SetId(uint16_t i_id) {} + + bool operator==(const PrdfRightShiftRegister & r) const + { return (r.iv_child == iv_child) && (r.iv_amount == iv_amount); } + + bool operator<(const PrdfRightShiftRegister & r) const + { + if (iv_child == r.iv_child) + return iv_amount < r.iv_amount; + return iv_child < r.iv_child; + } + + bool operator>=(const PrdfRightShiftRegister & r) const + { + if (iv_child == r.iv_child) + return iv_amount >= r.iv_amount; + return iv_child >= r.iv_child; + } + + protected: + BIT_STRING_CLASS & AccessBitString(void) { return iv_iBS; } + void SetBitString(const BIT_STRING_CLASS *) {} + + private: + SCAN_COMM_REGISTER_CLASS * iv_child; + uint16_t iv_amount; + + prdfBitStringBuffer * iv_bs; + prdfBitStringBuffer iv_iBS; +}; + + +class PrdfAndRegister : public SCAN_COMM_REGISTER_CLASS +{ + public: + PrdfAndRegister() : + SCAN_COMM_REGISTER_CLASS(0), iv_left(NULL), iv_right(NULL), iv_iBS(0) + { + iv_bs = &iv_iBS; + } + + PrdfAndRegister(SCAN_COMM_REGISTER_CLASS & i_left, + SCAN_COMM_REGISTER_CLASS & i_right) : + SCAN_COMM_REGISTER_CLASS(0), iv_left(&i_left), iv_right(&i_right), + iv_iBS(std::min(i_left.GetBitString()->GetLength(), + i_right.GetBitString()->GetLength())) + { + iv_bs = &iv_iBS; + } + + PrdfAndRegister & operator=(const PrdfAndRegister & r) + { + iv_left = r.iv_left; + iv_right = r.iv_right; + iv_iBS = r.iv_iBS; + //iv_bs = r.iv_bs; <-- don't do this! + return *this; + } + + virtual uint32_t Read() + { + return iv_left->Read() | iv_right->Read(); + } + virtual uint32_t Write() + { + return iv_left->Write() | iv_right->Write(); + } + + const BIT_STRING_CLASS * GetBitString( + ATTENTION_TYPE i_type = PRDF::INVALID_ATTENTION_TYPE) const + { + (*iv_bs) = *iv_left->GetBitString(i_type); + (*iv_bs) = (*iv_bs) & (*iv_right->GetBitString(i_type)); + return iv_bs; + } + + virtual uint16_t GetId() const + { + return Prdr::PrdrSignatureOp::combineSig(iv_left->GetId(), + iv_right->GetId()); + } + + virtual void SetId(uint16_t i_id) {} + + bool operator==(const PrdfAndRegister & r) const + { return (r.iv_left == iv_left) && (r.iv_right == iv_right); } + + bool operator<(const PrdfAndRegister & r) const + { + if (iv_left == r.iv_left) + return iv_right < r.iv_right; + return iv_left < r.iv_left; + } + + bool operator>=(const PrdfAndRegister & r) const + { + if (iv_left == r.iv_left) + return iv_right >= r.iv_right; + return iv_left >= r.iv_left; + } + + protected: + BIT_STRING_CLASS & AccessBitString(void) { return iv_iBS; } + void SetBitString(const BIT_STRING_CLASS *) {} + + private: + SCAN_COMM_REGISTER_CLASS * iv_left; + SCAN_COMM_REGISTER_CLASS * iv_right; + + prdfBitStringBuffer * iv_bs; + prdfBitStringBuffer iv_iBS; +}; + +class PrdfOrRegister : public SCAN_COMM_REGISTER_CLASS +{ + public: + PrdfOrRegister() : + SCAN_COMM_REGISTER_CLASS(0), iv_left(NULL), iv_right(NULL), iv_iBS(0) + { + iv_bs = &iv_iBS; + } + + PrdfOrRegister(SCAN_COMM_REGISTER_CLASS & i_left, + SCAN_COMM_REGISTER_CLASS & i_right) : + SCAN_COMM_REGISTER_CLASS(0), iv_left(&i_left), iv_right(&i_right), + iv_iBS(std::min(i_left.GetBitString()->GetLength(), + i_right.GetBitString()->GetLength())) + { + iv_bs = &iv_iBS; + } + + PrdfOrRegister & operator=(const PrdfOrRegister & r) + { + iv_left = r.iv_left; + iv_right = r.iv_right; + iv_iBS = r.iv_iBS; + //iv_bs = r.iv_bs; <-- don't do this! + return *this; + } + + virtual uint32_t Read() + { + return iv_left->Read() | iv_right->Read(); + } + virtual uint32_t Write() + { + return iv_left->Write() | iv_right->Write(); + } + + const BIT_STRING_CLASS * GetBitString( + ATTENTION_TYPE i_type = PRDF::INVALID_ATTENTION_TYPE) const + { + (*iv_bs) = *iv_left->GetBitString(i_type); + (*iv_bs) = (*iv_bs) | (*iv_right->GetBitString(i_type)); + return iv_bs; + } + + virtual uint16_t GetId() const + { + return Prdr::PrdrSignatureOp::combineSig(iv_left->GetId(), + iv_right->GetId()); + } + + virtual void SetId(uint16_t i_id) {} + + bool operator==(const PrdfOrRegister & r) const + { return (r.iv_left == iv_left) && (r.iv_right == iv_right); } + + bool operator<(const PrdfOrRegister & r) const + { + if (iv_left == r.iv_left) + return iv_right < r.iv_right; + return iv_left < r.iv_left; + } + + bool operator>=(const PrdfOrRegister & r) const + { + if (iv_left == r.iv_left) + return iv_right >= r.iv_right; + return iv_left >= r.iv_left; + } + + protected: + BIT_STRING_CLASS & AccessBitString(void) { return iv_iBS; } + void SetBitString(const BIT_STRING_CLASS *) {} + + private: + SCAN_COMM_REGISTER_CLASS * iv_left; + SCAN_COMM_REGISTER_CLASS * iv_right; + + prdfBitStringBuffer * iv_bs; + prdfBitStringBuffer iv_iBS; +}; + +class PrdfNullRegister : public SCAN_COMM_REGISTER_CLASS +{ + public: + PrdfNullRegister(int size) : + SCAN_COMM_REGISTER_CLASS(0), iv_iBS(size) + {} + + PrdfNullRegister & operator=(const PrdfNullRegister & r) + { + iv_iBS = r.iv_iBS; + return *this; + } + + virtual uint32_t Read() { return 0; } + virtual uint32_t Write() { return 0; } + + const BIT_STRING_CLASS * GetBitString( + ATTENTION_TYPE i_type = PRDF::INVALID_ATTENTION_TYPE) const + { + return &iv_iBS; + } + + protected: + BIT_STRING_CLASS & AccessBitString(void) { return iv_iBS; } + void SetBitString(const BIT_STRING_CLASS *) {} + + private: + prdfBitStringBuffer iv_iBS; + + virtual uint16_t GetId() const + { return Prdr::PrdrSignatureOp::DEFAULT_SIGNATURE; } + + virtual void SetId(uint16_t i_id) {} + +}; + +class PrdfAttnTypeRegister : public SCAN_COMM_REGISTER_CLASS +{ + public: + PrdfAttnTypeRegister() : + SCAN_COMM_REGISTER_CLASS(0), iv_check(&cv_null), iv_recov(&cv_null), + iv_special(&cv_null), iv_proccs(&cv_null), iv_iBS(0) + { + iv_bs = &iv_iBS; + } + + PrdfAttnTypeRegister( SCAN_COMM_REGISTER_CLASS & i_check, + SCAN_COMM_REGISTER_CLASS & i_recov, + SCAN_COMM_REGISTER_CLASS & i_special, + SCAN_COMM_REGISTER_CLASS & i_proccs ) : + SCAN_COMM_REGISTER_CLASS(0), + iv_check( NULL == &i_check ? &cv_null : &i_check), + iv_recov( NULL == &i_recov ? &cv_null : &i_recov), + iv_special(NULL == &i_special ? &cv_null : &i_special), + iv_proccs( NULL == &i_proccs ? &cv_null : &i_proccs), + iv_iBS(0) // will fully initialize this inside ctor. + { + uint32_t l_length = 1024; + l_length = std::min(l_length, iv_check->GetBitString()->GetLength()); + l_length = std::min(l_length, iv_recov->GetBitString()->GetLength()); + l_length = std::min(l_length, iv_special->GetBitString()->GetLength()); + l_length = std::min(l_length, iv_proccs->GetBitString()->GetLength()); + iv_iBS = prdfBitStringBuffer(l_length); + iv_bs = &iv_iBS; + } + + PrdfAttnTypeRegister & operator=(const PrdfAttnTypeRegister & r) + { + //iv_null = r.iv_null; <-- don't do this! + iv_check = (r.iv_check == &r.cv_null ? &cv_null : r.iv_check); + iv_recov = (r.iv_recov == &r.cv_null ? &cv_null : r.iv_recov); + iv_special = (r.iv_special == &r.cv_null ? &cv_null : r.iv_special); + iv_proccs = (r.iv_proccs == &r.cv_null ? &cv_null : r.iv_proccs); + iv_iBS = r.iv_iBS; + //iv_bs = r.iv_bs; <-- don't do this! + return *this; + } + + virtual uint32_t Read() + { + return iv_check->Read() | iv_recov->Read() | + iv_special->Read() | iv_proccs->Read(); + } + + virtual uint32_t Write() + { + return iv_check->Write() | iv_recov->Write() | + iv_special->Write() | iv_proccs->Write(); + } + + const BIT_STRING_CLASS * GetBitString( + ATTENTION_TYPE i_type = PRDF::INVALID_ATTENTION_TYPE) const + { + using namespace PRDF; + switch (i_type) + { + case CHECK_STOP: + (*iv_bs) = BIT_STRING_BUFFER_CLASS( + *iv_check->GetBitString(i_type)); + break; + + case RECOVERABLE: + (*iv_bs) = BIT_STRING_BUFFER_CLASS( + *iv_recov->GetBitString(i_type)); + break; + + case SPECIAL: + (*iv_bs) = BIT_STRING_BUFFER_CLASS( + *iv_special->GetBitString(i_type)); + break; + + case PROC_CS: + (*iv_bs) = BIT_STRING_BUFFER_CLASS( + *iv_proccs->GetBitString(i_type)); + break; + } + + return iv_bs; + } + + virtual uint16_t GetId() const + { + using Prdr::PrdrSignatureOp; + uint16_t l_rc = PrdrSignatureOp::DEFAULT_SIGNATURE; + l_rc = PrdrSignatureOp::combineSig(l_rc, iv_check->GetId()); + l_rc = PrdrSignatureOp::combineSig(l_rc, iv_recov->GetId()); + l_rc = PrdrSignatureOp::combineSig(l_rc, iv_special->GetId()); + l_rc = PrdrSignatureOp::combineSig(l_rc, iv_proccs->GetId()); + return l_rc; + } + + virtual void SetId(uint16_t i_id) {} + + bool operator==(const PrdfAttnTypeRegister & r) const + { + return (r.iv_check == iv_check) && (r.iv_recov == iv_recov) && + (r.iv_special == iv_special) && (r.iv_proccs == iv_proccs); + } + + protected: + BIT_STRING_CLASS & AccessBitString(void) { return iv_iBS; } + void SetBitString(const BIT_STRING_CLASS *) {} + + private: + static PrdfNullRegister cv_null; + + SCAN_COMM_REGISTER_CLASS * iv_check; + SCAN_COMM_REGISTER_CLASS * iv_recov; + SCAN_COMM_REGISTER_CLASS * iv_special; + SCAN_COMM_REGISTER_CLASS * iv_proccs; + + prdfBitStringBuffer * iv_bs; + prdfBitStringBuffer iv_iBS; +}; + +class PrdfConstantRegister : public SCAN_COMM_REGISTER_CLASS +{ + public: + PrdfConstantRegister() : + SCAN_COMM_REGISTER_CLASS(0), iv_iBS(0) + {} + + PrdfConstantRegister(BIT_STRING_CLASS i_arg) : + SCAN_COMM_REGISTER_CLASS(0), iv_iBS(i_arg) + {} + + PrdfConstantRegister & operator=(const PrdfConstantRegister & r) + { + iv_iBS = r.iv_iBS; + return *this; + } + + virtual uint32_t Read() { return SUCCESS; } + virtual uint32_t Write() { return SUCCESS; } + + const BIT_STRING_CLASS * GetBitString( + ATTENTION_TYPE i_type = PRDF::INVALID_ATTENTION_TYPE) const + { + return &iv_iBS; + } + + virtual uint16_t GetId() const + { return Prdr::PrdrSignatureOp::DEFAULT_SIGNATURE; } + + virtual void SetId(uint16_t i_id) {} + + bool operator==(const PrdfConstantRegister & r) const + { return r.iv_iBS == iv_iBS; } + + protected: + BIT_STRING_CLASS & AccessBitString(void) { return iv_iBS; } + void SetBitString(const BIT_STRING_CLASS *) {} + + private: + prdfBitStringBuffer iv_iBS; +}; + +#endif diff --git a/src/usr/diag/prdf/common/framework/register/prdfResetErrorRegister.C b/src/usr/diag/prdf/common/framework/register/prdfResetErrorRegister.C new file mode 100755 index 000000000..0f0a6deec --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfResetErrorRegister.C @@ -0,0 +1,199 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfResetErrorRegister.C $ */ +/* */ +/* 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 */ + +/** + @file iipResetErrorRegister.C + @brief ResetErrorRegister class definition +*/ + +// Module Description ************************************************** +// +// Description: +// +// End Module Description ********************************************** +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define iipResetErrorRegister_C + +#include <iipscr.h> +#include <iipResetErrorRegister.h> +#include <iipXorResetErrorRegister.h> +#include <xspprdAndResetErrorRegister.h> +#include <iipServiceDataCollector.h> + +#ifndef __HOSTBOOT_MODULE + #include <prdfSdcFileControl.H> // for SyncAnalysis +#endif + +#undef iipResetErrorRegister_C +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- +int32_t ResetErrorRegister::Reset(const prdfBitKey & bit_list, + STEP_CODE_DATA_STRUCT & error) +{ + #ifndef __HOSTBOOT_MODULE + ServiceDataCollector & sdc = *(error.service_data); + SyncAnalysis (sdc); //Add call to Sync SDC + #endif + + int32_t rc = ErrorRegisterMask::Reset(bit_list,error); // set mask bits & undo filters + uint32_t bl_length = bit_list.size(); + + if(bl_length != 0) // Check for bits to reset + { + if(&scr != resetScr) // reset different then ereg scr - move bits + { + resetScr->SetBitString(scr.GetBitString()); + } + uint32_t i; + for(i = 0; i < bl_length; ++i) // Turn off all bits specified + { + resetScr->ClearBit(bit_list.getListValue(i)); + } + rc = resetScr->Write(); // Write hardware + } + return rc; +} + +// Reset and Mask error registers. +int32_t +ResetAndMaskErrorRegister::Reset(const prdfBitKey & bit_list, + STEP_CODE_DATA_STRUCT & error) +{ + using namespace PRDF; + int32_t rc = SUCCESS; + // Don't do reset on CS. + if ((CHECK_STOP != error.service_data->GetAttentionType()) && //@pw01 + (UNIT_CS != error.service_data->GetAttentionType()) && + (UNIT_CS != error.service_data->GetCauseAttentionType())) + { + #ifndef __HOSTBOOT_MODULE + ServiceDataCollector & sdc = *(error.service_data); + SyncAnalysis (sdc); //Add call to Sync SDC + #endif + + rc = ErrorRegisterMask::Reset(bit_list,error); //undo filters + + // Mask registers as needed, if at threshold. + if (error.service_data->IsAtThreshold()) + { + for (ResetRegisterVector::iterator i = cv_masks.begin(); + i != cv_masks.end(); + ++i) + { + rc |= i->op->Reset(bit_list, error, i->read, i->write); + } + } + + // Reset registers as needed. + for (ResetRegisterVector::iterator i = cv_resets.begin(); + i != cv_resets.end(); + ++i) + { + rc |= i->op->Reset(bit_list, error, i->read, i->write); + } + } + + return rc; +} + +// ---------------------------------------------------------------------- + +int32_t XorResetErrorRegister::Reset(const prdfBitKey & bit_list, + STEP_CODE_DATA_STRUCT & error) +{ + #ifndef __HOSTBOOT_MODULE + ServiceDataCollector & sdc = *(error.service_data); + SyncAnalysis (sdc); + #endif + + int32_t rc = ErrorRegisterMask::Reset(bit_list,error); // set mask bits and undo filters + uint32_t bl_length = bit_list.size(); + + if(bl_length != 0) // Check for bits to reset + { + scr.clearAllBits(); + + // Turn on all bits to be reset + // We acted on all bits in bit_list so they should all be on + // in the hdw register + uint32_t i; + for(i = 0; i < bl_length; ++i) // Turn on bits to be reset + { + scr.SetBit(bit_list.getListValue(i)); + } + rc = scr.Write(); // Write hardware + } + return rc; +} + +// ----------------------------------------------------------------------- + +int32_t AndResetErrorRegister::Reset(const prdfBitKey & bit_list, + STEP_CODE_DATA_STRUCT & error) +{ + #ifndef __HOSTBOOT_MODULE + ServiceDataCollector & sdc = *(error.service_data); + SyncAnalysis (sdc); + #endif + + // set internal mask bits if threshold + int32_t rc = ErrorRegisterMask::Reset(bit_list,error); // set mask bits and undo filters + + uint32_t bl_length = bit_list.size(); + if(bl_length !=0) + { + BIT_STRING_BUFFER_CLASS bs(xAndResetScr.GetBitLength()); + bs.Pattern(0xffffffff,32); // set to all ones + uint32_t i; + for(i = 0; i < bl_length; ++i) // Turn off all bits used to isolate problem + { + bs.Clear(bit_list.getListValue(i)); + } + xAndResetScr.SetBitString(&bs); // copy bs to SCR bit string + rc = xAndResetScr.Write(); // Write hardware (result = Hareware value ANDed with bs) + } + return rc; +} diff --git a/src/usr/diag/prdf/common/framework/register/prdfResetOperators.H b/src/usr/diag/prdf/common/framework/register/prdfResetOperators.H new file mode 100755 index 000000000..cd6985831 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfResetOperators.H @@ -0,0 +1,330 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfResetOperators.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2005,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 prdfResetOperators.H + * Operator classes for enacting different reset and mask policies on a + * register set. + * + * Defines RegisterResetOperator base class and a number of derived types. + */ + +#ifndef __PRDFRESETOPERATORS_H +#define __PRDFRESETOPERATORS_H + +#include <prdfBitKey.H> +#include <iipscr.h> +#include <iipconst.h> + +/** + * @class RegisterResetOperator + * Interface class for reset operators. (pure virtual) + * + * Provides a single interface, the reset "operator". These operators are used + * to enact specific reset or mask policies onto a register read/write pair. + */ +class RegisterResetOperator +{ + public: + virtual ~RegisterResetOperator() { } // zs01 + + /** + * Reset Operator + * + * @param bl : Bit list of registers to reset. + * @param sdc : The current STEP_CODE information. + * @param readReg : The ScanCOMM register to read bits from. + * @param writeReg : The ScanCOMM register to update with reset/mask. + */ + virtual + int32_t Reset(const BIT_LIST_CLASS & bl, + STEP_CODE_DATA_STRUCT & sdc, + SCAN_COMM_REGISTER_CLASS * readReg, + SCAN_COMM_REGISTER_CLASS * writeReg) const = 0; +}; + +/** + * @enum ResetOperatorBehaviors + * Useful enum for defining operator templates which behave only slightly + * different between masking and reseting. + * + * By using these enum types as parameters to the template (a bool) it makes + * the template instantiation more understandable. + */ +enum ResetOperatorBehaviors + { + RESETOPERATOR_MASK = true, + RESETOPERATOR_RESET = false + }; + +/** + * @fn getStaticResetOperator + * Returns a pointer to a static reset operator of requested type. + * + * Example usage: + * getStaticResetOperator<OrOperator<RESETOPERATOR_MASK> >() will return + * a pointer to an Or-type operator which does masking (sets bits). + */ +template <class T> +T * getStaticResetOperator() { static T l_op; return &l_op; }; + +/** + * @class OrOperator + * Implements the 'or' behavior of a reset/mask operator. + * + * Template parameter determines if reset or mask. + * + * Behavior: + * Reset - + * Read old bits. + * Remove "reset" bits. + * Write result. + * Mask - + * Write "mask" bits. + */ +template <bool> class OrOperator; +// Typedefs for easier instantiation. +typedef OrOperator<RESETOPERATOR_MASK> OrMaskOperator; +typedef OrOperator<RESETOPERATOR_RESET> OrResetOperator; + +// Class definition +template <bool Type> +class OrOperator : public RegisterResetOperator +{ + int32_t Reset(const BIT_LIST_CLASS & bl, + STEP_CODE_DATA_STRUCT & sdc, + SCAN_COMM_REGISTER_CLASS * readReg, + SCAN_COMM_REGISTER_CLASS * writeReg) const + { + int32_t rc = SUCCESS; + + uint32_t bl_length = bl.size(); + + if(bl_length != 0) // Check for bits to reset + { + writeReg->clearAllBits(); + + if (RESETOPERATOR_RESET == Type) + { + // Make sure this register was read. (TODO: is this needed?) + readReg->Read(); + + if(readReg != writeReg) // read different than write, move bits. + { + writeReg->SetBitString(readReg->GetBitString()); + } + } + uint32_t i; + for(i = 0; i < bl_length; ++i) // Turn off all bits specified + { + if (RESETOPERATOR_MASK == Type) + writeReg->SetBit(bl.getListValue(i)); + else + writeReg->ClearBit(bl.getListValue(i)); + } + rc = writeReg->Write(); // Write hardware + } + return rc; + } +}; + +/** + * @class AndOperator + * Implements the 'and' behavior of a reset/mask operator. + * + * Template parameter determines if reset or mask. + * + * Behavior: + * Reset - + * Write not of bits. + * Mask - + * Read mask register. + * Set bits. + * Write mask register. + */ +template <bool> class AndOperator; +// Typedefs for easier instantiation. +typedef AndOperator<RESETOPERATOR_MASK> AndMaskOperator; +typedef AndOperator<RESETOPERATOR_RESET> AndResetOperator; + +// Class definition +template <bool Type> +class AndOperator : public RegisterResetOperator +{ + int32_t Reset(const BIT_LIST_CLASS & bl, + STEP_CODE_DATA_STRUCT & sdc, + SCAN_COMM_REGISTER_CLASS * readReg, + SCAN_COMM_REGISTER_CLASS * writeReg) const + { + int32_t rc = SUCCESS; + uint32_t bl_length = bl.size(); + + if (RESETOPERATOR_RESET == Type) + { + if(bl_length != 0) // Check for bits to reset + { + BIT_STRING_BUFFER_CLASS bs(writeReg->GetBitLength()); + bs.Pattern(0xffffffff, 32); // set all to 1's. + + uint32_t i; + for(i = 0; i < bl_length; ++i) // Turn off all bits specified + { + bs.Clear(bl.getListValue(i)); + } + writeReg->SetBitString(&bs); // Copy bit-string to register. + rc = writeReg->Write(); // Write hardware + } + } + else // RESETOPERATOR_MASK + { + // Make sure this register was read. (TODO: is this needed?) + readReg->Read(); + + if(readReg != writeReg) // read different than write, move bits. + { + writeReg->SetBitString(readReg->GetBitString()); + } + for(uint32_t i = 0; i < bl_length; ++i) + { + writeReg->SetBit(bl.getListValue(i)); + } + + rc = writeReg->Write(); + } + return rc; + } +}; + + +/** + * @class XorOperator + * Implements the 'xor' behavior of a reset/mask operator. + * + * Template parameter determines if reset or mask. + * + * Behavior: + * Reset - Write bit. + * Mask - Clear bit. + */ +template <bool> class XorOperator; +// Typedefs for easier instantiation. +typedef XorOperator<RESETOPERATOR_MASK> XorMaskOperator; +typedef XorOperator<RESETOPERATOR_RESET> XorResetOperator; + +// Class definition +template <bool Type> +class XorOperator : public RegisterResetOperator +{ + int32_t Reset(const BIT_LIST_CLASS & bl, + STEP_CODE_DATA_STRUCT & sdc, + SCAN_COMM_REGISTER_CLASS * readReg, + SCAN_COMM_REGISTER_CLASS * writeReg) const + { + int32_t rc = SUCCESS; + uint32_t bl_length = bl.size(); + + if (RESETOPERATOR_RESET == Type) + { + writeReg->clearAllBits(); + + for (uint32_t i = 0; i < bl_length; ++i) + writeReg->SetBit(bl.getListValue(i)); + + rc = writeReg->Write(); + } + else // RESETOPERATOR_MASK + { + // Make sure this register was read. (TODO: is this needed?) + readReg->Read(); + + if(readReg != writeReg) // read different than write, move bits. + { + writeReg->SetBitString(readReg->GetBitString()); + } + for(uint32_t i = 0; i < bl_length; ++i) + { + writeReg->ClearBit(bl.getListValue(i)); + } + + rc = writeReg->Write(); + + } + return rc; + } +}; + +/** + * @class NotOperator + * Implements the 'not' behavior of a reset/mask operator. + * + * Template parameter determines if reset or mask. + * + * Behavior: + * Reset - Clears all bits. + * Mask - Sets all bits. + */ +template <bool> class NotOperator; +// Typedefs for easier instantiation. +typedef NotOperator<RESETOPERATOR_MASK> NotMaskOperator; +typedef NotOperator<RESETOPERATOR_RESET> NotResetOperator; + +// Class definition +template <bool Type> +class NotOperator : public RegisterResetOperator +{ + int32_t Reset(const BIT_LIST_CLASS & bl, + STEP_CODE_DATA_STRUCT & sdc, + SCAN_COMM_REGISTER_CLASS * readReg, + SCAN_COMM_REGISTER_CLASS * writeReg) const + { + int32_t rc = SUCCESS; + + if (RESETOPERATOR_RESET == Type) + { + writeReg->clearAllBits(); + rc = writeReg->Write(); // Write hardware + } + else // RESETOPERATOR_MASK + { + BIT_STRING_BUFFER_CLASS bs(writeReg->GetBitLength()); + bs.Pattern(0xffffffff, 32); // set all to 1's. + writeReg->SetBitString(&bs); // Copy bit-string to register. + rc = writeReg->Write(); // Write hardware + } + return rc; + } +}; + + +#endif + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// F510901 f300 07/15/05 iawillia Initial file creation. +// F523598 f300 10/04/05 iawillia Add AndOperator. Fix Or. +// F537132 f300 02/20/06 iawillia Add RMW mask register. +// F545881 f300 04/19/06 dgilbert Add #include <iipscr.h> +// zs01 D620028 f330 07/25/07 zshelle Support for mcp5 compiler +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/register/prdfScanFacility.C b/src/usr/diag/prdf/common/framework/register/prdfScanFacility.C new file mode 100755 index 000000000..5228f9a87 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfScanFacility.C @@ -0,0 +1,179 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfScanFacility.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 prdfScanFacility.C + @brief PRD ScanFaclity class definition +*/ +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define prdfScanFacility_C + +#include <iipscr.h> +#include <prdfScanFacility.H> +#include <prdfFlyWeight.C> +#include <prdfFlyWeightS.C> + +#undef prdfScanFacility_C + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- +// special comparater - if address same and pointing to same access module then are equal +bool operator==(const ScanCommRegisterChip & scrc1, const ScanCommRegisterChip & scrc2) +{ + return((scrc1.GetAddress() == scrc2.GetAddress()) && (&(scrc1.GetHops()) == &(scrc2.GetHops()))); +} + +bool operator>=(const ScanCommRegisterChip & scrc1, const ScanCommRegisterChip & scrc2) +{ + if (scrc1.GetAddress() == scrc2.GetAddress()) + return (&scrc1.GetHops()) >= (&scrc2.GetHops()); + return scrc1.GetAddress() >= scrc2.GetAddress(); +}; + +bool operator<(const ScanCommRegisterChip & scrc1, const ScanCommRegisterChip & scrc2) +{ + if (scrc1.GetAddress() == scrc2.GetAddress()) + return (&scrc1.GetHops()) < (&scrc2.GetHops()); + return scrc1.GetAddress() < scrc2.GetAddress(); +} + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- +PrdfNullRegister PrdfAttnTypeRegister::cv_null(1024); //@01 + + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +class ScanCommAccess; +class ScanCommRegisters; + +ScanFacility & ScanFacility::Access(void) +{ + static ScanFacility sf; + return sf; +} +//------------------------------------------------------------------------------------------------- +SCAN_COMM_REGISTER_CLASS & ScanFacility::GetScanCommRegister(TARGETING::TargetHandle_t i_ptargetHandle, + uint64_t address, + uint32_t bitLength) +{ + using namespace PRDF; + HomRegisterAccessScom hraKey(i_ptargetHandle); + HomRegisterAccessScom & hra = iv_scomAccessFw.get(hraKey); + ScanCommRegisterChip scrKey(address,bitLength,hra); + return iv_scomRegFw.get(scrKey); +} +//------------------------------------------------------------------------------------------------- +SCAN_COMM_REGISTER_CLASS & ScanFacility::GetScanRingRegister(TARGETING::TargetHandle_t i_ptargetHandle, + PRDF::ScanRingField * start, + PRDF::ScanRingField * end) +{ + using namespace PRDF; + uint32_t bitLength = 0; + for(ScanRingField * srf = start; srf != end; ++srf) + { + bitLength += srf->length; + } + HomRegisterAccessScan hra(i_ptargetHandle,start,end); + iv_scanAccessList.push_back(hra); + ScanCommRegisterChip scrKey(start->registerId,bitLength,hra); + return iv_scomRegFw.get(scrKey); +} + +//------------------------------------------------------------------------------------------------- + +SCAN_COMM_REGISTER_CLASS & ScanFacility::GetNotRegister(SCAN_COMM_REGISTER_CLASS & i_arg) +{ + PrdfNotRegister r(i_arg); + return iv_notRegFw.get(r); +} + +//------------------------------------------------------------------------------------------------- + +SCAN_COMM_REGISTER_CLASS & ScanFacility::GetLeftShiftRegister(SCAN_COMM_REGISTER_CLASS & i_arg, uint16_t i_amount) +{ + PrdfLeftShiftRegister r(i_arg, i_amount); + return iv_leftRegFw.get(r); +} + +//------------------------------------------------------------------------------------------------- + +SCAN_COMM_REGISTER_CLASS & ScanFacility::GetRightShiftRegister(SCAN_COMM_REGISTER_CLASS & i_arg, uint16_t i_amount) +{ + PrdfRightShiftRegister r(i_arg, i_amount); + return iv_rightRegFw.get(r); +} + + +//------------------------------------------------------------------------------------------------- + +SCAN_COMM_REGISTER_CLASS & ScanFacility::GetAndRegister(SCAN_COMM_REGISTER_CLASS & i_left, + SCAN_COMM_REGISTER_CLASS & i_right) +{ + PrdfAndRegister r(i_left,i_right); + return iv_andRegFw.get(r); +} + +//------------------------------------------------------------------------------------------------- + +SCAN_COMM_REGISTER_CLASS & ScanFacility::GetOrRegister(SCAN_COMM_REGISTER_CLASS & i_left, + SCAN_COMM_REGISTER_CLASS & i_right) +{ + PrdfOrRegister r(i_left,i_right); + return iv_orRegFw.get(r); +} + +//------------------------------------------------------------------------------------------------- + +SCAN_COMM_REGISTER_CLASS & ScanFacility::GetAttnTypeRegister(SCAN_COMM_REGISTER_CLASS & i_check, + SCAN_COMM_REGISTER_CLASS & i_recov, + SCAN_COMM_REGISTER_CLASS & i_special, + SCAN_COMM_REGISTER_CLASS & i_proccs) +{ + PrdfAttnTypeRegister r(i_check,i_recov,i_special,i_proccs); + return iv_attnRegFw.get(r); +} + +//------------------------------------------------------------------------------------------------- + +SCAN_COMM_REGISTER_CLASS & ScanFacility::GetConstantRegister(BIT_STRING_CLASS i_val) +{ + PrdfConstantRegister r(i_val); + return iv_constRegFw.get(r); +} + +//------------------------------------------------------------------------------------------------- diff --git a/src/usr/diag/prdf/common/framework/register/prdfScanFacility.H b/src/usr/diag/prdf/common/framework/register/prdfScanFacility.H new file mode 100755 index 000000000..58e711b08 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfScanFacility.H @@ -0,0 +1,203 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfScanFacility.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 PRDFSCANFACILITY_H +#define PRDFSCANFACILITY_H +/** + @file prdfScanFacility.H + @brief Description +*/ + + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#include <prdfFlyWeight.H> +#include <prdfFlyWeightS.H> +#include <vector> +#include <prdfHomRegisterAccess.H> +#include <iipScanCommRegisterChip.h> +#include <prdfOperatorRegister.H> +#include <prdfPlatServices.H> + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +class SCAN_COMM_REGISTER_CLASS; + +/** + PRD Scan Facility + @author Doug Gilbert + @par The Scan facility is used by PRD to access Scan and Scan Comm functions. + It attempts to reduce duplicate objects and their aggragates as must as possible. + @code + ScanFacility & sf = ScanFacility::Access(); + SCAN_COMM_REGISTER_CLASS & scr = sf.GetScanCommRegister(chipId,Address,bitLen); + scr.Read() ... see iipscr.h + ScanRingField srf[] = + {{hregAliasId1 , fieldBitLength1}, + {hregAliasId2 , fieldBitLength2}}; + SCAN_COMM_REGISTER_CLASS & sr = s.GetScanRingRegister(aTARGETING::TargetHandle_t,srf,srf+2); + scr.Read() .... SCAN_COMM_REGISTER_CLASS + // Note you can't write a scan ring register from PRD + // you can only read scan ring registers from PRD if the global attention type is CHECK_STOP + @endcode +*/ +class ScanFacility +{ +public: + /** + The Scan Facility is a singleton - this function provides access to it. + */ + static ScanFacility & Access(void); + + /** + Get a scan comm register for this functional unit + @param Target Handle see target.H + @param scan comm address + @param number of bits in the register + @pre Address of register must correspond to the functional unit indicated + @post If the scr does not yet exist it will be created otherwise a reference + to one already in existance (same address and functional unit) is returned. + */ + SCAN_COMM_REGISTER_CLASS & GetScanCommRegister(TARGETING::TargetHandle_t i_ptargetHandle, + uint64_t address, + uint32_t bitLength); + + /** + Get a scan ring register + @param i_ptargetHandle handle to target in targeting + @param pointer to list an array of ScanRingField see prdfHomRegisterAccess.H + @param pointer to last entry+1 of ScanFingField array + @pre AliasId's for the scan ring registers MUST exist in the function unit associated with the Id given + @post Access object and scr created for this register. the bit length of the scr returned will be the sum + of all the field lengths provided. + @note an SCR based on a scan ring register can not be written, and should only be read if the global + attention type is CHECK_STOP. + */ + SCAN_COMM_REGISTER_CLASS & GetScanRingRegister(TARGETING::TargetHandle_t i_ptargetHandle, + PRDF::ScanRingField * start, + PRDF::ScanRingField * end); + + /** + * Get a register that bitwise inverts the bitstring of a register when read or written to + * @param SCAN_COMM_REGISTER_CLASS source + * @post Only one instance of the register with this SCR paramter will exist + */ + SCAN_COMM_REGISTER_CLASS & GetNotRegister(SCAN_COMM_REGISTER_CLASS & i_arg); + + /** + * Get a register that bitwise left shift the bitstring of a register when read or written to + * @param SCAN_COMM_REGISTER_CLASS source + * @post Only one instance of the register with this SCR paramter and amount will exist + */ + SCAN_COMM_REGISTER_CLASS & GetLeftShiftRegister(SCAN_COMM_REGISTER_CLASS & i_arg, uint16_t i_amount); + + /** + * Get a register that bitwise right shift the bitstring of a register when read or written to + * @param SCAN_COMM_REGISTER_CLASS source + * @post Only one instance of the register with this SCR paramter and amount will exist + */ + SCAN_COMM_REGISTER_CLASS & GetRightShiftRegister(SCAN_COMM_REGISTER_CLASS & i_arg, uint16_t i_amount); + + + + /** + * Get a register that bit-wise ANDs the bitstring of two register when read or written to + * @param The 2 SCR 's to AND + * @posrt Only one instance of the register with these SCRs will exist + */ + SCAN_COMM_REGISTER_CLASS & GetAndRegister(SCAN_COMM_REGISTER_CLASS & i_left, + SCAN_COMM_REGISTER_CLASS & i_right); + + /** + * Get a register that bitwise ORs the bitstrings of two register when read or written + * @param the 2 SCR's to OR + * @post Only one instance of the register with these SCR's will exist + */ + SCAN_COMM_REGISTER_CLASS & GetOrRegister(SCAN_COMM_REGISTER_CLASS & i_left, + SCAN_COMM_REGISTER_CLASS & i_right); + + /** + * Get a AttnTypeRegister + * @params 3 scr Registers + * @post only one instance of the register with these SCR's will exist + */ + SCAN_COMM_REGISTER_CLASS & GetAttnTypeRegister(SCAN_COMM_REGISTER_CLASS & i_check, + SCAN_COMM_REGISTER_CLASS & i_recov, + SCAN_COMM_REGISTER_CLASS & i_special, + SCAN_COMM_REGISTER_CLASS & i_proccs); + + /** + * Get a PrdfConstantRegister + * @param BIT_STRING_CLASS - the bit string constant to use. + * @post only one instance of the register with this BIT_STRING value will + * exist. + */ + SCAN_COMM_REGISTER_CLASS & GetConstantRegister(BIT_STRING_CLASS i_val); + + /** + Destructor + */ +// ~ScanFacility(); +private: // functions + /** + Constructor + @param + @returns + @pre + @post + @see + @note + */ + ScanFacility() {} + + +private: // Data + typedef FlyWeight<PRDF::HomRegisterAccessScom,10> ScanCommAccess; + typedef std::vector<PRDF::HomRegisterAccessScan> ScanRingAccess; + typedef FlyWeightS<ScanCommRegisterChip,50> ScanCommRegisters; + typedef FlyWeight<PrdfAttnTypeRegister,50> AttnTypeRegisters; + typedef FlyWeightS<PrdfOrRegister,10> OrRegisters; + typedef FlyWeightS<PrdfAndRegister,50> AndRegisters; + typedef FlyWeightS<PrdfNotRegister,50> NotRegisters; + typedef FlyWeightS<PrdfLeftShiftRegister,10> LeftShiftRegisters; + typedef FlyWeightS<PrdfRightShiftRegister, 10> RightShiftRegisters; + typedef FlyWeight<PrdfConstantRegister, 10> ConstantRegisters; + + ScanCommAccess iv_scomAccessFw; + ScanRingAccess iv_scanAccessList; + ScanCommRegisters iv_scomRegFw; + NotRegisters iv_notRegFw; + LeftShiftRegisters iv_leftRegFw; + RightShiftRegisters iv_rightRegFw; + AndRegisters iv_andRegFw; + OrRegisters iv_orRegFw; + AttnTypeRegisters iv_attnRegFw; + ConstantRegisters iv_constRegFw; + +}; + + +#endif /* PRDFSCANFACILITY_H */ diff --git a/src/usr/diag/prdf/common/framework/register/xspprdAndResetErrorRegister.h b/src/usr/diag/prdf/common/framework/register/xspprdAndResetErrorRegister.h new file mode 100755 index 000000000..fea03d7d2 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/xspprdAndResetErrorRegister.h @@ -0,0 +1,181 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/xspprdAndResetErrorRegister.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2001,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 xspprdAndResetErrorRegister_h +#define xspprdAndResetErrorRegister_h + +/** + @file iipAndResetErrorRegister.h + @brief AndResetErrorRegister declaration +*/ + +// Class Description ************************************************* +// +// Name: AndResetErrorRegister +// Base class: ErrorRegisterMask +// +// Description: Resets the bit(s) in an error register that were used to +// Analyze an error. Intended to be used with hardware +// registers that support SCOM AND-Write to reset bits. +// This has an advantage in that register is only writen +// to reset the bits as opposted to a read-modify-write. +// +// Usage: See iipResetErrorRegister.h +// +// End Class Description ********************************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#ifndef iipErrorRegisterMask_h +#include <iipErrorRegisterMask.h> +#endif + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +/** + Reset Error register using And-Write + @author Doug Gilbert +*/ +class AndResetErrorRegister: public ErrorRegisterMask +{ + public: +/** + Constructor + <ul> + <br><b>Parameter: </b> Scan comm register to read from + <br><b>Parameter: </b> Resolution map (see iipResolutionMap.h) + <br><b>Paramteer: </b> Scan comm register to write to (for reset) + <br><b>Parameter: </b> Ptr to filter class (optional) + <br><b>Parameter: </b> Scan comm register id(optional) + <br><b>Parameter: </b> Scan comm Register of hardware mask (optional) + <br><b>Returns: </b> Nothing + <br><b>Requirements:</b> (software) - None + <br><b>Promises: </b> Object created + <br><b>Exceptions: </b> None + <br><b>Notes: </b> Scan comm register to write to should be AND-write + in hardware or strange things will happen + </ul><br> +*/ + AndResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r,ResolutionMap & rm, SCAN_COMM_REGISTER_CLASS & resetScr, FILTER_CLASS * f = NULL, uint16_t scrId = 0x0fff, SCAN_COMM_REGISTER_CLASS & maskScr = *((SCAN_COMM_REGISTER_CLASS *) NULL)); + +/** + Constructor + <ul> + <br><b>Parameter: </b> Scan comm register to read from + <br><b>Parameter: </b> Resolution map (see iipResolutionMap.h) + <br><b>Parameter: </b> Scan comm register to Write to Reset the error + <br><b>Parameter: </b> Scan Comm Register id + <br><b>Parameter: </b> Scan comm Register of hardware mask (optional) + <br><b>Returns: </b> Nothing + <br><b>Requirements:</b> (software) - None. + <br><b>Promises: </b> Object created + <br><b>Exceptions: </b> None + <br><b>Notes: </b> Scancomm register to write to should be AND-write in hardware + or results will not be as expected + </ul><br> +*/ + AndResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r,ResolutionMap & rm, SCAN_COMM_REGISTER_CLASS & resetScr, uint16_t scrId, SCAN_COMM_REGISTER_CLASS & r1 = *((SCAN_COMM_REGISTER_CLASS *) NULL)); + + +/** + 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> +*/ +// ~xspprdAndResetErrorRegister(); + +protected: // functions + + /** + Reset the error register in hardware + <ul> + <br><b>Parameter: </b> The bit listed used to Resolve the error + <br><b>Parameter: </b> The serviceData collector + <br><b>Returns: </b> Return code [SUCCESS | mops return code] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Bits listed in the bitList are turned off in the + corresponding hardware register + hardware register. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Hardware register Modified. The a logical anding is done in hardware + </ul><br> + */ + virtual int32_t Reset(const BIT_LIST_CLASS & bit_list, STEP_CODE_DATA_STRUCT & error); + + private: // functions + /* + copy constructor - prohibits coping - no definition should exist + */ + AndResetErrorRegister(const AndResetErrorRegister & ares); + + /* + Assignment operator - prohipits assignment - do definition should exist + */ + AndResetErrorRegister & operator=(const AndResetErrorRegister & er); + + private: // Data + + SCAN_COMM_REGISTER_CLASS & xAndResetScr; + +}; + +inline AndResetErrorRegister::AndResetErrorRegister +( SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + SCAN_COMM_REGISTER_CLASS & resetScr, + FILTER_CLASS * f, + uint16_t scrId, + SCAN_COMM_REGISTER_CLASS & maskScr + ) +: ErrorRegisterMask(r,rm,f,scrId,maskScr), xAndResetScr(resetScr) +{} + +inline AndResetErrorRegister::AndResetErrorRegister +( SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + SCAN_COMM_REGISTER_CLASS & resetScr, + uint16_t scrId, + SCAN_COMM_REGISTER_CLASS & r1 +) +: ErrorRegisterMask(r,rm,scrId,r1), xAndResetScr(resetScr) +{} + +#endif /* xspprdAndResetErrorRegister_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// v5r2 12/21/00 dgilbert Initial Creation +// 423599 fsp 10/27/03 dgilbert make scrid a bit16 +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/resolution/iipAnalyzeChipResolution.h b/src/usr/diag/prdf/common/framework/resolution/iipAnalyzeChipResolution.h new file mode 100755 index 000000000..a35c7968e --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/iipAnalyzeChipResolution.h @@ -0,0 +1,112 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/iipAnalyzeChipResolution.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1997,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 iipAnalyzeChipResolution_h +#define iipAnalyzeChipResolution_h + +// Class Description ************************************************* +// +// Name: AnalyzeChipResolution +// Base class: Resolution +// +// Description: Resolution to call Analyze() on a CHIP_CLASS +// Usage: +// +// End Class Description ********************************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#if !defined(iipResolution_h) +#include <iipResolution.h> +#endif + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +class CHIP_CLASS; + +/** + <One line Class description> + @author Doug Gilbert + */ +class AnalyzeChipResolution: public Resolution +{ +public: + /** + Constructor + <ul> + <br><b>Parameters:</b> chip: Chip object + <br><b>Requirements:</b> None + <br><b>Promises:</b> Object created + <br><b>Exceptions:</b> None + </ul><br> + */ + AnalyzeChipResolution(CHIP_CLASS & chip) : xChip(chip) {} + + /* + 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> + */ + // ~iipAnalyzeChipResolution(); + + /** + Resolve service data by calling chip.Analyze() + <ul> + <br><b>Parameters:</b> {parms} + <br><b>Returns:</b> {return} + <br><b>Requirements:</b> {preconditions} + <br><b>Promises:</b> {postconditions} + <br><b>Exceptions:</b> None. + <br><b>Notes:</b> {optional} + </ul><br> + */ + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & serviceData); + +private: // functions +private: // Data + + /** + @see CHIP_CLASS + */ + CHIP_CLASS & xChip; + +}; + + +#endif /* iipAnalyzeChipResolution_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- ----- ------------------------------- +// 05/05/98 DRG Initial Creation +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/resolution/iipCallAttnResolution.h b/src/usr/diag/prdf/common/framework/resolution/iipCallAttnResolution.h new file mode 100755 index 000000000..3a2283e2b --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/iipCallAttnResolution.h @@ -0,0 +1,117 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/iipCallAttnResolution.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1997,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 iipCallAttnResolution_h +#define iipCallAttnResolution_h + +// Class Description ************************************************* +// +// Name: CallAttnResolution +// Base class: Resolution +// +// Description: A resolution to call all chips raising attention +// Usage: See iipResolution.h +// +// End Class Description ********************************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#if !defined(iipResolution_h) +#include <iipResolution.h> +#endif + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +//class CalloutMap; + +class CallAttnResolution : public Resolution +{ +public: +// CallAttnResolution(CalloutMap & callmap); + CallAttnResolution() {} + // Function Specification ******************************************** + // + // Purpose: Constructor + // Parameters: Object that maps chipId's to Callouts + // Returns: Nothing + // Requirements: None + // Promises: Object created + // Exceptions: None + // Concurrency: synchronous + // Notes: + // + // End Function Specification **************************************** + + // ~CallAttnResolution(); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: Compiler default defn is sufficent + // + // End Function Specification **************************************** + + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & error); + // Function Specification ******************************************** + // + // Purpose: Resolve service data - callout all chips at attention as + // reported by the service processor sysdebug area. + // Parameters: Reference to the Step code data structure + // Returns: return code + // Requirements: None + // Promises: if rc = SUCCESS then + // ServiceData signature set, Callout list modified + // Exceptions: None + // Concurrency: synchronous + // Notes: if rc != SUCCESS then state of service data is unpredictable + // + // End Function Specification **************************************** +private: // functions +private: // Data + +// CalloutMap & calloutMap; + +}; + +//inline +//CallAttnResolution::CallAttnResolution(CalloutMap & callmap) +//: calloutMap(callmap) +//{ +//} + +#endif /* iipCallAttnResolution_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- ----- ------------------------------- +// DRG Initial Creation +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/resolution/iipCallResolutionTemplate.h b/src/usr/diag/prdf/common/framework/resolution/iipCallResolutionTemplate.h new file mode 100755 index 000000000..ac25b5f11 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/iipCallResolutionTemplate.h @@ -0,0 +1,115 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/iipCallResolutionTemplate.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 iipCallResolutionTemplate_h +#define iipCallResolutionTemplate_h + +// Class Description ************************************************* +// +// Name: CallResolutionTemplate +// Base class: Resolution +// +// Description: Call a specified member function on object of type class T +// function signature: int32_t functname(STEP_CODE_DATA_STRUCT & error); +// Usage: +// +// CallResolutionTemplate<SixDamain> rd(&SixDomain,&SixDomain::Analyze); +// ResolutionMap rm(...); +// rm.Add(BIT_LIST_STRING_16,rd); +// +// Resolution &r = rm.LookUp(BIT_LIST_CLASS(BIT_LIST_STRING_16)); +// r->Resolve(error); // calls SixDomain::Analyze(error); +// +// End Class Description ********************************************* +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#ifndef iipResolution_h +#include <iipResolution.h> +#endif + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +template<class T> +class CallResolutionTemplate : public Resolution +{ +public: + typedef int32_t (T::*FUNCT) (STEP_CODE_DATA_STRUCT &); + + CallResolutionTemplate(T *obj, FUNCT pf) + : Resolution(),object(obj),pFunction(pf) {} + // Function Specification ******************************************** + // + // Purpose: Constructor + // Parameters: None + // Returns: Nothing + // Requirements: None + // Promises: Object created + // Exceptions: None + // Concurrency: synchronous + // Notes: + // + // End Function Specification **************************************** + + //~CallResolutionTemplate(); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: Compiler default is sufficent + // + // End Function Specification **************************************** + + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & error) + { + return((object->*pFunction)(error)); + } + // See Resolution.h + +private: // functions + CallResolutionTemplate(const CallResolutionTemplate<T>&); // not allowed + CallResolutionTemplate<T>& operator=(const CallResolutionTemplate<T>&); +private: // Data + + T * object; + FUNCT pFunction; + +}; + + +#endif /* iipCallResolutionTemplate_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- ----- ------------------------------- +// DRG Initial Creation +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/resolution/iipCallout.h b/src/usr/diag/prdf/common/framework/resolution/iipCallout.h new file mode 100755 index 000000000..e2d50a5bb --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/iipCallout.h @@ -0,0 +1,167 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/iipCallout.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 iipCallout_h +#define iipCallout_h + +// Special maintenance notes: ***************************************** +// +// This file must maintain the basic format decribed below. All +// maintenance must preserve that format to ensure the proper function +// of all code that uses this file. +// +// PRD_NULL_MRU must be the first mru in the MruCallout enum and it +// must have a value of zero. The value "PRD_NULL_MRU" shall be by +// definition a valid MRU value that means "No specific MRU". Mapping +// code will verify that all MRU values are greater than this value to +// acceptable for translation. +// +// The MruCallout enum must have the name "PRD_MAXMRUNUM" as the last +// mru in the list. This will then automatically supply the number of +// mrus in the enum to code that must check that. +// +// The MruCallout enum must default to compiler supplied values for each +// mru. This is how "PRD_NULL_MRU" and "PRD_MAXMRUNUM" will always be +// correct and it precludes any dependencies on other code modules +// requiring a specific value. +// +// PRD_NULL_FRU must be the first fru in the FruValues enum and it +// must have a value of zero. +// +// PRD_NULL_REFCODE must be the first refcode in the RefcodeValues enum +// and it must have a value of zero. +// +// NOTE!!!!!!! +// The Version, Release, Modification and Level values set in this file +// MUST be updated each time a change is made to this file that would +// cause the renumbering of the MRU callout values in the ENUM. +// +// End of Special maintenance notes. ********************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +//-------------------------------------------------------------------- +// Constants +//-------------------------------------------------------------------- + +#ifdef RS6000 +#ifndef SERVGENSIMCONTROLS_H +#include <ServGenSimControls.h> +#endif +#endif + +#ifdef __CPLUSPLUS +const PRD_CALLOUT_VERSION = 4; +#else +#define PRD_CALLOUT_VERSION 4 +#endif + +#ifdef __CPLUSPLUS +const PRD_CALLOUT_RELEASE = 3; +#else +#define PRD_CALLOUT_RELEASE 3 +#endif + +#ifdef __CPLUSPLUS +const PRD_CALLOUT_MODIFICATION = 0; +#else +#define PRD_CALLOUT_MODIFICATION 0 +#endif + +#ifdef __CPLUSPLUS +const PRD_CALLOUT_LEVEL = 4; +#else +#define PRD_CALLOUT_LEVEL 4 +#endif + + +#ifdef __CPLUSPLUS +const PRD_REFDIM = 5; +#else +#define PRD_REFDIM 5 +#endif + /* This is the number of refcodes and*/ + /* FRUs that a MRU list can be */ + /* translated into. */ + +#ifdef __CPLUSPLUS +const PRD_MRU_LIST_LIMIT = 24; +#else +#define PRD_MRU_LIST_LIMIT 24 +#endif + /* This is the maximum number of MRUs*/ + /* that will be allowed to be called */ + /* out for mapping. */ + +#ifdef __CPLUSPLUS +const PRD_FRU_AND_RC_LIMIT = 12; +#else +#define PRD_FRU_AND_RC_LIMIT 12 +#endif + /* this is the maximum number of FRUs*/ + /* and refcodes that will be allowed */ + /* in the mapping results. */ + + +/*--------------------------------------------------------------------*/ +/* User Types */ +/*--------------------------------------------------------------------*/ + +//#define MruCalloutDCL UINT16 /* How big a mru is in bits. */ + + +typedef enum { + + PRD_NULL_MRU, /* Do NOT use this. This is an */ + /* MRU used to mark the low end */ + /* of the valid MRU number ranges.*/ + + + + +/*********************************************************/ +/* Last, the reserved, default value of this */ +/* "NO_MRU" reserved mru name. */ +/* Use this only if there is no Callout and No service */ +/* action and the SRC will not get displayed. This MRU */ +/* will be mapped to the ServiceProcessor code refcode */ +/* so that if the SRC from this MRU ever ends up in the */ +/* panel or a log SP code will be called. */ +/* This MRU is used for attentions that do not require */ +/* service actions, such as "scrub complete". */ + + NO_MRU, + +/************************************************************/ +/* This is the reserved and Last mru and must remain that */ +/* way for proper code function. */ + LAST_MRU, + PRD_MAXMRUNUM = 0x7FFFFFFF} MruCallout; + + + + +#endif /* iipCallout_h */ + diff --git a/src/usr/diag/prdf/common/framework/resolution/iipCalloutMap.h b/src/usr/diag/prdf/common/framework/resolution/iipCalloutMap.h new file mode 100755 index 000000000..bbec65bac --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/iipCalloutMap.h @@ -0,0 +1,152 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/iipCalloutMap.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 iipCalloutMap_h +#define iipCalloutMap_h + +// Class Description ************************************************* +// +// Name: iipCalloutMap +// Base class: +// +// Description: Map ChipiD's to Mru callouts +// Usage: +// +// CalloutMap calloutMap(); +// +// foo(CalloutMap & calloutMap, CHIP_CLASS * chip) +// { +// uint32_t chip_id = chip->GetId(); +// MruCallout m1 = calloutMap.GetCallout(chip_id,HIGH); +// } +// +// End Class Description ********************************************* +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#if !defined(PRDF_TYPES_H) + #include <prdf_types.h> +#endif + +#include <prdfCallouts.H> + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +/** + Convert a chipid to a mru callout + @author Douglas R. Gilbert + @version V4R5 +*/ +class CalloutMap +{ +public: + + enum probability { HIGH_PROBABILITY, LOW_PROBABILITY }; + + /** + CTOR + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> None + <br><b>Requirements:</b> None + <br><b>Promises: </b> Object created + <br><b>Exceptions: </b> None. + </ul><br> + */ + CalloutMap(); + + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: Compiler default is sufficient + // + // End Function Specification **************************************** + // ~iipCalloutMap(); + + + /** + Return a MruCallout for a chipId (Apache/Northstar) + <ul> + <br><b>Parameters: </b> chipId, probability + <br><b>Returns: </b> MruCallout + <br><b>Requirements:</b> Valid chipId + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Implemented for Apache and Northstar only + </ul><br> + */ + //MruCallout GetCallout(uint32_t chipId, probability prb = HIGH_PROBABILITY) const; + + /** + Get a MruValues for a chipId (Condor/CSP) + <ul> + <br><b>Parameters: </b> ChipId + <br><b>Returns: </b> MruValues (see xspiiCallout.h) + <br><b>Requirements:</b> Valid chipId + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Implemented for Condor and CSP only + </ul><br> + */ + PRDF::MruValues GetMruCallout(uint32_t chipId) const; + + /** + Get a MruValues for a chipId (Regatta/CSP) + <ul> + <br><b>Parameters: </b> ChipEnum + <br><b>Returns: </b> MruValues (see xspiiCallout.h) + <br><b>Requirements:</b> Valid chipEnum + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Implemented for Regatta and CSP only + </ul><br> + */ + PRDF::MruValues GetMruCallout(ChipEnum chipEnum) const; + +private: // functions +private: // Data + +}; + + +#endif /* iipCalloutMap_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- ----- ------------------------------- +// d24758.1 v4r1 05/20/96 DRG Initial Creation +// D49127.7 V4R1 09/27/96 DRG Made data static +// D49274.1 V4R5 06/08/98 DRG MOdify to support v4r5 +// D49420.x v5r2 07/17/00 mak modify to support v5r2 +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/resolution/iipCalloutResolution.h b/src/usr/diag/prdf/common/framework/resolution/iipCalloutResolution.h new file mode 100755 index 000000000..2c8ab7404 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/iipCalloutResolution.h @@ -0,0 +1,153 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/iipCalloutResolution.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 iipCalloutResolution_h +#define iipCalloutResolution_h + +// Class Description ************************************************* +// +// Name: CalloutResolution +// Base class: Resolution +// +// Description: Resolution makes a MRU Callout. +// +// Usage: +// +// +// CalloutResolution r1(PU0,MRU_MED); +// ResolutionMap rm(....) // see iipResolutionMap.h +// rm.Add(BIT_LIST_STRING_31,&r1); // if bit 31 is on callout PU0 HIGH as +// // the failing item +// +// ... +// +// +// End Class Description ********************************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#include <prdfCallouts.H> + +#if !defined(iipResolution_h) +#include <iipResolution.h> +#endif + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +/** + A resolution that adds a MRU callout to the service data collector + @version V4R5 + @author Douglas R. Gilbert +*/ + +class CalloutResolution: public Resolution +{ +public: + + /** + CTOR + <ul> + <br><b>Parameters: </b> a MruValues, a PriorityValues (see xspiiCallout.h) + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Object created + <br><b>Exceptions: </b> None. + </ul><br> + */ + CalloutResolution(PRDF::PRDcallout callout, PRDF::PRDpriority priority); + CalloutResolution(void); // default + CalloutResolution(const CalloutResolution & cr); + + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: Compiler default is sufficient + // + // End Function Specification **************************************** + //~CalloutResolution(); + + /** + Resolve by adding a the MRU callout to the service data collector + <ul> + <br><b>Parameters: </b> ServiceDataCollector + <br><b>Returns: </b> Return code [SUCCESS | nonZero] + <br><b>Requirements:</b> none. + <br><b>Promises: </b> serviceData::GetMruList().GetCount()++ + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & error); + + // dg00 start + virtual bool operator==(const Resolution & r) const + { + return r.operator==(*this); // compare whatever r is with this + } + + virtual bool operator==(const CalloutResolution & r) const + { + return((xMruCallout == r.xMruCallout) && (xPriority == r.xPriority)); + } + +// friend int operator==(const CalloutResolution& a, const CalloutResolution& b) +// { +// return((a.xMruCallout == b.xMruCallout) && (a.xPriority == b.xPriority)); +// } + // dg00 end + +private: // functions +private: // Data + + PRDF::PRDcallout xMruCallout; + PRDF::PRDpriority xPriority; + +}; + + +inline +CalloutResolution::CalloutResolution(PRDF::PRDcallout callout, + PRDF::PRDpriority priority) +: xMruCallout(callout), xPriority(priority) +{} + +inline +CalloutResolution::CalloutResolution() : + xMruCallout(NULL), xPriority(PRDF::MRU_MED) +{} + +inline +CalloutResolution::CalloutResolution(const CalloutResolution & cr) +: xMruCallout(cr.xMruCallout), xPriority(cr.xPriority) +{} + +#endif /* iipCalloutResolution_h */ diff --git a/src/usr/diag/prdf/common/framework/resolution/iipCaptureResolution.h b/src/usr/diag/prdf/common/framework/resolution/iipCaptureResolution.h new file mode 100755 index 000000000..89829f651 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/iipCaptureResolution.h @@ -0,0 +1,138 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/iipCaptureResolution.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 iipCaptureResolution_h +#define iipCaptureResolution_h + +/** + @file iipCaptureResolution.h + @brief CaptureResolution class definition +*/ + +#if !defined(iipResolution_h) +#include <iipResolution.h> +#endif + +#if !defined(iipCaptureData_h) +#include <iipCaptureData.h> +#endif + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +class SCAN_COMM_REGISTER_CLASS; + +/** + CaptureResolution captures the data from a scan comm register. + @code + // see xspmopenum.h for defn of chipIds + class SomeChipClass { + public: + CaptureResolution iv_captureScr; + CalloutResolution calloutSomething; + ResolutionMap someResolutionMap; + // .... + }; + + // in SomeChipClass.C + const int8_t SCR_ID = 0x01; + + SomeChipClass::SomeChipClass(...) + : iv_captureScr(SPIN0_ENUM, SCR_ID, someScr), + calloutComething(...), + someResolutionMap(...) + { + // .... + someResolutionMap.Add(BIT_LIST_STRING_10, &calloutSomething, &iv_captureScr); + // ... + } + @endcode + @see iipResolutionMap.h +*/ +class CaptureResolution : public Resolution +{ +public: + + /** + Constructor + @param chipId id of the chip - see xspmopenum.h + @param scrRegId developer defined 8bit id for this register + @param scr reference to ScanCommRegister + @param p placement of capturedatat (FRONT or BACK) see iipCaptureData.h + @see iipCaptureData.h + */ + CaptureResolution(uint32_t chipId, + uint8_t scrRegId, + SCAN_COMM_REGISTER_CLASS & scr, + CaptureData::Place p = CaptureData::BACK); + + // compiler default destructor is sufficient + /** + Resolve - perform the capture + @pre none + @post CaptureData sent to ServiceDataCollector + @return error - ServiceDataCollector + @return returncode [SUCCESS | mop return code] + @No definition exist for this until we prove we need it again! + */ + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & error); + + private: // functions + private: // Data + + uint32_t chid; + SCAN_COMM_REGISTER_CLASS & xScr; + CaptureData::Place pos; // FRONT || BACK + uint8_t scrId; + +}; + +inline +CaptureResolution::CaptureResolution(uint32_t chipId, + uint8_t scrRegId, + SCAN_COMM_REGISTER_CLASS & scr, + CaptureData::Place p = CaptureData::BACK); +: +Resolution(), +chid(chipId), +scrId(scrRegId), +xScr(scr), +pos(p) +{} + + +#endif /* iipCaptureResolution_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ------ -------- ----- ------------------------------- +// d24758.1 v4r1m0 05/14/96 DRG Initial Creation +// d24758.1 v4r1m0 05/28/96 DRG Added new constructor for single scr +// d24758.1 v4r1m0 05/30/96 DRG Changed base class to Resolution +// Now only capture 1 reg/CaputureResolution +// d48127.9 v4r1m0 10/20/97 DRG Add interface for chipId + Address +// dg01 V4r3m0 05/13/99 DRG Add place to capture (FRONT or BACK) +// 359182 fips1 03/07/02 dgilbert fix up for FSP +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/resolution/iipEregResolution.h b/src/usr/diag/prdf/common/framework/resolution/iipEregResolution.h new file mode 100755 index 000000000..8042c2901 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/iipEregResolution.h @@ -0,0 +1,132 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/iipEregResolution.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 iipEregResolution_h +#define iipEregResolution_h + +// Class Description ************************************************* +// +// Name: EregResolution concrete class +// Base class: Resolution +// +// Description: Resolve an error by analyzing an error register +// Usage: +// +// ResolutionMap ereg1Resolutions(...); +// ErrorRegister ereg1(....); +// ErrorRegister ereg2(....); +// +// Resolution *r = new EregResolution(ereg2); +// ereg1Resolutions.add(BIT_LIST_STRING_20,r); // If bit 20 of ereg1 on then +// // Resolution = ereg2.Analyze(); +// +// +// +// End Class Description ********************************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#if !defined(iipResolution_h) +#include <iipResolution.h> +#endif + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +class ErrorRegisterType; + +class EregResolution : public Resolution +{ + public: + EregResolution(); + EregResolution(ErrorRegisterType & er); + // Function Specification ******************************************** + // + // Purpose: Constructor + // Parameters: ErrorRegister object to be invoked by Resolve() + // Returns: Nothing + // Requirements: None + // Promises: Object created + // Exceptions: None + // Concurrency: synchronous + // Notes: + // + // End Function Specification **************************************** + + // ~EregResolution(); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: Compiler default is sufficient + // + // End Function Specification **************************************** + // Copy ctor - compiler default is sufficient + // Assignment - compiler default is sufficient + + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & data); + // Function Specification ******************************************** + // + // Purpose: + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: Compiler default is sufficient + // + // End Function Specification **************************************** + + private: // functions + private: // Data + + ErrorRegisterType * errorRegister; + +}; + +inline +EregResolution::EregResolution(ErrorRegisterType &er) +: errorRegister(&er) {} + +inline +EregResolution::EregResolution() + : errorRegister(NULL) {} + +#endif /* iipEregResolution_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- ------- ---- -------- -------- ------------------------------- +// v4r1m0 05/13/96 DRG Initial Creation +// pw01 494911 f310 03/04/05 iawillia Use ErrorRegisterType instead of +// ErrorRegister. +// f522283 fips300 09/27/05 dgilbert Make class FlyWeight -able +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/resolution/iipResolution.C b/src/usr/diag/prdf/common/framework/resolution/iipResolution.C new file mode 100755 index 000000000..c68c5190a --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/iipResolution.C @@ -0,0 +1,357 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/iipResolution.C $ */ +/* */ +/* 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 */ + +// Module Description ************************************************** +// +// Description: PRD resolution definition +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define iipResolution_C + +#include <iipconst.h> +#include <CcAutoDeletePointer.h> +#include <iipSystem.h> +#include <iipglobl.h> +//#include <iipCalloutMap.h> +#include <iipCalloutResolution.h> +#include <iipstep.h> +#include <iipScanCommRegisterChip.h> +#include <iipCaptureData.h> +#include <iipServiceDataCollector.h> +#include <iipErrorRegister.h> +#include <iipEregResolution.h> +#include <iipsdbug.h> +#include <iipResolutionList.h> +//#include <iipThresholdResolution.h> +#include <iipCallAttnResolution.h> +#include <iipTerminateResolution.h> +#include <iipAnalyzeChipResolution.h> +#include <xspprdTryResolution.h> +//#include <prdfResetThresholdResolution.H> +//#include <prdfIntervalThresholdResolution.H> +#include <iipchip.h> +#include <prdfCalloutConnected.H> +#include <prdfAnalyzeConnected.H> +#include <prdfPlatServices.H> + +#undef iipResolution_C + +using namespace PRDF; + +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Resolution Member Function Specifications +//--------------------------------------------------------------------- +Resolution::~Resolution() {} + +//--------------------------------------------------------------------- +// EregResolution Member Function Specifications +//--------------------------------------------------------------------- + +int32_t EregResolution::Resolve(STEP_CODE_DATA_STRUCT & data) +{ + int32_t rc = PRD_INTERNAL_CODE_ERROR; + if(errorRegister != NULL) + { + rc = errorRegister->Analyze(data); + } + return rc; +} + + +//--------------------------------------------------------------------- +// CalloutResolution Member Function Specifications +// using MruValues (xspiiCallout.h) +//--------------------------------------------------------------------- + +int32_t CalloutResolution::Resolve(STEP_CODE_DATA_STRUCT & error) +{ + error.service_data->SetCallout(xMruCallout,xPriority); + return(SUCCESS); +} + +//-------------------------------------------------------------------- +// ResolutionList Member Functions +//-------------------------------------------------------------------- + +int32_t ResolutionList::Resolve(STEP_CODE_DATA_STRUCT & error) +{ + int32_t rc = SUCCESS; + for(std::vector<void *>::iterator iter = resolutionList.begin(); + iter != resolutionList.end(); + ++iter) + { + Resolution * r = (Resolution *) *iter; + rc = r->Resolve(error); + if(rc != SUCCESS) break; + } + return(rc); +} + +//-------------------------------------------------------------------- +// ThresholdResolution Member Functions +//-------------------------------------------------------------------- + +//int32_t ThresholdResolution::Resolve(STEP_CODE_DATA_STRUCT & error) +//{ +// ++count; +// error.service_data->SetHits((uint16_t)count); +// error.service_data->SetThreshold((uint16_t)threshold); +// if((count >= threshold) || (error.service_data->IsFlooding())) +// { +// error.service_data->SetThresholdMaskId(maskId); // threshold, degraded YES +// } +// int32_t rc = SUCCESS; +// if(xRes != NULL) rc = xRes->Resolve(error); +// return rc; +//} + +//-------------------------------------------------------------------- +// Call all chips raising attention as reported by sp sysdebug area +//-------------------------------------------------------------------- +int32_t CallAttnResolution::Resolve(STEP_CODE_DATA_STRUCT & error) +{ + int32_t rc = NO_DOMAINS_AT_ATTENTION; + SYSTEM_DEBUG_CLASS systemDebug; + + ErrorSignature * signature = error.service_data->GetErrorSignature(); + signature->clear(); + signature->setChipId(0xffffffff); + + systemDebug.CalloutThoseAtAttention(error); + + signature->setErrCode((uint16_t)NO_PRD_ANALYSIS); + + return(rc); +} + +// ******************************************************************** + +int32_t TerminateResolution::Resolve(STEP_CODE_DATA_STRUCT & error) +{ + error.service_data->SetTerminate(); + return(SUCCESS); +} + +// ******************************************************************** + +int32_t AnalyzeChipResolution::Resolve(STEP_CODE_DATA_STRUCT & error) +{ + // mk442956 a + return xChip.Analyze(error,error.service_data->GetCauseAttentionType()); +} + +// ******************************************************************** + +int32_t TryResolution::Resolve(STEP_CODE_DATA_STRUCT & error) +{ + // Save the current error signature + ErrorSignature * es = error.service_data->GetErrorSignature(); + ErrorSignature temp = *es; + // Try the tryResolution + int32_t rc = xTryResolution->Resolve(error); + if ( (SUCCESS != rc) && (PRD_NO_CLEAR_FIR_BITS != rc) ) // if it didn't work + { + // Restore signature + *es = temp; + // Call the default signature + rc = xDefaultResolution->Resolve(error); + } + return rc; +} + +int32_t prdfCalloutConnected::Resolve(STEP_CODE_DATA_STRUCT & serviceData) +{ + using namespace TARGETING; + + TargetHandle_t l_pconnectedTarget = NULL; + TargetHandleList l_connectedTargetList; + l_connectedTargetList = PlatServices::getConnected( iv_psourceHandle, + iv_targetType ); + if(0xffffffff == iv_idx) + { + if(l_connectedTargetList.size()>0) + { + l_pconnectedTarget = l_connectedTargetList[0]; + } + } + else + { + for(TargetHandleList::iterator itrTarget = l_connectedTargetList.begin(); + itrTarget!= l_connectedTargetList.end();itrTarget++) + { + if(iv_idx == PlatServices::getTargetPosition(*itrTarget)) + { + l_pconnectedTarget = *itrTarget ; + break; + } + } + } + + if ( l_pconnectedTarget != NULL ) + { + serviceData.service_data->SetCallout(l_pconnectedTarget,iv_priority); + } + else + { + if(iv_altResolution != NULL) + { + iv_altResolution->Resolve(serviceData); + } + else + { + serviceData.service_data->SetCallout(iv_psourceHandle); + } + } + + return SUCCESS; +} + +//-------------------------------------------------------------------- +// AnalyzeConnected Member Functions +//-------------------------------------------------------------------- +int32_t PrdfAnalyzeConnected::Resolve(STEP_CODE_DATA_STRUCT & serviceData) +{ + using namespace TARGETING; + using namespace PRDF; + + CHIP_CLASS * l_connChipObj = NULL; + TARGETING::TargetHandle_t l_pconnChipTarget = NULL; + + // Get connected list. + TargetHandleList l_connectedTargetList = PlatServices::getConnected( + iv_psourceHandle, + iv_targetType ); + + // If ID = 0xffffffff, find first valid. + if (0xffffffff == iv_idx) + { + if(l_connectedTargetList.size()>0) + { + //First valid handle. we don't allow invalid things in list + l_pconnChipTarget = l_connectedTargetList[0] ; + } + } + // Otherwise, grab from correct index. + else + { + for(TargetHandleList::iterator itrTarget = l_connectedTargetList.begin(); + itrTarget!= l_connectedTargetList.end();itrTarget++) + { + if(iv_idx == PlatServices::getTargetPosition(*itrTarget)) + { + l_pconnChipTarget = *itrTarget ; + break; + + } + } + } + + // If valid chip found, look up in global system container. + if (NULL != l_pconnChipTarget) + { + l_connChipObj = systemPtr->GetChip(l_pconnChipTarget); + } + + // Analyze chip. + if (NULL != l_connChipObj) + return l_connChipObj->Analyze( serviceData, + serviceData.service_data->GetCauseAttentionType() ); + else + return PRD_UNRESOLVED_CHIP_CONNECTION; +} + +//-------------------------------------------------------------------- +// ResetThresholdResolution Member Functions +//-------------------------------------------------------------------- + +#if defined(_OBSOLITE_) +int32_t ResetThresholdResolution::Resolve(STEP_CODE_DATA_STRUCT & error) +{ + ++count; + error.service_data->SetHits((uint16_t)count); + error.service_data->SetThreshold((uint16_t)threshold); + if((count == threshold) || (error.service_data->IsFlooding())) + { + error.service_data->SetThresholdMaskId(maskId); // threshold, degraded YES + count = 0; // Reset the counter when threshold is hit + } + int32_t rc = SUCCESS; + // if(xRes != NULL) rc = xRes->Resolve(error); + return rc; +} +//-------------------------------------------------------------------- +// IntervalThresholdResolution Member Functions +//-------------------------------------------------------------------- + +int32_t IntervalThresholdResolution::Resolve(STEP_CODE_DATA_STRUCT & error) +{ + PrdTimer curTime = error.service_data->GetTOE(); // get timestamp (Time Of Error) from SDC; + ++count; + if (count == 1) // The interval begins now at the first occurrence + intervalEndTime = curTime + intervalLength; // Project the end of interval (intervalLength is in seconds) + else + { + if (curTime > intervalEndTime) // See if we're already past the time window + { + count = 1; // Reset count as if it were the first + intervalEndTime = curTime + intervalLength; // Project the new end of interval (intervalLength is in seconds) + } + else if((count == threshold) || (error.service_data->IsFlooding())) // We've hit threshold within the interval + { + error.service_data->SetThresholdMaskId(maskId); // threshold, degraded YES + count = 0; // Reset the counter when threshold is hit + } + else ; // Nothing else--the count is already incremented + } + error.service_data->SetHits((uint16_t)count); + error.service_data->SetThreshold((uint16_t)threshold); + + int32_t rc = SUCCESS; + // if(xRes != NULL) rc = xRes->Resolve(error); + return rc; +} +#endif diff --git a/src/usr/diag/prdf/common/framework/resolution/iipResolution.h b/src/usr/diag/prdf/common/framework/resolution/iipResolution.h new file mode 100755 index 000000000..32123c585 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/iipResolution.h @@ -0,0 +1,161 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/iipResolution.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 iipResolution_h +#define iipResolution_h + +// Class Description ************************************************* +// +// Name: Resolution +// Base class: None +// +// Description: This module contains the Processor Runtime +// Diagnostics Resolution class declaration. +// Resolution provides a mechansim to resolve a +// hardware error and provide service data +// +// Usage: Abstract base class +// +// int32_t foo(STEP_CODE_DATA_STRUCT &serviceData, +// ResolutionMap &map) +// { +// Resolution &r = map.LookUp(BIT_LIST_STRING_21); +// int32_t rc = r.Resolve(serviceData); +// return(rc); +// } +// +// End Class Description ********************************************* +/*--------------------------------------------------------------------*/ +/* Reference the virtual function tables and inline function + defintions in another translation unit. */ +/*--------------------------------------------------------------------*/ + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#if !defined(PRDF_TYPES_H) +#include <prdf_types.h> +#endif + +#if !defined(IIPSTEP_H) +#include <iipstep.h> +#endif + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +class CalloutResolution; //dg00 + + +class Resolution +{ +public: + + /** + Destructor + @pre None + @post None + @note This destructor does nothing. This definitions + would have the same effect as the compiler generated + default destructor. It is declared virtual so that + derived classes will be destructed properly. + */ + virtual ~Resolution(); + + /** + Resolve the service data for this error syndrome + @pre None + @post service data is complete + @return SUCCESS | non-zero + */ + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & data) = 0; + // Function Specification ******************************************** + // + // Purpose: Resolve service data for a specific error bit (Pure Virtual) + // Parameters: Reference to the Step code data structure + // Returns: return code + // Requirements: None + // Promises: if rc = SUCCESS then data filled with apropriate service data + // Exceptions: None + // Concurrency: synchronous + // Notes: if rc != SUCCESS then state of service data is unpredictable + // + // End Function Specification **************************************** + + + // Copy ctor - compiler default is sufficient + // Assignment - compiler default is sufficient + + // dg00 start + /** + Comparison + <ul> + <br><b>Parameters: </b> A Resolution + <br><b>Returns: </b> [true | false] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Each derived class that supports comparison must be listed + here. + </ul><br> + */ + virtual bool operator==(const Resolution & r) const + { return false; } // default + virtual bool operator==(const CalloutResolution & r) const + { return false; } + // dg00 end + +protected: + + Resolution() {} + // Function Specification ******************************************** + // + // Purpose: Constructor + // Parameters: Pointer to charater string bit list encoding (opt) + // Returns: Nothing + // Requirements: None + // Promises: Object created + // Exceptions: None + // Concurrency: synchronous + // Notes: + // + // End Function Specification **************************************** + +private: // functions +private: // Data + + +}; + + +#endif /* iipResolution_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- --------- ---- -------- -------- ------------------------------- +// v4r1 05/01/96 dgilbert Replaces ACTION_CLASS +// dg00 d49420.07 v5r2 11/09/00 dgilbert Add support for operator== +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/resolution/iipResolutionFactory.C b/src/usr/diag/prdf/common/framework/resolution/iipResolutionFactory.C new file mode 100755 index 000000000..158a5842e --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/iipResolutionFactory.C @@ -0,0 +1,313 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/iipResolutionFactory.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1997,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 iipResolutionFactory.h + @brief ResolutionFactory definition + */ +// Module Description ************************************************** +// +// Description: +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define iipResolutionFactory_C + +#include <iipResolutionFactory.h> +#include <prdfFlyWeight.C> // dg01 +#include <prdfFlyWeightS.C> +#include <prdfPlatServices.H> + +#undef iipResolutionFactory_C +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// class static Variables +//---------------------------------------------------------------------- + +// dg01 - delete 4 lines of code +// pw01 - This stuff doesn't appear to be needed anymore. +/*class CalloutFW; // dg01 +class ResolutionLinkFW; // dg01 +class ThresholdResolutionList; // dg02 +class MaskResolutionFW; // dg02 +class ConnectedFW; // dg04a +class AnalyzeCFW; // dg05a +class PluginCallFW; // dg06a +class ThresholdSigFW; // dg06a +class EregResolutionFW; // dg06a +class TryResolutionFW; // dg06a +class FlagResolutionFW; // dg06a +class DumpResolutionFW; // dg06a +class GardResolutionFW; // dg06a +*/ + +using namespace PRDF; + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +ResolutionFactory & ResolutionFactory::Access(void) +{ + static ResolutionFactory rf; + return(rf); +} + +//--------------------------------------------------------------------- + +ResolutionFactory::~ResolutionFactory() +{ +} + +// --------------------------------------------------------------------- + +Resolution & ResolutionFactory::GetCalloutResolution(PRDcallout callout, + PRDpriority p) +{ + // search for existing callout + // dg01 start + CalloutResolution key(callout,p); + return iv_Callouts.get(key); + // dg01 end +} + +// ---------------------------------------------------------------------- + +Resolution & ResolutionFactory::LinkResolutions(Resolution & r1, + Resolution & r2) +{ + // dg01 start + // search for existing link + ResolutionFactory::ResolutionLink key(r1,r2); + return iv_Links.get(key); + // dg01 end +} + +// --------------------------------------------------------------------- + +int32_t ResolutionFactory::ResolutionLink::Resolve( + STEP_CODE_DATA_STRUCT & serviceData ) +{ + int32_t rc = xlnk1->Resolve(serviceData); + if (rc == SUCCESS) rc = xlnk2->Resolve(serviceData); + return rc; +} + +// dg02a - start +MaskResolution & ResolutionFactory::GetThresholdResolution( uint32_t maskId, + const ThresholdResolution::ThresholdPolicy & policy, + const ThresholdResolution::ThresholdPolicy & mfgPolicy ) +{ + MaskResolution * r = NULL; + if ( !PRDF::PlatServices::mfgMode() ) + { + r = &iv_thresholdResolutions.get(ThresholdResolution(maskId,policy)); + } + else + { + r = &iv_thresholdResolutions.get(ThresholdResolution(maskId,mfgPolicy)); + } + return *r; +} + +MaskResolution & ResolutionFactory::GetThresholdResolution( uint32_t maskId, + const ThresholdResolution::ThresholdPolicy & policy ) +{ + MaskResolution * r = NULL; + if ( !PRDF::PlatServices::mfgMode() && + !(policy == ThresholdResolution::cv_mnfgDefault) ) + { + r = &iv_thresholdResolutions.get(ThresholdResolution(maskId,policy)); + } + else + { + r = &iv_maskResolutions.get(MaskResolution(maskId)); + } + + return *r; +} + +MaskResolution & ResolutionFactory::GetThresholdResolution(uint32_t maskId) +{ + MaskResolution * r = NULL; + if ( !PRDF::PlatServices::mfgMode() ) + { + r = &iv_thresholdResolutions.get( + ThresholdResolution(maskId, + ThresholdResolution::cv_fieldDefault) ); + } + else + { + r = &iv_maskResolutions.get(MaskResolution(maskId)); + } + + return *r; +} + +Resolution & ResolutionFactory::GetConnectedCalloutResolution( + TARGETING::TargetHandle_t i_psourceHandle, + TARGETING::TYPE i_targetType, + uint32_t i_idx, + PRDpriority i_priority, + Resolution * i_altResolution ) +{ + prdfCalloutConnected key( i_psourceHandle, + i_targetType, + i_idx, + i_priority, + i_altResolution ); + + return iv_connectedCallouts.get(key); +} + +Resolution & ResolutionFactory::GetAnalyzeConnectedResolution( + TARGETING::TargetHandle_t i_psourceHandle, + TARGETING::TYPE i_targetType, + uint32_t i_idx ) +{ + PrdfAnalyzeConnected key( i_psourceHandle, i_targetType, i_idx ); + + return iv_analyzeConnected.get(key); +} + +Resolution & ResolutionFactory::GetPluginCallResolution( + PrdfExtensibleChip * i_chip, PrdfExtensibleChipFunction * i_function) +{ + return iv_pluginCallFW.get(PrdfPluginCallResolution(i_chip,i_function)); +} + +Resolution & ResolutionFactory::GetThresholdSigResolution( + const ThresholdResolution::ThresholdPolicy & policy ) +{ + return iv_thresholdSigFW.get(ThresholdSigResolution(policy)); +} + +Resolution & ResolutionFactory::GetEregResolution(ErrorRegisterType & er) +{ + return iv_eregResolutionFW.get(EregResolution(er)); +} + +Resolution & ResolutionFactory::GetTryResolution( Resolution & tryRes, + Resolution & defaultRes ) +{ + return iv_tryResolutionFW.get(TryResolution(tryRes,defaultRes)); +} + +Resolution & ResolutionFactory::GetFlagResolution(ServiceDataCollector::Flag flag) +{ + return iv_flagResolutionFW.get(FlagResolution(flag)); +} + +#ifdef __HOSTBOOT_MODULE +Resolution & ResolutionFactory::GetDumpResolution( + /* FIXME: hwTableContent iDumpRequestContent, */ + TARGETING::TargetHandle_t i_pDumpHandle ) +{ + return iv_dumpResolutionFW.get(DumpResolution(/*FIXME: iDumpRequestContent,*/ i_pDumpHandle)); +} +#else +Resolution & ResolutionFactory::GetDumpResolution( + hwTableContent iDumpRequestContent, + TARGETING::TargetHandle_t i_pDumpHandle ) +{ + return iv_dumpResolutionFW.get(DumpResolution(iDumpRequestContent, i_pDumpHandle)); +} +#endif + +Resolution & ResolutionFactory::GetGardResolution(GardResolution::ErrorType et) +{ + return iv_gardResolutionFW.get(GardResolution(et)); +} + +Resolution & ResolutionFactory::GetCaptureResolution + (PrdfExtensibleChip * i_chip, + uint32_t i_group) +{ + return iv_captureResolutionFW.get(PrdfCaptureResolution(i_chip,i_group)); +} + +Resolution & ResolutionFactory::GetClockResolution( + TARGETING::TargetHandle_t i_pClockHandle, + TARGETING::TYPE i_targetType ) +{ + return iv_clockResolutionFW.get( PrdfClockResolution(i_pClockHandle, + i_targetType) ); +} + +void ResolutionFactory::Reset() +{ + PRDF_INF( "ResolutionFactory.Reset()" ); + + iv_thresholdResolutions.clear(); + iv_Links.clear(); // we must clear this because it could have links to Thresholds + iv_pluginCallFW.clear(); + iv_thresholdSigFW.clear(); + iv_eregResolutionFW.clear(); + iv_tryResolutionFW.clear(); + iv_captureResolutionFW.clear(); //dgxx + iv_connectedCallouts.clear(); // Clear because the "alt resolution" could have be a link or other cleared resolution. + iv_clockResolutionFW.clear(); //jl01a + +} +// dg03a end +// Change Log ************************************************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- --------- ---- -------- -------- --------------------------------------------------------- +// 02/28/97 DGILBERT Initial Creation +// D49274.11 v4r5 01/20/99 SERAFIN Increased MAX_CALLOUT_RESOLUTIONS and MAX_LINKS +// D49420.1 v5r2 07/17/00 mkobler Add interface which uses ChipEnums +// d49420.2 v5r2 09/20/00 dgilbert increase link vector size +// d49420.7 v5r2 11/10/00 dgilbert move GetCalloutResolution(CHIP_ID...) +// to xspprdCondorOnly.C +// d49420.7 v5r2 11/20/00 mkobler change default list/link size +// d49420.10 v5r2 01/16/00 mkobler change default callout list size +// dg00 p4907689 v5r2 02/22/01 dgilbert link/list size += 1000 +// csp 07/11/01 dgilbert rewrite to solve size problem +// dg01 fips 08/09/02 dgilbert rewrite using FlyWeight template +// dg02 400647 fips 03/24/03 dgilbert add GetThresholdResolution() +// dg04 493306 235 03/01/05 dgilbert Add prdfCalloutConnected +// 497866 235 03/29/05 dgilbert add idx & priority to prdfCalloutConnected +// dg05 498293 310 04/06/05 dgilbert add analyzeConnected +// pw01 F527129 f300 10/31/05 iawillia Move inlined code to .C so it compiles. +// ecdf F550548 f300 05/04/06 iawillia eClipz DUMP flags support. +// dg05 f310 05/18/07 dgilbert Clear iv_captureResolutoinFW to prevent memory leak. +// End Change Log ********************************************************************************* diff --git a/src/usr/diag/prdf/common/framework/resolution/iipResolutionFactory.h b/src/usr/diag/prdf/common/framework/resolution/iipResolutionFactory.h new file mode 100755 index 000000000..a37fdfa98 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/iipResolutionFactory.h @@ -0,0 +1,453 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/iipResolutionFactory.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1997,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 iipResolutionFactory_h +#define iipResolutionFactory_h + +/** + @file iipResolutionFactory.h + @brief ResolutionFactory declairation + */ +// Class Description ************************************************* +// +// Name: ResolutionFactory +// Base class: None +// +// Description: Maintains a pool of Analysis Resolutions such that only +// one instance of a particular Resolution object exists. +// (flyweight) +// Usage: +// +// ResolutionFactory & resolutionPool = ResolutionFactory::Access(); +// FinalResolution & fr = resolutionPool.GetCalloutResolution(EAGLE0_HIGH); +// +// +// End Class Description ********************************************* + +//#include <xspprdIfCondor.h> // #define CSP_CONDOR + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#if !defined(IIPCONST_H) +#include <iipconst.h> +#endif + +#if !defined(PRDFFLYWEIGHT_H) // dg01 +#include <prdfFlyWeight.H> // dg01 +#include <prdfFlyWeightS.H> +#endif // dg01 + +#if !defined(iipCalloutResolution_h) +#include <iipCalloutResolution.h> +#endif + +#if !defined(PRDFTHRESHOLDRESOLUTIONS_H) // dg02a +#include <prdfThresholdResolutions.H> // dg02a +#endif // dg02a + +#include <prdfCalloutConnected.H> // dg04a +#include <prdfAnalyzeConnected.H> // dg05a +#include <prdfPluginCallResolution.H> // dg06a +#include <iipEregResolution.h> // dg06a +#include <xspprdTryResolution.h> // dg06a +#include <xspprdFlagResolution.h> // dg06a +#include <xspprdDumpResolution.h> // dg06a +#include <xspprdGardResolution.h> // dg06a +#include <prdfCaptureResolution.H> // pw01 +#include <prdfClockResolution.H> // jl01a + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +/** + "Flyweight" factory of resolutions (singlton) + @version V4R5 + @author Douglas R. Gilbert +*/ +class ResolutionFactory +{ +public: + + /** + Access the ResolutionFactory singleton + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> Resolution factory + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Object created if it does not already exist + <br><b>Exceptions: </b> None. + </ul><br> + */ + static ResolutionFactory & Access(void); + + /** + DTOR + <ul> + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Resources released + <br><b>Exceptions: </b> None. + </ul><br> + */ + ~ResolutionFactory(); + + + // dg03a start + /** + Reset after a re-ipl + Clear the resolution lists that need clearing on a re-ipl + @note currently clears the threshold resolution list and the link resolution list + */ + void Reset(); + // dg03a end + + /** + Get a resolution that makes a callout + <ul> + <br><b>Parameter: </b> PRDcallout (see prdfCallouts.H) + <br><b>Parameter: </b> PRDpriority (see prdfCallouts.H) + <br><b>Returns: </b> Resolution & + <br><b>Requirements:</b> None. + <br><b>Promises: </b> If a resolution does not exist for this MruCallout + then one is created. + <br><b>Exceptions: </b> None. + <br><b>Note: </b> Regatta CSP use only + <br><b>Note: </b> Do not call this method from a static object + </ul><br> + */ + Resolution & GetCalloutResolution( PRDF::PRDcallout callout, + PRDF::PRDpriority p = PRDF::MRU_MED); + + /** + Get a threshold Resolution + @param Mask id to set when threshold is reached + @param policy (theshold value & time interval) during normal runtime (default is ???) + @param mfgPolicy for manufactoring mode (default is threshold one, infinate interval) + @return reference to a resolution + @pre None + @post appropriate Resolution created. + @note the iv_thresholdResoltion FlyWeight is cleared by this->Reset() + */ + MaskResolution & GetThresholdResolution(uint32_t maskId, + const ThresholdResolution::ThresholdPolicy& policy, + const ThresholdResolution::ThresholdPolicy& mfgPolicy); + + MaskResolution & GetThresholdResolution(uint32_t maskId, + const ThresholdResolution::ThresholdPolicy& policy); + + MaskResolution & GetThresholdResolution(uint32_t maskId); + MaskResolution & GetThresholdResolution(uint32_t maskId, + const ThresholdResolution::ThresholdPolicy* policy); + + // dg04a - start + /** + GetConnectedCalloutResolution + @param i_psourceHandle handle of connection source + @param i_targetType Type of target connected to i_source + @param idx index in GetConnected list to use + @param i_priority @see prdfCallouts.H + @param i_altResolution to use if the connection does not exist, is not functional, or is invalid. + If NULL than the connection source is called-out + @note Don't use this to callout clocks - use prdfClockResolution + */ + Resolution & GetConnectedCalloutResolution(TARGETING::TargetHandle_t i_psourceHandle, + TARGETING::TYPE i_targetType, + uint32_t i_idx = 0, + PRDF::PRDpriority i_priority = PRDF::MRU_MED, + Resolution * i_altResolution = NULL); + // dg04a - end + + // dg05a - start + /** + * GetAnalyzeConnectedResoltuion + * @param i_psourceHandle handle of connection source + * @param i_targetType type of desired unit that's connected to the source + * @param i_dx index in GetConnected list to analyze + */ + Resolution & GetAnalyzeConnectedResolution(TARGETING::TargetHandle_t i_psourceHandle, + TARGETING::TYPE i_targetType, + uint32_t i_idx =0xffffffff ); + // dg05a - end + // dg06a - start + /** + * Get a PrdfPluginCallResolution + * @param ptr to PrdfExtensibleChip + * @param ptr to PrdfExtensibleFunction + * @post one instance with these params will exist + * @This flyweight is cleared by this->Reset() + */ + Resolution & GetPluginCallResolution(PrdfExtensibleChip * i_chip, + PrdfExtensibleChipFunction * i_function); + + /** + * Get a threshold signature resolution + * @param policy (either enum or uint32_t) + * @post one instance with this policy will exist + * @this flyweight is cleared by this->Reset() + */ + Resolution & GetThresholdSigResolution(const ThresholdResolution::ThresholdPolicy& policy); + + + /** + * Get an EregResolution + * @param Error register + * @post one instance with the param will exist + * @note the error register provided must remain in scope as long as the Resolution Factory + * @note This Flyweight is cleared by this->Reset() + */ + Resolution & GetEregResolution(ErrorRegisterType & er); + + /** + * Get a TryResolution + * @param Resolution to try + * @param Resolution to use if the first one returns a non-zero return code + * @post one instance with these params will exist + * @note The resolutions provided mus remain in scope as long as the Resolution Factory + * @note This Flyweight is cleared by this->Reset() + */ + Resolution & GetTryResolution(Resolution &tryRes, Resolution & defaultRes); + + /** + * Get a FlagResolution + * @param servicedatacollector::flag + * @post only one instance of this object with this param will exist + */ + Resolution & GetFlagResolution(ServiceDataCollector::Flag flag); + + /** + * Get a DumpResolution + * @param dump flags + * @post only one instance of this obect with these paramaters will exist + */ + #ifdef __HOSTBOOT_MODULE + Resolution & GetDumpResolution(/* FIXME: hwTableContent iDumpRequestContent = CONTENT_HW,*/ + TARGETING::TargetHandle_t i_pDumpHandle = NULL); + #else + Resolution & GetDumpResolution(hwTableContent iDumpRequestContent = CONTENT_HW, + TARGETING::TargetHandle_t i_pDumpHandle = NULL); + #endif + + /** + * Get a Gard Resolution + * @param The Gard Flag + * @post only one instance of this object with this param will exist + */ + Resolution & GetGardResolution(GardResolution::ErrorType et); + + // dg06a - end + + /** + * Get a Capture Resolution + * @param i_chip - The extensible chip to capture from. + * @param i_group - The group to capture. + * @post only one instance of this object with this param will exist + */ + Resolution & GetCaptureResolution(PrdfExtensibleChip * i_chip, + uint32_t i_group); + + /** + * Get a ClockResolution + * @param + * @post only one instance of this obect with these paramaters will exist + */ + // FIXME: Need support for clock targets + // FIXME: Need support for clock targets types + Resolution & GetClockResolution(TARGETING::TargetHandle_t i_pClockHandle =NULL, + TARGETING::TYPE i_targetType = TARGETING::TYPE_PROC); //should be repla +/** + Link resolutions to form a single resolution performing the actions of them all + <ul> + <br><b>Parameters: </b> Resolutions + <br><b>Returns: </b> Resolution & + <br><b>Requirements:</b> Valid resolutions given + <br><b>Promises: </b> LinkResolutions(r1,r2...).Resolve(); == + r1.Resolve(), r2.Resolve(), ...; + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Do not call this method from a static object + <br><b>Notes: </b> The iv_Links Flyweight is cleared by this->Reset() + </ul><br> + */ + Resolution & LinkResolutions(Resolution &r1, Resolution &r2); + /** + Link resolutions to form a single resolution performing the actions of them all + <ul> + <br><b>Parameters: </b> Resolutions + <br><b>Returns: </b> Resolution & + <br><b>Requirements:</b> Valid resolutions given + <br><b>Promises: </b> LinkResolutions(r1,r2...).Resolve(); == + r1.Resolve(), r2.Resolve(), ...; + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Do not call this method from a static object + </ul><br> + */ + Resolution & LinkResolutions(Resolution &r1, Resolution &r2, Resolution &r3); + /** + Link resolutions to form a single resolution performing the actions of them all + <ul> + <br><b>Parameters: </b> Resolutions + <br><b>Returns: </b> Resolution & + <br><b>Requirements:</b> Valid resolutions given + <br><b>Promises: </b> LinkResolutions(r1,r2...).Resolve(); == + r1.Resolve(), r2.Resolve(), ...; + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Do not call this method from a static object + </ul><br> + */ + Resolution & LinkResolutions(Resolution &r1, Resolution &r2, Resolution &r3, + Resolution &r4); + /** + Link resolutions to form a single resolution performing the actions of them all + <ul> + <br><b>Parameters: </b> Resolutions + <br><b>Returns: </b> Resolution & + <br><b>Requirements:</b> Valid resolutions given + <br><b>Promises: </b> LinkResolutions(r1,r2...).Resolve(); == + r1.Resolve(), r2.Resolve(), ...; + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Do not call this method from a static object + </ul><br> + */ + Resolution & LinkResolutions(Resolution &r1, Resolution &r2, Resolution &r3, + Resolution &r4, Resolution &r5); + +private: // functions + + /** + private CTOR + <ul> + <br><b>Requirements:</b> May only be called once + <br><b>Promises: </b> Object created + <br><b>Exceptions: </b> None. + </ul><br> + */ + ResolutionFactory() {} + + ResolutionFactory(const ResolutionFactory &f); // not allowed + ResolutionFactory & operator=(const ResolutionFactory &f); // not allowed + +public: + /** + Link resolutions together + @author Douglas R. Gilbert + @version V4R3 + */ + class ResolutionLink: public Resolution + { + public: + ResolutionLink(): Resolution(), xlnk1(NULL), xlnk2(NULL) {} + ResolutionLink(Resolution & r1, Resolution & r2) + : Resolution(), xlnk1(&r1), xlnk2(&r2) {} + ResolutionLink(const ResolutionLink & rl) + : xlnk1(rl.xlnk1), xlnk2(rl.xlnk2) {} + bool operator==(const ResolutionLink & r) const + { return (xlnk1 == r.xlnk1 && xlnk2 == r.xlnk2); }; + bool operator<(const ResolutionLink & r) const + { + if (xlnk1 == r.xlnk1) + return xlnk2 < r.xlnk2; + return xlnk1 < r.xlnk1; + }; + bool operator>=(const ResolutionLink & r) const + { + if (xlnk1 == r.xlnk1) + return xlnk2 >= r.xlnk2; + return xlnk1 >= r.xlnk1; + }; + + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & serviceData); + private: // data + Resolution * xlnk1; + Resolution * xlnk2; + }; + +private: // Data + + // dg01 - start + typedef FlyWeight< CalloutResolution, 50> CalloutFW; // dg01a + typedef FlyWeightS< ResolutionLink, 50> ResolutionLinkFW; // dg01a + + typedef FlyWeight< ThresholdResolution, 50 > ThresholdResolutionList; // dg02a + typedef FlyWeight< MaskResolution, 50 > MaskResolutionFW; // dg02a + + typedef FlyWeight< prdfCalloutConnected, 25 > ConnectedFW; // dg04a + typedef FlyWeight< PrdfAnalyzeConnected, 20 > AnalyzeCFW; // dg05a + typedef FlyWeight< PrdfPluginCallResolution, 10 > PluginCallFW; // dg06a + typedef FlyWeight< ThresholdSigResolution, 10 > ThresholdSigFW; // dg06a + typedef FlyWeight< EregResolution, 50 > EregResolutionFW; // dg06a + typedef FlyWeight< TryResolution, 20 > TryResolutionFW; // dg06a + typedef FlyWeight< FlagResolution, 5 > FlagResolutionFW; // dg06a + typedef FlyWeight< DumpResolution, 5 > DumpResolutionFW; // dg06a + typedef FlyWeight< GardResolution, 5 > GardResolutionFW; // dg06a + typedef FlyWeight< PrdfCaptureResolution, 5> CaptureResolutionFW; // pw01 + typedef FlyWeight< PrdfClockResolution, 8 > ClockResolutionFW; // jl01a + + CalloutFW iv_Callouts; // dg01a + ResolutionLinkFW iv_Links; // dg01a + + ThresholdResolutionList iv_thresholdResolutions; // dg02a + MaskResolutionFW iv_maskResolutions; // dg02a + // dg01 - end + ConnectedFW iv_connectedCallouts; // dg04a + AnalyzeCFW iv_analyzeConnected; // dg05a + PluginCallFW iv_pluginCallFW; // dg06a + ThresholdSigFW iv_thresholdSigFW; // dg06a + EregResolutionFW iv_eregResolutionFW; // dg06a + TryResolutionFW iv_tryResolutionFW; // dg06a + FlagResolutionFW iv_flagResolutionFW; // dg06a + DumpResolutionFW iv_dumpResolutionFW; // dg06a + GardResolutionFW iv_gardResolutionFW; // dg06a + CaptureResolutionFW iv_captureResolutionFW; // pw01 + ClockResolutionFW iv_clockResolutionFW; // jl01a + +}; + +inline +Resolution & ResolutionFactory::LinkResolutions(Resolution &r1, + Resolution &r2, + Resolution &r3) +{ + return LinkResolutions(LinkResolutions(r1,r2),r3); +} + +inline +Resolution & ResolutionFactory::LinkResolutions(Resolution &r1, + Resolution &r2, + Resolution &r3, + Resolution &r4) +{ + return LinkResolutions(LinkResolutions(r1,r2),LinkResolutions(r3,r4)); +} + +inline +Resolution & ResolutionFactory::LinkResolutions(Resolution &r1, + Resolution &r2, + Resolution &r3, + Resolution &r4, + Resolution &r5) +{ + return LinkResolutions(LinkResolutions(r1,r2),LinkResolutions(r3,r4,r5)); +} + +#endif /* iipResolutionFactory_h */ diff --git a/src/usr/diag/prdf/common/framework/resolution/iipResolutionList.h b/src/usr/diag/prdf/common/framework/resolution/iipResolutionList.h new file mode 100755 index 000000000..61ceca97c --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/iipResolutionList.h @@ -0,0 +1,185 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/iipResolutionList.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 iipResolutionList_h +#define iipResolutionList_h + +// Class Description ************************************************* +// +// Name: ResolutionList +// Base class: Resolution +// +// Description: A Resolution whose Resolve function calls the Resolve +// function on each Resolution in a List of Resolutions. +// Usage: +// +// MruCallout calloutList[] = {PU0,PU1}; +// FinalResolution r1(calloutList,2); +// CaptureResolution r2(someScanCommRegister); +// +// ResolutionList rl(&r1,&r2); // up to 4 resolutions +// +// ResolutionMap rm(...); // see iipResolutionMap.h +// rm.Add(BIT_LIST_STRING_01,&rl); // When bit 1 is on perform r1 and r2 +// +// End Class Description ********************************************* +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#if !defined(iipResolution_h) +#include <iipResolution.h> +#endif + +#include <vector> + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +class ResolutionList : public Resolution +{ +public: + ResolutionList(Resolution * r1,Resolution * r2); + ResolutionList(Resolution * r1,Resolution * r2,Resolution * r3); + ResolutionList(Resolution * r1,Resolution * r2,Resolution * r3,Resolution * r4); + ResolutionList(Resolution * r1,Resolution * r2,Resolution * r3, + Resolution * r4,Resolution * r5); + ResolutionList(Resolution * r1,Resolution * r2,Resolution * r3, + Resolution * r4,Resolution * r5,Resolution * r6); + // Function Specification ******************************************** + // + // Purpose: Constructor + // Parameters: r1 - r4: 2-4 Resolutions to perform as one resolution + // Returns: Nothing + // Requirements: None + // Promises: Object created + // Exceptions: None + // Concurrency: synchronous + // Notes: + // + // End Function Specification **************************************** + + //~ResolutionList(); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: Compiler default is ok + // + // End Function Specification **************************************** + + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & error); + // Function Specification ******************************************** + // + // Purpose: Resolve service data for a specific error bit (Pure Virtual) + // Parameters: Reference to the Step code data structure + // Returns: return code + // Requirements: None + // Promises: if rc = SUCCESS then data filled with apropriate service data + // Exceptions: None + // Concurrency: synchronous + // Notes: if rc != SUCCESS then state of service data is unpredictable + // + // End Function Specification **************************************** + +private: // functions + + ResolutionList(const ResolutionList &rl); // not allowed + ResolutionList & operator=(const ResolutionList &rl); // not allowed + +private: // Data + + std::vector<void *> resolutionList; // use void * to reduce template code bloat + +}; + +inline +ResolutionList::ResolutionList(Resolution * r1,Resolution * r2) +{ + resolutionList.reserve(2); + resolutionList.push_back(r1); + resolutionList.push_back(r2); +} + +inline +ResolutionList::ResolutionList(Resolution * r1,Resolution * r2,Resolution * r3) +{ + resolutionList.reserve(3); + resolutionList.push_back(r1); + resolutionList.push_back(r2); + resolutionList.push_back(r3); +} + +inline +ResolutionList::ResolutionList(Resolution * r1,Resolution * r2, + Resolution * r3,Resolution * r4) +{ + resolutionList.reserve(4); + resolutionList.push_back(r1); + resolutionList.push_back(r2); + resolutionList.push_back(r3); + resolutionList.push_back(r4); +} + +inline +ResolutionList::ResolutionList(Resolution * r1,Resolution * r2, + Resolution * r3,Resolution * r4, + Resolution * r5) +{ + resolutionList.reserve(5); + resolutionList.push_back(r1); + resolutionList.push_back(r2); + resolutionList.push_back(r3); + resolutionList.push_back(r4); + resolutionList.push_back(r5); +} + +inline +ResolutionList::ResolutionList(Resolution * r1,Resolution * r2, + Resolution * r3,Resolution * r4, + Resolution * r5,Resolution * r6) +{ + resolutionList.reserve(6); + resolutionList.push_back(r1); + resolutionList.push_back(r2); + resolutionList.push_back(r3); + resolutionList.push_back(r4); + resolutionList.push_back(r5); + resolutionList.push_back(r6); +} + + +#endif /* iipResolutionList_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- ----- ------------------------------- +// d24758.1 v4r1 05/30/96 DRG Initial Creation +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/resolution/iipResolutionMap.h b/src/usr/diag/prdf/common/framework/resolution/iipResolutionMap.h new file mode 100755 index 000000000..04dab5482 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/iipResolutionMap.h @@ -0,0 +1,24 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/iipResolutionMap.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 */ + +#include <prdfResolutionMap.H> diff --git a/src/usr/diag/prdf/common/framework/resolution/iipTerminateResolution.h b/src/usr/diag/prdf/common/framework/resolution/iipTerminateResolution.h new file mode 100755 index 000000000..0e86c85d9 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/iipTerminateResolution.h @@ -0,0 +1,139 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/iipTerminateResolution.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1997,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 iipTerminateResolution_h +#define iipTerminateResolution_h + +// Class Description ************************************************* +// +// Name: TerminateResolution +// Base class: Resolution +// +// Description: This module contains the Processor Runtime +// Diagnostics TerminateResolution class declaration. +// TerminateResolution provides a mechanism to terminate +// the operation of the machine on a recovered error attention +// after PRD exists. +// This resolution was made to be used with other Resolutions in +// a resolution list. +// +// Usage: Abstract base class +// +// Static Globals +// TerminateResolution bringDownMachine(); +// FinalResolution co(&someMruList); +// ResolutionList resolution (&co,&bringDownMachine); +// +// int32_t foo(ResolutionMap &resolutionMap) +// { +// resolutionMap.Add(BIT_LIST_STRING_01,&resolution); +// } +// ... +// int32_t foo(STEP_CODE_DATA_STRUCT &serviceData, +// ResolutionMap &map) +// { +// Resolution &r = map.LookUp(BIT_LIST_STRING_01); +// int32_t rc = r.Resolve(serviceData); // flag the termination of machine +// return(rc); +// } +// +// End Class Description ********************************************* +/*--------------------------------------------------------------------*/ + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#if !defined(iipResolution_h) +#include <iipResolution.h> +#endif + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +class TerminateResolution: public Resolution +{ +public: + TerminateResolution(); + // Function Specification ******************************************** + // + // Purpose: Constructor + // Parameters: None + // Returns: Nothing + // Requirements: None + // Promises: Object created + // Exceptions: None + // Concurrency: synchronous + // Notes: + // + // End Function Specification **************************************** + // virtual ~TerminateResolution(); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: The compiler default is sufficient + // + // End Function Specification **************************************** + + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & data); + // Function Specification ******************************************** + // + // Purpose: Tells the ServiceDataCollector (data) that machine operation + // needs to be terminated. + // Parameters: Reference to the ServiceDataCollector + // Returns: Return code (rc) + // Requirements: None + // Promises: data.serviceData->Terminate() == TRUE + // Exceptions: None + // Concurrency: synchronous + // Notes: if rc != SUCCESS then state of service data is unpredictable + // + // End Function Specification **************************************** + + + // Copy ctor - compiler default is sufficient + // Assignment - compiler default is sufficient + +private: // functions +private: // Data + + +}; + +inline +TerminateResolution::TerminateResolution(): Resolution() {} + +#endif /* iipResolution_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- ----- ------------------------------- +// V4R1 09/13/96 DRG Created +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/resolution/iipThresholdResolution.h b/src/usr/diag/prdf/common/framework/resolution/iipThresholdResolution.h new file mode 100755 index 000000000..41da01a7a --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/iipThresholdResolution.h @@ -0,0 +1,158 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/iipThresholdResolution.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 iipThresholdResolution_h +#define iipThresholdResolution_h + +// Class Description ************************************************* +// +// Name: ThresholdResolution +// Base class: Resolution +// +// Description: Resolution that has a threshold and keeps track of how +// many times its called. When the threshold is reached, it +// tells the service data collector and sends it a mask id. +// Usage: +// +// MruCallout callout[] = {PU0}; +// enum { thresholdValue = 32, MaskId = 05 }; +// ThresholdResolution tr(thresholdValue,MaskId); +// FinalResolution fr(callout,1); +// ResolutionList rl(&tr,&fr); +// ResolutionMap rm(...); +// rm.Add(BIT_LIST_STRING_05,&rl); // Resolution invoked when bit 5 +// is on - callsouts callout and +// thresholds at thresholdValue +// +// End Class Description ********************************************* + +/** + @file iipThresholdResolution.h + @brief PRD ThresholdResolution class declairation +*/ + +#include <prdfThresholdResolutions.H> +#warning This part is obsolite + +#if defined(_OBSOLITE_) +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#if !defined(iipResolution_h) +#include <iipResolution.h> +#endif + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +class ThresholdResolution : public Resolution +{ +public: + ThresholdResolution(uint16_t thresholdValue, uint32_t mask_id); +// ThresholdResolution(uint16_t thresholdValue, uint32_t mask_id, Resolution &r); + // Function Specification ******************************************** + // + // Purpose: Constructor + // Parameters: thresholdValue: value at which threshold is reached + // mask_id: mask_id value to give to the service data + // Resolution: Another resolution to call when this one + // is called + // Returns: Nothing + // Requirements: None + // Promises: Object created + // Exceptions: None + // Concurrency: synchronous + // Notes: + // + // End Function Specification **************************************** + + // ~ThresholdResolution(); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: Compiler default ok + // + // End Function Specification **************************************** + + // copy ctor - Compiler default ok + // Assignment - Compiler default ok + + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & error); + // Function Specification ******************************************** + // + // Purpose: Resolve service data for a specific error bit + // Parameters: Reference to the Step code data structure + // Returns: return code + // Requirements: None + // Promises: count++; + // if count > threshold then + // error.service_data->IsAtThreshold() == TRUE + // maskId sent to error.service_data + // Exceptions: None + // Concurrency: synchronous + // Notes: if rc != SUCCESS then state of service data is unpredictable + // + // End Function Specification **************************************** + + +private: // functions +protected: // Data + + uint16_t threshold; // dg00c + uint16_t count; // dg00c + uint32_t maskId; // dg00c +// Resolution * xRes; +}; + +inline +ThresholdResolution::ThresholdResolution(uint16_t thresholdValue, uint32_t mask_id) +: Resolution(), threshold(thresholdValue), count(0), maskId(mask_id) //, xRes(NULL) +{} + +/* +inline +ThresholdResolution::ThresholdResolution(uint16_t thresholdValue, + uint32_t mask_id, + Resolution & r) +: Resolution(), threshold(thresholdValue), count(0), maskId(mask_id), xRes(&r) +{} +*/ +#endif // _OBSOLITE_ +#endif /* iipThresholdResolution_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ------ -------- ----- ------------------------------- +// d49127.1 v4r1m0 05/31/96 DRG Initial Creation +// dg00 390545 fsp 02/26/03 dgilbert increase size of vars +// dg01 400647 fips 03/31/03 dgilbert This part is going away (see prdfThreholdResolutions.H) +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/resolution/prdfAnalyzeConnected.H b/src/usr/diag/prdf/common/framework/resolution/prdfAnalyzeConnected.H new file mode 100755 index 000000000..c8598f4a8 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/prdfAnalyzeConnected.H @@ -0,0 +1,125 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/prdfAnalyzeConnected.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2005,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 PRDFANALYZECONNECTED_H +#define PRDFANALYZECONNECTED_H +/** + @file prdfAnalyzeConnected.H + @brief A resolution to analyze a connected chip determined at the time of + the error. +*/ + + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#include <iipResolution.h> +#include <prdfPlatServices.H> + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +struct STEP_CODE_DATA_STRUCT; + +/** + This resolution calls out a connected MRU. + @author Patrick Williams + @par + This resolution calls out a connected chip, but waits until the time of + the error to determine what's connected. This allows for runtime GARD, + dynamic failover and concurrent maintainance - without having to call + PRD to re-build itself. +*/ +class PrdfAnalyzeConnected : public Resolution +{ +public: + /** + default ctor + */ + PrdfAnalyzeConnected(void); + + /** + Constructor + @param i_psourceHandle target handle of connection source + @param i_targetType i_targetType of desired unit that's connected to i_psourceHandle + @param i_idx: index into getConnected list of chip. + */ + PrdfAnalyzeConnected(TARGETING::TargetHandle_t i_psourceHandle , + TARGETING::TYPE i_targetType, + uint32_t i_idx =0xffffffff ); + + // ~prdfAnalyzeConnected(); default dtor is sufficient + + /** + Determine chip object for current connected unit and call its analyze func. + @param service data collector + @pre None + @return SUCCESS | non-zero if chip not found. + @note if the call to getConnected yeilds an invalid homId than the altResolution is called. If the + altResolution is NULL than the source is added to the callout list. + */ + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & io_service_data); + + virtual bool operator==(const PrdfAnalyzeConnected & r) const; + +private: // functions +private: // Data + + TARGETING::TargetHandle_t iv_psourceHandle; + TARGETING::TYPE iv_targetType; + uint32_t iv_idx; +}; + +inline PrdfAnalyzeConnected::PrdfAnalyzeConnected(void) + : iv_psourceHandle(NULL), + iv_targetType(TARGETING::TYPE_NA), + iv_idx(0xffffffff) +{ +} + +inline PrdfAnalyzeConnected::PrdfAnalyzeConnected( + TARGETING::TargetHandle_t i_psourceHandle, + TARGETING::TYPE i_targetType, + uint32_t i_idx) + : iv_psourceHandle(i_psourceHandle), + iv_targetType(i_targetType), + iv_idx(i_idx) +{ +} + +inline bool PrdfAnalyzeConnected::operator==(const PrdfAnalyzeConnected & r) const +{ + return (iv_psourceHandle == r.iv_psourceHandle && + iv_targetType == r.iv_targetType && + iv_idx == r.iv_idx); +} + +#endif /* PRDFANALYZECONNECTED_H */ + +// Change Log ***************************************************************** +// +// Flag Reason Vers Date Coder Description +// ---- --------- ----- -------- -------- ------------------------------------ +// 498293 f310 03/31/05 iawillia Initial Creation +// End Change Log ************************************************************* diff --git a/src/usr/diag/prdf/common/framework/resolution/prdfCalloutConnected.H b/src/usr/diag/prdf/common/framework/resolution/prdfCalloutConnected.H new file mode 100755 index 000000000..3301daf7d --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/prdfCalloutConnected.H @@ -0,0 +1,139 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/prdfCalloutConnected.H $ */ +/* */ +/* 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 */ + +#ifndef PRDFCALLOUTCONNECTED_H +#define PRDFCALLOUTCONNECTED_H +/** + @file prdfCalloutConnected.H + @brief A resolution to callout a connected MRU determined at the time of the error. +*/ + + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#include <iipResolution.h> +#include <prdfPlatServices.H> +#include <prdfCallouts.H> + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +struct STEP_CODE_DATA_STRUCT; + +/** + This resolution calls out a connected MRU. + @author Doug Gilbert + @par + This resolution calls out a connected MRU, but waits until the time of the error + to determine whats connected. This allows for runtime GARD, dynamic failover and concurrent + maintainance - without having to call PRD to re-build itself. + @code + prdfCalloutConnected iv_callout(PROC, TYPE_MCS ....); + // ...... + // This will add the MCSs thats connected to this PROC to the callout list + iv_callout.Resolve(serviceData); + @endcode + @note Don't use this class to callout clocks - use prdfClockResolution +*/ +class prdfCalloutConnected : public Resolution +{ +public: + /** + default ctor + */ + prdfCalloutConnected(void); + + /** + Constructor + @param i_psourceHandle handle of connection source + @param i_targetType type of desired unit that's connected to i_psourceHandle + @param i_idx index into getConnected list to callout + (i_idx = 0xffffffff means callout the first valid target) + @param i_priority callout priority @see srci.H for priority values + @param i_altResolution to use if the connection does not exist or is invalid. + If NULL than source is called out + @note Don't use this class to callout clocks - use prdfClockResolution + */ + prdfCalloutConnected(TARGETING::TargetHandle_t i_psourceHandle, + TARGETING::TYPE i_targetType, + uint32_t i_idx =0xffffffff , + PRDF::PRDpriority i_priority = PRDF::MRU_MED, + Resolution * i_altResolution = NULL); + + // ~prdfCalloutConnected(); default dtor is sufficient + + /** + Determine callout for current connected unit and add to the service data + @param service data collector + @pre None + @post service_data is complete + @return SUCCESS | non-zero + @note if the call to getConnected yeilds an invalid homId than the altResolution is called. If the + altResolution is NULL than the source is added to the callout list. + */ + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & io_service_data); + + virtual bool operator==(const prdfCalloutConnected & r) const; + +private: // functions +private: // Data + + TARGETING::TargetHandle_t iv_psourceHandle; + TARGETING::TYPE iv_targetType; + uint32_t iv_idx; + PRDF::PRDpriority iv_priority; + Resolution * iv_altResolution; +}; + +inline prdfCalloutConnected::prdfCalloutConnected(void) +: iv_psourceHandle(NULL), + iv_targetType(TARGETING::TYPE_NA), + iv_idx(0xffffffff ), + iv_priority(PRDF::MRU_LOW), + iv_altResolution(NULL) +{} + +inline prdfCalloutConnected::prdfCalloutConnected(TARGETING::TargetHandle_t i_psourceHandle, + TARGETING::TYPE i_targetType, + uint32_t i_idx, + PRDF::PRDpriority i_priority, + Resolution * i_altResolution) +: iv_psourceHandle(i_psourceHandle), + iv_targetType(i_targetType), + iv_idx(i_idx), + iv_priority(i_priority), + iv_altResolution(i_altResolution) +{} + +inline bool prdfCalloutConnected::operator==(const prdfCalloutConnected & r) const +{ + return (iv_psourceHandle == r.iv_psourceHandle && + iv_targetType == r.iv_targetType && + iv_idx == r.iv_idx && + iv_priority == r.iv_priority && + (iv_altResolution == r.iv_altResolution || &iv_altResolution == &r.iv_altResolution)); +} + +#endif /* PRDFCALLOUTCONNECTED_H */ diff --git a/src/usr/diag/prdf/common/framework/resolution/prdfCalloutMap.H b/src/usr/diag/prdf/common/framework/resolution/prdfCalloutMap.H new file mode 100644 index 000000000..a6b4ba8bf --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/prdfCalloutMap.H @@ -0,0 +1,140 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/prdfCalloutMap.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 __prdfCalloutMap_H +#define __prdfCalloutMap_H + +/** @file prdfCalloutMap.H */ + +#include <prdfEnums.H> + +//------------------------------------------------------------------------------ + +namespace PRDF +{ + +//------------------------------------------------------------------------------ + +#ifdef PRDF_RULE_COMPILER_ENUMS + + // Used only in the rule compiler. Sets up a map between string keywords in + // the rule code to the enum name. + + #define PRDF_SYM_CALLOUT_MAP_BEGIN \ + struct SymCallout_t { const char * str; SymbolicFru val; }; \ + SymCallout_t symCalloutArray[] = \ + { + + #define PRDF_SYM_CALLOUT_ALIAS(name1, name2) \ + { #name1 , name1 }, + + #define PRDF_SYM_CALLOUT_MAP_END \ + { NULL , (SymbolicFru) 0 } \ + }; + +#else + + #define PRDF_SYM_CALLOUT_MAP_BEGIN \ + enum SymbolicFru \ + { + + #define PRDF_SYM_CALLOUT_ALIAS(n1,n2) \ + n1 = n2, + + #define PRDF_SYM_CALLOUT_MAP_END \ + }; + +#endif + +PRDF_SYM_CALLOUT_MAP_BEGIN + +PRDF_SYM_CALLOUT_ALIAS( AllProcessors, EPUB_PRC_ALL_PROCS ) +PRDF_SYM_CALLOUT_ALIAS( PRD_Code_ENUM, EPUB_PRC_SP_CODE ) +PRDF_SYM_CALLOUT_ALIAS( SP_CODE, EPUB_PRC_SP_CODE ) +PRDF_SYM_CALLOUT_ALIAS( SystemSW_Code_ENUM, EPUB_PRC_PHYP_CODE ) +PRDF_SYM_CALLOUT_ALIAS( NextLevelSupport_ENUM, EPUB_PRC_LVL_SUPP ) +PRDF_SYM_CALLOUT_ALIAS( MEMBUS_ERROR_ENUM, EPUB_PRC_MEMBUS_ERROR ) +PRDF_SYM_CALLOUT_ALIAS( PassiveFabric_OnNode_ENUM, EPUB_PRC_PROC_XYZ_BUS ) +PRDF_SYM_CALLOUT_ALIAS( PassiveFabric_OffNode_ENUM, EPUB_PRC_PROC_AB_BUS ) + +PRDF_SYM_CALLOUT_MAP_END + +#undef PRDF_SYM_CALLOUT_MAP_BEGIN +#undef PRDF_SYM_CALLOUT_ALIAS +#undef PRDF_SYM_CALLOUT_MAP_END + +//------------------------------------------------------------------------------ + +#ifdef PRDF_RULE_COMPILER_ENUMS + + // Used only in the rule compiler. Sets up a map between string keywords in + // the rule code to the enum name. + + #define PRDF_CALLOUT_PRIORITY_MAP_BEGIN \ + struct CalloutPriority_t \ + { const char * str; CalloutPriorityEnum val; }; \ + CalloutPriority_t calloutPriorityArray[] = \ + { + + #define PRDF_CALLOUT_PRIORITY_ALIAS(name1, name2) \ + { #name1 , name1 }, + + #define PRDF_CALLOUT_PRIORITY_MAP_END \ + { NULL , (CalloutPriorityEnum) 0 } \ + }; + +#else + + #define PRDF_CALLOUT_PRIORITY_MAP_BEGIN \ + enum CalloutPriorityEnum \ + { + + #define PRDF_CALLOUT_PRIORITY_ALIAS(n1,n2) \ + n1 = n2, + + #define PRDF_CALLOUT_PRIORITY_MAP_END \ + }; + +#endif + +PRDF_CALLOUT_PRIORITY_MAP_BEGIN + +PRDF_CALLOUT_PRIORITY_ALIAS( MRU_HIGH, SRCI_PRIORITY_HIGH ) +PRDF_CALLOUT_PRIORITY_ALIAS( MRU_MED, SRCI_PRIORITY_MED ) +PRDF_CALLOUT_PRIORITY_ALIAS( MRU_MEDA, SRCI_PRIORITY_MEDA ) +PRDF_CALLOUT_PRIORITY_ALIAS( MRU_MEDB, SRCI_PRIORITY_MEDB ) +PRDF_CALLOUT_PRIORITY_ALIAS( MRU_MEDC, SRCI_PRIORITY_MEDC ) +PRDF_CALLOUT_PRIORITY_ALIAS( MRU_LOW, SRCI_PRIORITY_LOW ) + +PRDF_CALLOUT_PRIORITY_MAP_END + +#undef PRDF_CALLOUT_PRIORITY_MAP_BEGIN +#undef PRDF_CALLOUT_PRIORITY_ALIAS +#undef PRDF_CALLOUT_PRIORITY_MAP_END + +//------------------------------------------------------------------------------ + +} // end namespace PRDF + +#endif // __prdfCalloutMap_H + diff --git a/src/usr/diag/prdf/common/framework/resolution/prdfCallouts.H b/src/usr/diag/prdf/common/framework/resolution/prdfCallouts.H new file mode 100755 index 000000000..183ffb0ad --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/prdfCallouts.H @@ -0,0 +1,198 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/prdfCallouts.H $ */ +/* */ +/* 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 */ + +#ifndef prdfCallouts_H +#define prdfCallouts_H + +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ + +#ifndef __HOSTBOOT_MODULE + +#include <srci.H> + +#endif + +#if defined(PRD_SIM) +#include <iipException.h> // for throwing things +#endif + +#include <prdfCalloutMap.H> +#include <prdfEnums.H> +#include <prdfMemoryMru.H> +#include <prdfPlatServices.H> + +namespace PRDF +{ + +//------------------------------------------------------------------------------ + +typedef CalloutPriorityEnum PRDpriority; + +/** + * @brief Wrapper class for PRD callouts (TargetHandle_t, MemoryMru, and + * SymbolicFru). + * @note It is a requirement that all supported callout types have a 32-bit + * representation for storage in the service data collector. + * @note This is a simple container of callout types. It does not translate + * between the different types. + */ +class PRDcallout +{ + public: + + enum MruType + { + TYPE_NONE, + TYPE_TARGET, + TYPE_MEMMRU, + TYPE_SYMFRU, + }; + + /** @brief Constructor */ + PRDcallout() : iv_type(TYPE_NONE) + { iv_meldValue.u32 = 0; } + + /** @brief Constructor from TargetHandle_t */ + PRDcallout( TARGETING::TargetHandle_t i_target ) : iv_type(TYPE_TARGET) + { iv_meldValue.target = i_target; } + + /** @brief Constructor from PrdfMemoryMru */ + PRDcallout( const PrdfMemoryMru & i_memmru ) : iv_type(TYPE_MEMMRU) + { iv_meldValue.u32 = i_memmru.toUint32(); } + + /** @brief Constructor from SymbolicFru */ + PRDcallout( SymbolicFru i_symfru ) : iv_type(TYPE_SYMFRU) + { iv_meldValue.symfru = i_symfru; } + + /** @brief Constructor from raw data */ + PRDcallout( uint32_t i_val, MruType i_type ) : iv_type(i_type) + { + switch ( iv_type ) + { + case TYPE_TARGET: + iv_meldValue.target = PlatServices::getTarget(i_val); break; + case TYPE_MEMMRU: + case TYPE_SYMFRU: + iv_meldValue.u32 = i_val; break; + default: + iv_type = TYPE_NONE; + iv_meldValue.u32 = 0; + } + } + + /** @brief Assignment from TargetHandle_t */ + PRDcallout & operator=( TARGETING::TargetHandle_t i_target ) + { + iv_type = TYPE_TARGET; + iv_meldValue.target = i_target; + return *this; + } + + /** @brief Assignment from PrdfMemoryMru */ + PRDcallout & operator=( const PrdfMemoryMru & i_memmru ) + { + iv_type = TYPE_MEMMRU; + iv_meldValue.u32 = i_memmru.toUint32(); + return *this; + } + + /** @brief Assignment from SymbolicFru */ + PRDcallout & operator=( SymbolicFru i_symfru ) + { + iv_type = TYPE_SYMFRU; + iv_meldValue.symfru = i_symfru; + return *this; + } + + // NOTE: The == operator must be declared within the class definition. + // Meaning, you can't declare this outside the class: + // + // bool operator==( const PRDcallout & l, const PRDcallout & r ) const; + // + // Otherwise, the single-argument constructors listed above will do + // automatic type conversion, which will allow code like this: + // + // TargetHandle_t t; PrdfMemoryMru m; + // if ( t == m ) ... + // + // The safest way to prevent this is to make all of the single-argument + // constructors explicit. However, this will force us to create additional + // code to handle the different callout types. For example, + // ServiceDataCollector::SetCallout() will need to be implemented for each + // callout type. + + /** @brief Overloaded == operator */ + bool operator==( const PRDcallout & r ) const + { + if ( iv_type == r.iv_type ) + { + return ( TYPE_TARGET == iv_type ) + ? iv_meldValue.target == r.iv_meldValue.target + : iv_meldValue.u32 == r.iv_meldValue.u32; + } + + return false; + } + + /** @brief Returns the callout type. */ + MruType getType() const { return iv_type; } + + /** @returns Returns the TargetHandle_t. */ + TARGETING::TargetHandle_t getTarget() const { return iv_meldValue.target; } + + /** @returns Returns the PrdfMemoryMru. */ + PrdfMemoryMru getMemMru() const { return PrdfMemoryMru(iv_meldValue.u32); } + + /** @brief Returns a uint32_t representation of the callout */ + uint32_t flatten() const + { + switch ( iv_type ) + { + case TYPE_TARGET: + return PlatServices::getHuid(iv_meldValue.target); break; + case TYPE_MEMMRU: + case TYPE_SYMFRU: + return iv_meldValue.u32; break; + default: + return 0; + } + } + + private: + + MruType iv_type; + + union + { + TARGETING::TargetHandle_t target; + SymbolicFru symfru; + uint32_t u32; + } iv_meldValue; + +}; + +}; // end namespace PRDF + +#endif /* prdfCallouts_H */ diff --git a/src/usr/diag/prdf/common/framework/resolution/prdfCaptureResolution.C b/src/usr/diag/prdf/common/framework/resolution/prdfCaptureResolution.C new file mode 100755 index 000000000..183368389 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/prdfCaptureResolution.C @@ -0,0 +1,41 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/prdfCaptureResolution.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2006,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 */ + +#include <prdfCaptureResolution.H> +#include <iipServiceDataCollector.h> + +int32_t PrdfCaptureResolution::Resolve(STEP_CODE_DATA_STRUCT & i_error) +{ + if (NULL != iv_chip) + return iv_chip->CaptureErrorData(i_error.service_data->GetCaptureData(), + iv_captureGroup); + return SUCCESS; +}; + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// f310 08/31/06 iawillia Initial File Creation +// End Change Log ***************************************************** + diff --git a/src/usr/diag/prdf/common/framework/resolution/prdfCaptureResolution.H b/src/usr/diag/prdf/common/framework/resolution/prdfCaptureResolution.H new file mode 100755 index 000000000..e00d1cd7b --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/prdfCaptureResolution.H @@ -0,0 +1,73 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/prdfCaptureResolution.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2006,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 */ + +#include <iipResolution.h> +#include <prdfExtensibleChip.H> + +/** + * @class PrdfCaptureResolution + * @brief Adds a capture-group to the capture data when hitting an error. + */ +class PrdfCaptureResolution : public Resolution +{ + public: + PrdfCaptureResolution() : iv_chip(NULL), iv_captureGroup(0) {}; + + /** @fn PrdfCaptureResolution + * @brief Typical constructor. + * + * @param i_chip - Extensible chip object to capture from. + * @param i_group - Capture-group to gather. + */ + PrdfCaptureResolution(PrdfExtensibleChip * i_chip, + uint32_t i_captureGroup) + : iv_chip(i_chip), + iv_captureGroup(i_captureGroup) {}; + + /** @fn Resolve + * @brief Perform capture. + */ + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & i_error); + + /** + * Comparison operator to aid in ResolutionFactory. + */ + bool operator==(const PrdfCaptureResolution & i_rhs) + { return ((iv_chip == i_rhs.iv_chip) && + (iv_captureGroup == i_rhs.iv_captureGroup)); + }; + private: + + /** The chip to capture from */ + PrdfExtensibleChip * iv_chip; + /** The group id to capture */ + uint32_t iv_captureGroup; + +}; + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// f310 08/31/06 iawillia Initial File Creation +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/resolution/prdfClockResolution.C b/src/usr/diag/prdf/common/framework/resolution/prdfClockResolution.C new file mode 100755 index 000000000..e9590a995 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/prdfClockResolution.C @@ -0,0 +1,88 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/prdfClockResolution.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2001,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 */ + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define prdfClockResolution_C +#include <iipServiceDataCollector.h> +#include <prdfClockResolution.H> +#include <prdfPlatServices.H> +#undef prdfClockResolution_C + +//------------------------------------------------------------------------------ +// Member Function Specifications +//------------------------------------------------------------------------------ + +// Find the active clock source and blame it +int32_t PrdfClockResolution::Resolve(STEP_CODE_DATA_STRUCT & serviceData) +{ + using namespace TARGETING; + using namespace PRDF; + + uint32_t l_rc = SUCCESS; + // Use clock routines for CLOCK_CARD types. + // FIXME: RTC: 51628 will address clock target issue + if ( (iv_targetType == TYPE_PROC) || (iv_targetType == TYPE_MEMBUF) ) + { + // Get clock card. + TargetHandle_t l_ptargetClock = PlatServices::getClockId( + iv_ptargetClock, + iv_targetType ); + + // Find mux if no clock card available. + if(NULL == l_ptargetClock) + { + l_ptargetClock = PlatServices::getClockMux(iv_ptargetClock); + } + + // Callout this chip if nothing else. + if(NULL == l_ptargetClock) + { + l_ptargetClock = iv_ptargetClock; + } + + //Just callout the clock source. + //There is no clock target now so we don't want to make + //any incorrect callout until it's implemented. + //serviceData.service_data->SetCallout(l_ptargetClock); + } + // Get all connected chips for non-CLOCK_CARD types. + else + { + //Callout every device connected to this clock source. + TargetHandleList l_targetsConnectedToClock = + PlatServices::getConnected( iv_ptargetClock, iv_targetType ); + + for( TargetHandleList::iterator i = l_targetsConnectedToClock.begin(); + i != l_targetsConnectedToClock.end(); ++i ) + { + if ( NULL != (*i) ) + { + serviceData.service_data->SetCallout( *i ); + } + } + } + return(l_rc); +} + diff --git a/src/usr/diag/prdf/common/framework/resolution/prdfClockResolution.H b/src/usr/diag/prdf/common/framework/resolution/prdfClockResolution.H new file mode 100755 index 000000000..995522197 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/prdfClockResolution.H @@ -0,0 +1,111 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/prdfClockResolution.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2009,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 prdfClockResolution_H +#define prdfClockResolution_H +// Class Description ************************************************* +// +// Name: ClockResolution +// Base class: Resolution +// +// Description: Set dump information in Service Data Collector +// Usage: +// +// End Class Description ********************************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#if !defined(iipResolution_h) +#include <iipResolution.h> +#endif + +#include <prdfPlatServices.H> +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +class ServiceDataCollector; + +/** + Set dump information in the Service Data Collector + @author Mike Kobler + */ +class PrdfClockResolution : public Resolution +{ +public: + /** + Constructor + <ul> + <br><b>Parameters: </b> + <br><b>Returns: </b> Nothing + <br><b>Requirements:</b> None + <br><b>Promises: </b> Object created + <br><b>Exceptions: </b> None + <br><b>Notes: </b> + </ul><br> + */ + // FIXME: The default target type needs to be set to a PROC clock card. + PrdfClockResolution( TARGETING::TargetHandle_t i_pTargetHandle = NULL, + TARGETING::TYPE i_targetType = TARGETING::TYPE_PROC ) : + iv_ptargetClock(i_pTargetHandle), + iv_targetType(i_targetType) + {} + + /** + Resolve by adding a the MRU callout to the service data collector + <ul> + <br><b>Parameters: </b> ServiceDataCollector + <br><b>Returns: </b> Return code [SUCCESS | nonZero] + <br><b>Requirements:</b> none. + <br><b>Promises: </b> serviceData::GetMruList().GetCount()++ + serviceData::QueryDump() == this callout + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & data); + + /* + * base class defines operator== so one is needed here + * or the base class version will be used (bad) + */ + bool operator==(const PrdfClockResolution & r) const + { + return ((iv_ptargetClock == r.iv_ptargetClock) && (iv_targetType == r.iv_targetType)); + } + +private: // functions +private: // Data + + TARGETING::TargetHandle_t iv_ptargetClock; + TARGETING::TYPE iv_targetType ; +}; + + +#endif /* prdfClockResolution_H */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ------ -------- ------- ---------------------------- +// D725180 fips720 09/30/09 lukas Initial file creation. +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/resolution/prdfErrorTypeResolution.H b/src/usr/diag/prdf/common/framework/resolution/prdfErrorTypeResolution.H new file mode 100755 index 000000000..2b917d9fc --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/prdfErrorTypeResolution.H @@ -0,0 +1,110 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/prdfErrorTypeResolution.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 */ + +#ifndef prdfErrorTypeResolution_H +#define prdfErrorTypeResolution_H +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#if !defined(iipResolution_h) +#include <iipResolution.h> +#endif + +#if !defined(iipServiceDataCollector_h) +#include <iipServiceDataCollector.h> +#endif + +/** + @file prdfErrorTypeResolution.H + @brief Set the appropiate error type in the SDC and flag for + Gard if necessary. +*/ +class prdfErrorTypeResolution : public Resolution +{ +public: + + enum ErrorType + { + Repairable = 0, + Correctable = 1, + Uncorrectable = 2, + Fatal = 3, + Catastrophic = 4 + }; + + /** + 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 + <br><b>Notes: </b> + </ul><br> + */ + prdfErrorTypeResolution(ErrorType et) + : xErrorType(et) {} + + /* + 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 sufficient + </ul><br> + */ + // ~ErrorTypeResolution(); + + /** + Resolve by adding the error type to the service data collector + <ul> + <br><b>Parameters: </b> ServiceDataCollector + <br><b>Returns: </b> Return code [SUCCESS | nonZero] + <br><b>Requirements:</b> none. + <br><b>Promises: </b> sdc.GetErrorType() == ErrorType + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & sdc); + +private: // functions +private: // Data + + ErrorType xErrorType; + +}; + + +#endif /* prdfErrorTypeResolution_H */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- ------- ------------------------------- +// 02/26/03 mkobler Initial Creation +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/resolution/prdfIntervalThresholdResolution.H b/src/usr/diag/prdf/common/framework/resolution/prdfIntervalThresholdResolution.H new file mode 100755 index 000000000..25bf5ee0d --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/prdfIntervalThresholdResolution.H @@ -0,0 +1,189 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/prdfIntervalThresholdResolution.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2001,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 prdfIntervalThresholdResolution_H +#define prdfIntervalThresholdResolution_H + +/** + @file prdfIntervalThresholdResolution.H + @brief Common PRD IntervalThresholdResolution class declairation +*/ + +// Class Description ************************************************* +// +// Name: IntervalThresholdResolution +// Base class: Resolution +// +// Description: Resolution that has a threshold and keeps track of how +// many times its called within an interval of time. +// . When the threshold is reached within that time, it +// tells the service data collector and sends it a mask id, +// then resets the threshold count to 0. If the threshold +// is not reached within the specified interval, the +// interval is reset with the count at 1. +// Usage: +// +// MruCallout callout[] = {PU0}; +// enum { thresholdValue = 32, MaskId = 05 , Minutes = 60 }; +// Time intervalValue = 5 * Minutes; // Length set to 5 minutes +// IntervalThresholdResolution itr(thresholdValue,intervalValue,MaskId); +// FinalResolution fr(callout,1); +// ResolutionList rl(&itr,&fr); +// ResolutionMap rm(...); +// rm.Add(BIT_LIST_STRING_05,&rl); // Resolution invoked when bit 5 +// is on - callsout callout and +// thresholds at thresholdValue +// +// End Class Description ********************************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#include <prdfThresholdResolutions.H> +#warning this is an obsolite part + +#if defined(_OBSOLITE_) + +#if !defined(Resolution_h) + #include <iipThresholdResolution.h> +#endif + +#if !defined(PRDFTIMER_H) + #include <prdfTimer.H> +#endif +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +class IntervalThresholdResolution : public ThresholdResolution +{ +public: + /** + Constructor + @param thresholdValue at which threshold is reached + @param intervalValue length of time window (in seconds) + @param mask_id value given to the service data at threshold + @return nothing + @pre None + @post Object created + */ + IntervalThresholdResolution(uint16_t thresholdValue, uint32_t intervalLengthValue, uint32_t mask_id); + + /** + Constructor + @param thresholdValue at which threshold is reached + @param intervalValue length of time window (in seconds) + @param mask_id value given to the service data at threshold + @param Resolution to call from this one. + @return nothing + @pre None + @post Object created + */ +// IntervalThresholdResolution(uint16_t thresholdValue, uint32_t intervalLengthValue, uint32_t mask_id, +// Resolution & r); + + // ~IntervalThresholdResolution(); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: Compiler default ok + // + // End Function Specification **************************************** + + // copy ctor - Compiler default ok + // Assignment - Compiler default ok + + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & error); + // Function Specification ******************************************** + // + // Purpose: Resolve service data for a specific error bit + // Parameters: Reference to the Step code data structure + // Returns: return code + // Requirements: None + // Promises: count++; + // if currentTime is past intervalEndTime then + // count = 1 + // new intervalEndTime calculated based on currentTime + // else if count == threshold then + // error.service_data->IsAtThreshold() == TRUE + // maskId sent to error.service_data + // count = 0 + // else; // count still remains incremented + // Exceptions: None + // Concurrency: synchronous + // Notes: if rc != SUCCESS then state of service data is unpredictable + // + // End Function Specification **************************************** + + +private: // functions +private: // Data + +// uint8_t threshold; // moved to base class +// uint8_t count; +// uint16_t maskId; + uint32_t intervalLength; + PrdTimer intervalEndTime; +// Resolution * xRes; +}; + +inline +IntervalThresholdResolution::IntervalThresholdResolution(uint16_t thresholdValue, + uint32_t intervalLengthValue, + uint32_t mask_id) +: ThresholdResolution(thresholdValue,mask_id), intervalLength(intervalLengthValue), intervalEndTime() +{} + +/* +inline +IntervalThresholdResolution::IntervalThresholdResolution(uint16_t thresholdValue, + uint32_t intervalLengthValue, + uint32_t mask_id, + Resolution & r) +: ThresholdResolution(thresholdValue,mask_id,r), intervalLength(intervalLengthValue), intervalEndTime() +{} +*/ +#endif // _OBSOLITE_ +#endif /* prdfIntervalThresholdResolution_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ------ -------- ----- ------------------------------- +// ft637.1 csp 02/28/02 RAC Initial Creation +// 368019 fsp 09/03/02 dgilbert port to FSP +// 390545 fsp 02/26/03 dgilbert inherrit from TresholdResolution +// +// End Change Log ***************************************************** + + +/***************** END File prdfIntervalThresholdResolution.h +*********************************************************************/ +/********************************************************************/ diff --git a/src/usr/diag/prdf/common/framework/resolution/prdfPluginCallResolution.H b/src/usr/diag/prdf/common/framework/resolution/prdfPluginCallResolution.H new file mode 100755 index 000000000..95c97fecf --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/prdfPluginCallResolution.H @@ -0,0 +1,81 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/prdfPluginCallResolution.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2005,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 __PRDFPLUGINCALLRESOLUTION_H +#define __PRDFPLUGINCALLRESOLUTION_H + +#include <iipResolution.h> +#include <prdfExtensibleChip.H> +#include <prdfPluginDef.H> + +class PrdfPluginCallResolution : public Resolution +{ + private: + PrdfExtensibleChip * iv_chip; + PrdfExtensibleChipFunction * iv_function; + + public: + PrdfPluginCallResolution(void) + : iv_chip(NULL), iv_function(NULL) {} + + PrdfPluginCallResolution(PrdfExtensibleChip * i_chip, + PrdfExtensibleChipFunction * i_function) + : iv_chip(i_chip), iv_function(i_function) {}; + + PrdfPluginCallResolution & operator=(const PrdfPluginCallResolution & r) + { + iv_chip = r.iv_chip; + iv_function = r.iv_function; + return *this; + } + + bool operator==(const PrdfPluginCallResolution & r) + { + return (iv_chip == r.iv_chip)&&(iv_function == r.iv_function); + } + + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & i_error) + { + if ((NULL == iv_chip) || (NULL == iv_function)) + return -1; + + return (*iv_function) + (iv_chip, + PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(i_error) + ); //@pw01 + + }; + +}; + +#endif + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// iawillia initial creation +// F522283 f300 09/27/05 dgilbert add defaut ctor, operator==, operator= +// pw01 F522638 f300 09/27/05 iawillia Fix possible object strip in bindParm. +// End Change Log ***************************************************** + diff --git a/src/usr/diag/prdf/common/framework/resolution/prdfResetThresholdResolution.H b/src/usr/diag/prdf/common/framework/resolution/prdfResetThresholdResolution.H new file mode 100755 index 000000000..f991d4bb5 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/prdfResetThresholdResolution.H @@ -0,0 +1,129 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/prdfResetThresholdResolution.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 prdfResetThresholdResolution_H +#define prdfResetThresholdResolution_H +/** + @file prdfResetThresholdResolution.H + @brief Resolution that counts occurrances up to a threshold, then reports and resets + the count and starts counting again. +*/ + +#include <prdfThresholdResolutions.H> +#warning -This is an obsolite part + +#if defined(_OBSOLITE_) +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#ifndef iipResolution_h +#include <iipThresholdResolution.h> +#endif + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +/** + ResetThresholdResolution + @par + Resolution that has a threshold and keeps track of how + many times its called. When the threshold is reached, it + tells the service data collector and sends it a mask id, + then resets the threshold count to 0. + @code + enum { thresholdValue = 32, MaskId = 05 }; + ResetThresholdResolution rtr(thresholdValue,MaskId); + Resolution & fr = ResolutionFactory::Access().GetCalloutResolution(HOM_IOHUBCHIP0,MRU_HIGH); + ResolutionMap rm(...); // see ResolutionMap + rm.Add(BIT_LIST_STRING_05,&rtr,&ftr); // Resolution invoked when bit 5 + // is on - callsout callout and + // thresholds at thresholdValue + @endcode +*/ +class ResetThresholdResolution : public ThresholdResolution +{ +public: + /** + ctor + @param thresholdValue, error is reported when count == thresholdValue + @param maskId is send to the service data collector when threshold is reached + @pre none + @post internal count set to zero + @note If another resolution is chained to this one, it is always called reguardless of the count + */ + ResetThresholdResolution(uint16_t thresholdValue, uint32_t mask_id); + + /** + ctor + @param thresholdValue, error is reported when count == thresholdValue + @param maskId is send to the service data collector when threshold is reached + @param Another resolution to call (chained) after this one + @pre none + @post internal count set to zero + @note If another resolution is chained to this one, it is always called reguardless of the count + */ +// ResetThresholdResolution(uint32_t thresholdValue, uint32_t mask_id, Resolution &r); + + // ~ResetThresholdResolution(); compiler default is ok + // copy ctor - Compiler default ok + // Assignment - Compiler default ok + + /** + Resolve this part of the error (increment count) + @param error, Access to ServiceDataCollector @see ServiceDataCollector + @returns [SUCCESS| return code] + @pre none + @post 1) ++count. + 2) if count == threshold then error.service_data->IsAtThreshold() == true and + maskId is sent to serviceDataCollector. + 3)Chained resolution called if one was provided in ctor + */ + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & error); + + +private: // functions +private: // Data + +// uint8_t threshold; +// uint8_t count; +// uint16_t maskId; +// Resolution * xRes; +}; + +inline +ResetThresholdResolution::ResetThresholdResolution(uint16_t thresholdValue, uint32_t mask_id) +: ThresholdResolution(thresholdValue,mask_id) +{} + +/* +inline +ResetThresholdResolution::ResetThresholdResolution(uint32_t thresholdValue, + uint32_t mask_id, + Resolution & r) +: Resolution(), threshold(thresholdValue), count(0), maskId(mask_id), xRes(&r) +{} +*/ +#endif +#endif /* xspprdResetThresholdResolution_h */ diff --git a/src/usr/diag/prdf/common/framework/resolution/prdfResolutionList.H b/src/usr/diag/prdf/common/framework/resolution/prdfResolutionList.H new file mode 100755 index 000000000..1436e341b --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/prdfResolutionList.H @@ -0,0 +1,47 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/prdfResolutionList.H $ */ +/* */ +/* 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 */ + +#ifndef PRDFRESOLUTIONLIST_H +#define PRDFRESOLUTIONLIST_H +/** + @file prdfResolutionList.H + @brief List of resolutions +*/ +//#include <prdfResolution.H> +#include <iipResolution.h> + +#include<list> + +typedef std::list<Resolution *> prdfResolutionList; + +#define prdfResolution Resolution + +#endif /* PRDFRESOLUTIONLIST_H */ + +// Change Log ***************************************************************** +// +// Flag Reason Vers Date Coder Description +// ---- --------- ----- -------- -------- ------------------------------------ +// dgilbert Initial Creation +// +// End Change Log ************************************************************* diff --git a/src/usr/diag/prdf/common/framework/resolution/prdfResolutionMap.C b/src/usr/diag/prdf/common/framework/resolution/prdfResolutionMap.C new file mode 100755 index 000000000..ced75c0e9 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/prdfResolutionMap.C @@ -0,0 +1,381 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/prdfResolutionMap.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 prdfResolutionMap.C + * @brief prdfResolutionMap definition + */ + +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ + +#define prdfResolutionMap_C + +#include <string.h> + +#include <prdfResolutionMap.H> +#include <iipstep.h> +#include <iipServiceDataCollector.h> +#include <prdfErrorSignature.H> +#include <prdfMain.H> + +#undef prdfResolutionMap_C + +//------------------------------------------------------------------------------ + +void prdfResolutionMap::Add(uint8_t i_bitPos, + prdfResolution * i_res ) +{ + MapList::iterator i = iv_list.begin(); + while(i != iv_list.end()) + { + if (i->iv_blist == prdfBitKey()) // If empty bit string, skip. + { + } + else if( (i->iv_res == i_res) || (*(i->iv_res) == *i_res)) + { + i->iv_blist.setBit(i_bitPos); + break; + } + ++i; + } + if(i == iv_list.end()) + { + if(iv_list.capacity() == iv_list.size()) + { + iv_list.reserve(iv_list.size() + 10); + } + iv_list.push_back( RmPair(i_bitPos,i_res) ); + } +} + +//------------------------------------------------------------------------------ + +void prdfResolutionMap::Add( uint8_t i_bitPos, prdfResolution * i_r1, + prdfResolution * i_r2 ) +{ + Add(i_bitPos,i_r1); + Add(i_bitPos,i_r2); +} + +//------------------------------------------------------------------------------ + +void prdfResolutionMap::Add(uint8_t i_bitPos, + prdfResolution * i_r1, + prdfResolution * i_r2, + prdfResolution * i_r3) +{ + Add(i_bitPos,i_r1,i_r2); + Add(i_bitPos,i_r3); +} + +//------------------------------------------------------------------------------ + +void prdfResolutionMap::Add(uint8_t i_bitPos, + prdfResolution * i_r1, + prdfResolution * i_r2, + prdfResolution * i_r3, + prdfResolution * i_r4) +{ + Add(i_bitPos,i_r1,i_r2); + Add(i_bitPos,i_r3,i_r4); +} + +//------------------------------------------------------------------------------ + +void prdfResolutionMap::Add(uint8_t i_bitPos, + prdfResolution * i_r1, + prdfResolution * i_r2, + prdfResolution * i_r3, + prdfResolution * i_r4, + prdfResolution * i_r5) +{ + Add(i_bitPos,i_r1,i_r2,i_r3); + Add(i_bitPos,i_r4,i_r5); +} + +//------------------------------------------------------------------------------ + +void prdfResolutionMap::Add(uint8_t i_bitPos, + prdfResolution * i_r1, + prdfResolution * i_r2, + prdfResolution * i_r3, + prdfResolution * i_r4, + prdfResolution * i_r5, + prdfResolution * i_r6) +{ + Add(i_bitPos,i_r1,i_r2,i_r3); + Add(i_bitPos,i_r4,i_r5,i_r6); +} + +//------------------------------------------------------------------------------ + +void prdfResolutionMap::Add(uint8_t i_bitPos, + prdfResolution * i_r1, + prdfResolution * i_r2, + prdfResolution * i_r3, + prdfResolution * i_r4, + prdfResolution * i_r5, + prdfResolution * i_r6, + prdfResolution * i_r7) +{ + Add(i_bitPos,i_r1,i_r2,i_r3); + Add(i_bitPos,i_r4,i_r5,i_r6,i_r7); +} + +//------------------------------------------------------------------------------ + +void prdfResolutionMap::Add( const uint8_t *i_ble, + uint8_t i_bleLen, + prdfResolution * i_res ) +{ + MapList::iterator i = iv_list.begin(); + while(i != iv_list.end()) + { + if ((i->iv_blist == prdfBitKey()) || (0 == i_bleLen)) + { + // Empty bit string, skip. + } + else if( (i->iv_res == i_res) || (*(i->iv_res) == *i_res)) + { + for(uint32_t j = 0; j < (uint32_t)i_bleLen; ++j) + { + i->iv_blist.setBit(i_ble[j]); + } + break; + } + ++i; + } + if(i == iv_list.end()) + { + RmPair rmp; + rmp.iv_res = i_res; + for(uint32_t j = 0; j < (uint32_t)i_bleLen; ++j) + { + rmp.iv_blist.setBit(i_ble[j]); + } + if(iv_list.capacity() == iv_list.size()) + { + iv_list.reserve(iv_list.size() + 10); + } + iv_list.push_back(rmp); + } +} + +//------------------------------------------------------------------------------ + +void prdfResolutionMap::Add(const uint8_t *i_ble, + uint8_t i_bleLen, + prdfResolution * r1, + prdfResolution * r2) +{ + Add(i_ble,i_bleLen,r1); + Add(i_ble,i_bleLen,r2); +} + +//------------------------------------------------------------------------------ + +void prdfResolutionMap::Add(const uint8_t *i_ble, + uint8_t i_bleLen, + prdfResolution * r1, + prdfResolution * r2, + prdfResolution * r3) +{ + Add(i_ble,i_bleLen,r1,r2); + Add(i_ble,i_bleLen,r3); +} + +//------------------------------------------------------------------------------ + +void prdfResolutionMap::Add(const uint8_t *i_ble, + uint8_t i_bleLen, + prdfResolution * r1, + prdfResolution * r2, + prdfResolution * r3, + prdfResolution * r4) +{ + Add(i_ble,i_bleLen,r1,r2); + Add(i_ble,i_bleLen,r3,r4); +} + +//------------------------------------------------------------------------------ + +void prdfResolutionMap::Add(const uint8_t *i_ble, + uint8_t i_bleLen, + prdfResolution * r1, + prdfResolution * r2, + prdfResolution * r3, + prdfResolution * r4, + prdfResolution * r5) +{ + Add(i_ble,i_bleLen,r1,r2); + Add(i_ble,i_bleLen,r3,r4,r5); +} + +//------------------------------------------------------------------------------ + +void prdfResolutionMap::Add(const uint8_t *i_ble, + uint8_t i_bleLen, + prdfResolution * r1, + prdfResolution * r2, + prdfResolution * r3, + prdfResolution * r4, + prdfResolution * r5, + prdfResolution * r6) +{ + Add(i_ble,i_bleLen,r1,r2,r3); + Add(i_ble,i_bleLen,r4,r5,r6); +} + +//------------------------------------------------------------------------------ + +void prdfResolutionMap::LookUp(prdfResolutionList & o_list, + prdfBitKey & io_bitList, + STEP_CODE_DATA_STRUCT & scd) +{ + using namespace PRDF; + uint32_t lsize = o_list.size(); + + if(iv_filter != NULL) + { + iv_filter->Apply(io_bitList); + } + + ErrorSignature * esig = scd.service_data->GetErrorSignature(); + switch(io_bitList.size()) + { + case 0: + esig->setErrCode(PRD_SCAN_COMM_REGISTER_ZERO); + break; + case 1: + esig->setErrCode(io_bitList.getListValue(0)); + break; + default: + for(uint32_t index = 0; index < io_bitList.size(); ++index) + { + esig->setErrCode(io_bitList.getListValue(index)); + } + esig->setErrCode(PRD_MULTIPLE_ERRORS); + }; + + for(MapList::iterator i = iv_list.begin(); i != iv_list.end(); ++i) + { + if((i->iv_blist).isSubset(io_bitList)) + { + o_list.push_back(i->iv_res); + } + } + if(lsize == o_list.size()) // we didn't find anything to add, so use default + { + o_list.push_back(defaultRes); + } + + if(iv_filter != NULL) + { + iv_filter->Undo(io_bitList); // so returned bit list will have proper + // value for reset + } +} + +//------------------------------------------------------------------------------ + +void prdfResolutionMap::Add( const char *i_ble, + prdfResolution * res ) +{ + uint8_t len = strlen(i_ble); + uint8_t * bl = new uint8_t[len]; + for(uint8_t i = 0; i < len; ++i) + { + bl[i] = (uint8_t)(i_ble[i] - 1); + } + Add(bl,len,res); + delete [] bl; +} + +void prdfResolutionMap::Add(const char *i_ble, + prdfResolution * r1, + prdfResolution * r2) +{ + Add(i_ble,r1); + Add(i_ble,r2); +} + +void prdfResolutionMap::Add(const char *i_ble, + prdfResolution * r1, + prdfResolution * r2, + prdfResolution * r3) +{ + Add(i_ble,r1,r2); + Add(i_ble,r3); +} + +void prdfResolutionMap::Add(const char *i_ble, + prdfResolution * r1, + prdfResolution * r2, + prdfResolution * r3, + prdfResolution * r4) +{ + Add(i_ble,r1,r2); + Add(i_ble,r3,r4); +} + +void prdfResolutionMap::Add(const char *i_ble, + prdfResolution * r1, + prdfResolution * r2, + prdfResolution * r3, + prdfResolution * r4, + prdfResolution * r5) +{ + Add(i_ble,r1,r2); + Add(i_ble,r3,r4,r5); +} + +void prdfResolutionMap::Add(const char *i_ble, + prdfResolution * r1, + prdfResolution * r2, + prdfResolution * r3, + prdfResolution * r4, + prdfResolution * r5, + prdfResolution * r6) + +{ + Add(i_ble,r1,r2,r3); + Add(i_ble,r4,r5,r6); +} + +//------------------------------------------------------------------------------ + +void prdfResolutionMap::Add(const char *i_ble, + prdfResolution * r1, + prdfResolution * r2, + prdfResolution * r3, + prdfResolution * r4, + prdfResolution * r5, + prdfResolution * r6, + prdfResolution * r7) + +{ + Add(i_ble,r1,r2,r3); + Add(i_ble,r4,r5,r6,r7); +} + diff --git a/src/usr/diag/prdf/common/framework/resolution/prdfResolutionMap.H b/src/usr/diag/prdf/common/framework/resolution/prdfResolutionMap.H new file mode 100755 index 000000000..197a5f429 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/prdfResolutionMap.H @@ -0,0 +1,258 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/prdfResolutionMap.H $ */ +/* */ +/* 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 prdfResolutionMap.H + * /brief Map Bit List encodings to Resolutions + */ +#ifndef prdfResolutionMap_h +#define prdfResolutionMap_h +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#include <vector> +#include <prdfBitKey.H> +#include <prdfResolutionList.H> +#include <prdfFilters.H> + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +struct STEP_CODE_DATA_STRUCT; //dg04c +//! prdfResolutionMap +/*! + This class prvodes mapping of a bitList key to a resolution list + @code + Callout callout = { PU0_HIGH , MSCTLR0_HIGH } ; + FinalResolution default_resolution(&callout); + FinalResolution error_type1(&callout); + ResolutionMap Resolutions(expected_size=10,&default_resolution); + Resolutions.Add(BIT_LIST_STRING_15,&error_type1); // Add resolution for error bit 15 + //... + foo(ScanCommRegister *scr, ResolutionMap &rm, STEP_CODE_DATA_STRUCT & error_data) + { + scr->Read(); + BIT_LIST_CLASS bl = *scr->GetBitString(); + Resolution & r = rm.LookUp(bl); + r.Resolve(error_data); + } + @endcode +*/ +class prdfResolutionMap +{ +public: + /** + Constructor + @param entryCount expected (estimated) number of entries + @param defaultResolution Resolution of use if LookUp failes + @param ptr to a filter to apply to the bitKey before it is looked up + @pre None + @post Object created & space reserved + */ + prdfResolutionMap(int32_t entryCount, prdfResolution &defaultResolution, prdfFilter * i_fltr = NULL); + + /* + Destructor - compiler default is ok + */ + //~prdfprdfResolutionMap(); + + // DRGDRG - Should we be returning a ResolutionList? or get rid of Default & use no bits on key??? + /** + Get the default resolution for this map + @returns a reference to the default resolution + @pre None + @post None + */ + prdfResolution & GetDefault(void) const; + + /** + Replace the default Resolution + @param Reference to new default resolution + */ + void ReplaceDefaultWith(prdfResolution & r); + + /** + Add a key,Resolution pair + @param i_bitPos - bit position + @param 1 to 6 Resolutions + */ + void Add(uint8_t i_bitPos, + prdfResolution * i_res ); + void Add(uint8_t i_bitPos, + prdfResolution * i_r1, prdfResolution * i_r2); + void Add(uint8_t i_bitPos, + prdfResolution * i_r1, prdfResolution * i_r2, prdfResolution * i_r3); + void Add(uint8_t i_bitPos, + prdfResolution * i_r1, prdfResolution * i_r2, prdfResolution * i_r3, + prdfResolution * i_r4); + void Add(uint8_t i_bitPos, + prdfResolution * i_r1, prdfResolution * i_r2, prdfResolution * i_r3, + prdfResolution * i_r4, prdfResolution * i_r5); + void Add(uint8_t i_bitPos, + prdfResolution * i_r1, prdfResolution * i_r2, prdfResolution * i_r3, + prdfResolution * i_r4, prdfResolution * i_r5, prdfResolution * i_r6); + void Add(uint8_t i_bitPos, + prdfResolution * i_r1, prdfResolution * i_r2, prdfResolution * i_r3, + prdfResolution * i_r4, prdfResolution * i_r5, prdfResolution * i_r6, + prdfResolution * i_r7); + + /** + Add a key,prdfResolution pair + @param i_ble - bit list encoding (array of bitPos) + @param i_bleLen length of bit list + @param 1 to 6 prdfResolutions + */ + void Add(const uint8_t *i_ble, uint8_t i_bleLen, + prdfResolution * res ); + void Add(const uint8_t *i_ble, uint8_t i_bleLen, + prdfResolution * r1, prdfResolution * r2); + void Add(const uint8_t *i_ble, uint8_t i_bleLen, + prdfResolution * r1, prdfResolution * r2, prdfResolution * r3); + void Add(const uint8_t *i_ble, uint8_t i_bleLen, + prdfResolution * r1, prdfResolution * r2, prdfResolution * r3, + prdfResolution * r4); + void Add(const uint8_t *i_ble, uint8_t i_bleLen, + prdfResolution * r1, prdfResolution * r2, prdfResolution * r3, + prdfResolution * r4, prdfResolution * r5); + void Add(const uint8_t *i_ble, uint8_t i_bleLen, + prdfResolution * r1, prdfResolution * r2, prdfResolution * r3, + prdfResolution * r4, prdfResolution * r5, prdfResolution * r6); + + + //! Old Add interface + /*! + */ + void Add(const char *i_ble, + prdfResolution * res ); + void Add(const char *i_ble, + prdfResolution * r1, prdfResolution * r2); + void Add(const char *i_ble, + prdfResolution * r1, prdfResolution * r2, prdfResolution * r3); + void Add(const char *i_ble, + prdfResolution * r1, prdfResolution * r2, prdfResolution * r3, + prdfResolution * r4); + void Add(const char *i_ble, + prdfResolution * r1, prdfResolution * r2, prdfResolution * r3, + prdfResolution * r4, prdfResolution * r5); + void Add(const char *i_ble, + prdfResolution * r1, prdfResolution * r2, prdfResolution * r3, + prdfResolution * r4, prdfResolution * r5, prdfResolution * r6); + void Add(const char *i_ble, + prdfResolution * r1, prdfResolution * r2, prdfResolution * r3, + prdfResolution * r4, prdfResolution * r5, prdfResolution * r6, + prdfResolution * r7); + + void AddRange(const char *i_ble,prdfResolution * res ) { Add(i_ble,res); } + void AddRange(const char *i_ble,prdfResolution * r1, prdfResolution * r2) { Add(i_ble,r1,r2); } + void AddRange(const char *i_ble, + prdfResolution * r1, prdfResolution * r2, prdfResolution * r3) { Add(i_ble,r1,r2,r3); } + void AddRange(const char *i_ble, + prdfResolution * r1, prdfResolution * r2, prdfResolution * r3, + prdfResolution * r4) { Add(i_ble,r1,r2,r3,r4); } + void AddRange(const char *i_ble, + prdfResolution * r1, prdfResolution * r2, prdfResolution * r3, + prdfResolution * r4, prdfResolution * r5) { Add(i_ble,r1,r2,r3,r4,r5); } + void AddRange(const char *i_ble, + prdfResolution * r1, prdfResolution * r2, prdfResolution * r3, + prdfResolution * r4, prdfResolution * r5, prdfResolution * r6) { Add(i_ble,r1,r2,r3,r4,r5,r6); } + /** + Look up a prdfResolution for a bitlist + @param bitList + @returns List of all prdfResolutions that match + @pre none + @post prdfResolution returned is only valid until the next call to LookUp or this object is destroyed. + i_bitList may be modified + @notes if the bitList does not have a match then the defaultprdfResolution is returned. + */ + void LookUp(prdfResolutionList & o_list, prdfBitKey & io_bitList, STEP_CODE_DATA_STRUCT & scd); //dg04c + + /** + * @brief Get the stored filter associated with this resolution map. + * @returns Currently assigned filter. + */ + prdfFilter * getFilter() { return iv_filter; }; + + /** + * @brief Store a new filter with this resolution map. + * @param i - Filter to store. + */ + void setFilter(prdfFilter * i) { iv_filter = i; }; + +protected: // functions + +private: // functions + + /*! + Copy prohibited + */ + prdfResolutionMap(const prdfResolutionMap &); // Don't allow copy - No defn + + /*! + Assignment prohibited + */ + const prdfResolutionMap &operator=(const prdfResolutionMap &); // Don't allow - no defn + +private: // Data + + struct RmPair + { + prdfBitKey iv_blist; + prdfResolution * iv_res; + RmPair(uint8_t i_bitPos, prdfResolution *res) : iv_blist(i_bitPos), iv_res(res) {} + RmPair(void) : iv_blist(), iv_res(NULL) {} + }; + + typedef std::vector<RmPair> MapList; + + prdfResolution * defaultRes; + prdfFilter * iv_filter; + + MapList iv_list; +// MapList iv_rangeList; + +}; + +inline prdfResolutionMap::prdfResolutionMap(int32_t entryCount, + prdfResolution & defaultResolution, + prdfFilter * i_fltr) +: defaultRes(&defaultResolution), iv_filter(i_fltr), iv_list() +{ + iv_list.reserve(entryCount); +} + +inline prdfResolution & prdfResolutionMap::GetDefault(void) const {return *defaultRes; } +inline void prdfResolutionMap::ReplaceDefaultWith(prdfResolution & r) { defaultRes = &r; } + +#endif /* prdfResolutionMap_h */ + +// Change Log ************************************************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ------- -------- -------- ------------------------------------------------------- +// v4r1mo 05/02/96 DRG Initial Creation +// D49203.5 v4r3 07/30/97 DRG Add Add() for multiple resolutions +// fips 03/02/04 dgilbert Changes the way lookups are done +// 482244 fips225 11/04/04 dgilbert Add filter +// F544848 f300 04/03/06 iawillia Add multi-bit support for rule code +// dg04 568068 f310 08/29/06 dgilbert Add STEP_CODE_DATA_STRUCT to LookUp +// End Change Log ********************************************************************************* diff --git a/src/usr/diag/prdf/common/framework/resolution/prdfThresholdResolutions.C b/src/usr/diag/prdf/common/framework/resolution/prdfThresholdResolutions.C new file mode 100755 index 000000000..f89adbbd2 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/prdfThresholdResolutions.C @@ -0,0 +1,259 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/prdfThresholdResolutions.C $ */ +/* */ +/* 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 */ + +/** + @file prdfThresholdResolutions.C + @brief MaskResolution, IntervalThresholdResolution, ResetThresholdResolution +*/ +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define prdfThresholdResolutions_C + +#include <iipServiceDataCollector.h> +#include <prdfTimer.H> +#include <prdfFlyWeight.H> +#include <prdfThresholdResolutions.H> +#include <prdfFlyWeight.C> + +#undef prdfThresholdResolutions_C +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +// This is global varaible for stroring threshold policy instances. +// It must be cleared in prdf uninitialize +FlyWeight<ThresholdResolution::ThresholdPolicy, 10> g_thresholdPFW; + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +const ThresholdResolution::ThresholdPolicy ThresholdResolution::cv_fieldDefault + = g_thresholdPFW.get( + ThresholdResolution::ThresholdPolicy(32,ThresholdResolution::ONE_DAY)); + +const ThresholdResolution::ThresholdPolicy ThresholdResolution::cv_mnfgDefault + = g_thresholdPFW.get( + ThresholdResolution::ThresholdPolicy(1,ThresholdResolution::NONE)); + +const ThresholdResolution::ThresholdPolicy ThresholdResolution::cv_pllDefault + = g_thresholdPFW.get( + ThresholdResolution::ThresholdPolicy(2,ThresholdResolution::ONE_MIN)); + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +int32_t MaskResolution::Resolve(STEP_CODE_DATA_STRUCT & error) +{ + error.service_data->SetHits(1); + error.service_data->SetThreshold(1); + error.service_data->SetThresholdMaskId(iv_maskId); + return SUCCESS; +} + +//--------------------------------------------------------------------- + +int32_t MaskResolution::GetCount() // wl01 +{ + return 1; +} + +//--------------------------------------------------------------------- + +void MaskResolution::ResetCount() // wl01 +{ + return; +} + +//--------------------------------------------------------------------- + +ThresholdResolution::ThresholdResolution( uint32_t maskId, + uint8_t i_threshold, + uint32_t i_interval ) : + MaskResolution(maskId), + iv_policy( &g_thresholdPFW.get(ThresholdPolicy(i_threshold,i_interval))), + iv_count(0) +{} + +//--------------------------------------------------------------------- + +ThresholdResolution::ThresholdResolution() : + MaskResolution(0), + iv_policy( &(ThresholdResolution::cv_fieldDefault)), + iv_count(0) +{} + +//--------------------------------------------------------------------- + +ThresholdResolution::ThresholdResolution( uint32_t maskId, + const ThresholdPolicy& thresholdp ) : + MaskResolution(maskId), + iv_policy(&g_thresholdPFW.get(thresholdp)), + iv_count(0) +{} + +//--------------------------------------------------------------------- + +int32_t ThresholdResolution::Resolve(STEP_CODE_DATA_STRUCT & error) +{ + int32_t rc = SUCCESS; + PrdTimer curTime = error.service_data->GetTOE(); // get timestamp (Time Of Error) from SDC + ++iv_count; + error.service_data->SetHits((uint8_t)iv_count); + error.service_data->SetThreshold((uint8_t)iv_policy->threshold); + if (iv_count == 1) // Interval begins at the 1st occurrence + { + iv_endTime = curTime + iv_policy->interval; // Project the end of interval (in sec) + if((iv_count == iv_policy->threshold) || + (error.service_data->IsFlooding())) // We've hit threshold within the interval + { + error.service_data->SetThresholdMaskId(iv_maskId); // threshold, degraded YES + iv_count = 0; // Reset the counter on threshold + } + } + else + { + if (curTime > iv_endTime) // Are we already past the time window? + { + iv_count = 1; // Reset count as if it were the first + error.service_data->SetHits((uint8_t)iv_count); // pw01 + iv_endTime = curTime + iv_policy->interval; // Project the new end of interval + } + else if((iv_count == iv_policy->threshold) || + (error.service_data->IsFlooding())) // We've hit threshold within the interval + { + error.service_data->SetThresholdMaskId(iv_maskId); // threshold, degraded YES + iv_count = 0; // Reset the counter on threshold + } + else ; // Nothing else + } + + return rc; +} + +//--------------------------------------------------------------------- + +void ThresholdResolution::ResetCount() // wl01 +{ + iv_count = 0; + return; +} + +//--------------------------------------------------------------------- + +int32_t ThresholdResolution::GetCount() // wl01 +{ + return iv_count; +} + +//--------------------------------------------------------------------- + +void ThresholdResolution::reset() +{ + g_thresholdPFW.clear(); +} + +//--------------------------------------------------------------------- + +ThresholdSigResolution::ThresholdSigResolution( uint8_t i_threshold, + uint32_t i_interval ) : + iv_policy( &g_thresholdPFW.get( + ThresholdResolution::ThresholdPolicy(i_threshold,i_interval))) +{} + +//--------------------------------------------------------------------- + +ThresholdSigResolution::ThresholdSigResolution( + const ThresholdResolution::ThresholdPolicy & policy ) : + iv_policy( &g_thresholdPFW.get(policy)) +{} + +//--------------------------------------------------------------------- + +ThresholdSigResolution::ThresholdSigResolution() : + iv_policy( &(ThresholdResolution::cv_fieldDefault)) +{} + +//--------------------------------------------------------------------- + +int32_t ThresholdSigResolution::Resolve(STEP_CODE_DATA_STRUCT & error) +{ + int32_t l_rc = SUCCESS; + + PrdTimer l_curTime = error.service_data->GetTOE(); + ErrorSignature l_sig = *error.service_data->GetErrorSignature(); + ThresholdCountAndTimer & l_countTime = iv_thresholds[l_sig]; + + uint32_t l_count = ++(l_countTime.first); // increment count. + + // update service data with threshold info. + error.service_data->SetHits((uint8_t) l_count); + error.service_data->SetThreshold((uint8_t)iv_policy->threshold); + + if (1 == l_count) // first time: set end timer. + { + l_countTime.second = l_curTime + iv_policy->interval; + if ((l_countTime.first == iv_policy->threshold) || + (error.service_data->IsFlooding())) + { + // set overthreshold flag / maskid, clear count. + error.service_data->SetThresholdMaskId(l_sig.getSigId()); + l_countTime.first = 0; + } + } + else + { + if (l_curTime > l_countTime.second) // time > interval: reset end timer + { + l_countTime.first = 1; + error.service_data->SetHits((uint8_t)l_countTime.first); // pw01 + l_countTime.second = l_curTime + iv_policy->interval; + } + // Check over threshold and under time interval. + else if ((l_countTime.first == iv_policy->threshold) || + (error.service_data->IsFlooding())) + { + // set overthreshold flag / maskid, clear count. + error.service_data->SetThresholdMaskId(l_sig.getSigId()); + l_countTime.first = 0; + } + else; // nothing else. + } + + return l_rc; +} diff --git a/src/usr/diag/prdf/common/framework/resolution/prdfThresholdResolutions.H b/src/usr/diag/prdf/common/framework/resolution/prdfThresholdResolutions.H new file mode 100755 index 000000000..9d17a3879 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/prdfThresholdResolutions.H @@ -0,0 +1,278 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/prdfThresholdResolutions.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 */ + +#ifndef PRDFTHRESHOLDRESOLUTIONS_H +#define PRDFTHRESHOLDRESOLUTIONS_H +/** + @file prdfThresholdResolutions.H + @brief MaskResolution, IntervalThresholdResolution, ResetThresholdResolution +*/ + + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#if !defined(iipResolution_h) +#include <iipResolution.h> +#endif + +#if !defined(PRDFTIMER_H) +#include <time.h> +#include <prdfTimer.H> +#endif + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +/** + Set mask Resolution + @author Doug Gilbert + @par + @code + @endcode + */ +class MaskResolution: public Resolution +{ + public: + /** + Constructor + @param Maskid + */ + MaskResolution(uint32_t maskId) : iv_maskId(maskId) {} + + /** + Default Ctor - so it can be used in a vector + */ + MaskResolution(void) : iv_maskId(0) {} + + /** + Set MaskId into service data collector + @pre None + @post + @return SUCCESS | non-zero + @note Acts like Threshold Resolution with a threshold of one + */ + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & error); + + virtual void ResetCount(); // wl01 + + virtual int32_t GetCount(); // wl01 + + /** + operator == + */ + bool operator==(const MaskResolution &r) { return (iv_maskId == r.iv_maskId); } //dg02 + + private: // functions + protected: // Data + uint32_t iv_maskId; + +}; + +/** + Set Mask on Threshold + */ +class ThresholdResolution : public MaskResolution +{ + public: + + enum TimeBase + { + ONE_SEC = 1, + ONE_MIN = ONE_SEC * 60, + ONE_HOUR = ONE_MIN * 60, + ONE_DAY = ONE_HOUR * 24, + + NONE = 0xffffffff, + }; + + struct ThresholdPolicy + { + // Currently we don't need threshold value more then 255. So using + // uint8_t here to save space. + uint8_t threshold; + uint32_t interval; + + ThresholdPolicy( uint8_t l_threshold, uint32_t l_interval ) : + threshold(l_threshold), interval(l_interval) + {} + + ThresholdPolicy() : + threshold(0), interval(0) + {} + + bool operator==(ThresholdPolicy i_thr) const + { + return ( (threshold == i_thr.threshold) && + (interval == i_thr.interval) ); + } + }; + + /** + Constructor + @param maskid + @param i_threshold + @param i_interval + */ + ThresholdResolution(uint32_t maskId, uint8_t i_threshold, uint32_t i_interval); + + /** + default Ctor - so it can be used in a vector + */ + ThresholdResolution(void); + + /** + Constructor + @param thresholdp Threshold policy. + */ + ThresholdResolution(uint32_t maskId, + const ThresholdPolicy& thresholdp); + + /** + Set MaskId into service data collector when a threshold as been reached + @pre None + @post Increment thresholdCount - Maskid is set in ServiceData when threshold is reached + @return SUCCESS | non-zero + @note In mfg mode the threshold is one + */ + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & error); + + virtual void ResetCount(); // wl01 + + virtual int32_t GetCount(); // wl01 + + /** + operator == + @note This should always return false in order for FlyWeight to always create unique objects + */ + bool operator==(const ThresholdResolution &r) { return false; } + + /** + * Clear out all threshold policy objects + */ + static void reset(); + + public: // Data + + static const ThresholdPolicy cv_fieldDefault; + static const ThresholdPolicy cv_mnfgDefault; + static const ThresholdPolicy cv_pllDefault; + + private: // Data + + // Though this is a pointer, we should never free it in destructor + //We take its value from global flyweight which will be freed in prd uninitialise + const ThresholdPolicy * iv_policy; + uint32_t iv_count; + PrdTimer iv_endTime; + +}; + +/** + * @class ThresholdSigResolution + * + * Similar to the ThresholdResoultion, except it uses the current error + * signature in the SDC to determine the 'maskid'. This allows us to use one + * ThresholdSigResolution class for each policy instead of one + * ThresholdResolution for each error for each chip. + */ +#include <map> +#include <prdfErrorSignature.H> +class ThresholdSigResolution: public Resolution +{ + public: + + /** ctor(ThresholdPolicyEnum policy) + * Initializes the policy to the value specified. + */ + ThresholdSigResolution( uint8_t i_threshold, uint32_t i_interval); + + /** ctor(ThresholdPolicy* policy) + * Initializes the policy to the policy specified. + */ + ThresholdSigResolution(const ThresholdResolution::ThresholdPolicy& policy); + + /** default ctor + * Initialize the policy to "Default". + */ + ThresholdSigResolution(); + + /** default dtor + * Does nothing special. + */ + virtual ~ThresholdSigResolution() {}; + + /** Resolve + * Increments the error count based on the current signature. If + * error count is over the policy limits, sets mask id and + * AT_THRESHOLD flag and then resets the error count. + */ + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & error); + + /** operator== + * Compare two ThresholdSigResolutions by policies. + */ + bool operator==(const ThresholdSigResolution &r) + { + return ( (r.iv_policy->threshold == iv_policy->threshold) && + (r.iv_policy->interval == iv_policy->interval) ); + } + + /** Flush + * Clear out all error counts recorded for all signatures. + */ + virtual void Flush() { iv_thresholds.empty(); }; + + private: + + // Stores a count/timer pair. + typedef std::pair<uint32_t, PrdTimer> ThresholdCountAndTimer; + + // Policy for this object. + // Though this is a pointer, we should never free it in destructor + // We take its value from global flyweight which will be freed in prd uninitialise + const ThresholdResolution::ThresholdPolicy * iv_policy; + + // Map of ErrorSignatures->(Count,Timer). + std::map<ErrorSignature, ThresholdCountAndTimer> iv_thresholds; + +}; + +#endif /* PRDFTHRESHOLDRESOLUTIONS_H */ + +// Change Log ***************************************************************** +// +// Flag Reason Vers Date Coder Description +// ---- ------- ------- -------- -------- ------------------------------------ +// 400647 dgilbert Initial Creation +// wl01 406274 fips 06/27/03 lemmon add support for ThresholdResolution GetCount and ResetCount +// dg02 487035 fips222 12/10/04 dgilbert add operator== to MaskResolution +// 507223 fips310 06/03/05 iawillia Add ThresholdSigResolution +// D515833 fips300 09/19/05 iawillia Use VMap instead of Map. +// F522128 fips300 09/22/05 iawillia Add TwoPerDay policy. +// F523599 fips300 10/11/05 iawillia Add ThirtyThreePerHalfHour policy. +// F548507 fips300 04/21/06 iawillia Add FivePerDay policy. +// zs01 F565934 fips310 08/25/06 zshelle Add SixteenPerDay policy. +// End Change Log ************************************************************* diff --git a/src/usr/diag/prdf/common/framework/resolution/xspprdDumpResolution.C b/src/usr/diag/prdf/common/framework/resolution/xspprdDumpResolution.C new file mode 100755 index 000000000..dc843396a --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/xspprdDumpResolution.C @@ -0,0 +1,55 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/xspprdDumpResolution.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2001,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: +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define xspprdDumpResolution_C + +#include <xspprdDumpResolution.h> +#include <iipServiceDataCollector.h> + +#undef xspprdDumpResolution_C + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +int32_t DumpResolution::Resolve(STEP_CODE_DATA_STRUCT & error) +{ + uint32_t rc = SUCCESS; + + #ifdef __HOSTBOOT_MODULE + error.service_data->SetDump(/*FIXME: ivDumpContent,*/ iv_pdumpHandle); + #else + error.service_data->SetDump(ivDumpContent,iv_pdumpHandle); + #endif + + return rc; +} diff --git a/src/usr/diag/prdf/common/framework/resolution/xspprdDumpResolution.h b/src/usr/diag/prdf/common/framework/resolution/xspprdDumpResolution.h new file mode 100755 index 000000000..73400f2d8 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/xspprdDumpResolution.h @@ -0,0 +1,137 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/xspprdDumpResolution.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2001,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 xspprdDumpResolution_h +#define xspprdDumpResolution_h +// Class Description ************************************************* +// +// Name: DumpResolution +// Base class: Resolution +// +// Description: Set dump information in Service Data Collector +// Usage: +// +// End Class Description ********************************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#if !defined(iipResolution_h) +#include <iipResolution.h> +#endif + +#ifndef __HOSTBOOT_MODULE + +#include <hdctContent.H> + +#endif + +#include <prdfPlatServices.H> + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +class ServiceDataCollector; + +/** + Set dump information in the Service Data Collector + @author Mike Kobler + */ +class DumpResolution : public Resolution +{ +public: + /** + Constructor + <ul> + <br><b>Parameters: </b> Optional: Processor handle value + <br><b>Returns: </b> Nothing + <br><b>Requirements:</b> None + <br><b>Promises: </b> Object created + <br><b>Exceptions: </b> None + <br><b>Notes: </b> + </ul><br> + */ + #ifdef __HOSTBOOT_MODULE + DumpResolution(/*FIXME: hwTableContent iDumpRequestContent = CONTENT_HW, */ + TARGETING::TargetHandle_t i_pdumpHandle =NULL ) : + #else + DumpResolution(hwTableContent iDumpRequestContent = CONTENT_HW, + TARGETING::TargetHandle_t i_pdumpHandle =NULL ) : + ivDumpContent(iDumpRequestContent), + #endif + iv_pdumpHandle(i_pdumpHandle) + {} + + /* + 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 sufficient + </ul><br> + */ + // ~xspprdDumpResolution(); + + /** + Resolve by adding a the MRU callout to the service data collector + <ul> + <br><b>Parameters: </b> ServiceDataCollector + <br><b>Returns: </b> Return code [SUCCESS | nonZero] + <br><b>Requirements:</b> none. + <br><b>Promises: </b> serviceData::GetMruList().GetCount()++ + serviceData::QueryDump() == this callout + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & error); + +#ifndef __HOSTBOOT_MODULE + + /* + * base class defines operator== so one is needed here + * or the base class version will be used (bad) + */ + bool operator==(const DumpResolution & r) const + { + return ( (ivDumpContent == r.ivDumpContent) && + (iv_pdumpHandle == r.iv_pdumpHandle) ); + } + +#endif + +private: // functions +private: // Data + + #ifndef __HOSTBOOT_MODULE + hwTableContent ivDumpContent; + #endif + + TARGETING:: TargetHandle_t iv_pdumpHandle; +}; + + +#endif /* xspprdDumpResolution_h */ + diff --git a/src/usr/diag/prdf/common/framework/resolution/xspprdFlagResolution.C b/src/usr/diag/prdf/common/framework/resolution/xspprdFlagResolution.C new file mode 100755 index 000000000..16eb3572f --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/xspprdFlagResolution.C @@ -0,0 +1,57 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/xspprdFlagResolution.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2001,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: +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define xspprdFlagResolution_C + +#include <xspprdFlagResolution.h> +#include <iipServiceDataCollector.h> + +#undef xspprdFlagResolution_C + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +int32_t FlagResolution::Resolve(STEP_CODE_DATA_STRUCT & error) +{ + uint32_t rc = SUCCESS; + error.service_data->SetFlag(xFlag); + return rc; +} + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------ +// D49420.9 V5R2 12/04/00 mkobler Initial Creation +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/resolution/xspprdFlagResolution.h b/src/usr/diag/prdf/common/framework/resolution/xspprdFlagResolution.h new file mode 100755 index 000000000..f1267b994 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/xspprdFlagResolution.h @@ -0,0 +1,124 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/xspprdFlagResolution.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2001,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 xspprdFlagResolution_h +#define xspprdFlagResolution_h + +// Class Description ************************************************* +// +// Name: FlagResolution +// Base class: Resolution +// +// Description: Set a Flag in the Service Data Collector +// Usage: +// +// End Class Description ********************************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#if !defined(iipResolution_h) +#include <iipResolution.h> +#endif + +#if !defined(iipServiceDataCollector_h) +#include <iipServiceDataCollector.h> +#endif + +/** + Set a Flag in the Service Data Collector + @author Mike Kobler + */ +class FlagResolution : public Resolution +{ +public: + /** + 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 + <br><b>Notes: </b> + </ul><br> + */ + FlagResolution(ServiceDataCollector::Flag flag) + : xFlag(flag) {} + FlagResolution() + : xFlag(ServiceDataCollector::SERVICE_CALL) {} + + /* + 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 sufficient + </ul><br> + */ + // ~xspprdFlagResolution(); + + /** + Resolve by adding a the MRU callout to the service data collector + <ul> + <br><b>Parameters: </b> ServiceDataCollector + <br><b>Returns: </b> Return code [SUCCESS | nonZero] + <br><b>Requirements:</b> none. + <br><b>Promises: </b> serviceData::GetMruList().GetCount()++ + serviceData::QueryFlag() == this callout + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & error); + + /* + * base class defines operator== so one is needed here + * or the base class version will be used (bad) + */ + bool operator==(const FlagResolution & r) const + { + return (xFlag == r.xFlag); + } + +private: // functions +private: // Data + + ServiceDataCollector::Flag xFlag; + +}; + + +#endif /* xspprdFlagResolution_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- ------- ------------------------------- +// D49420.9 V5R2 12/04/00 mkobler Initial Creation +// f522283 300 09/27/05 dgilbert make FlyWeight-able +// D608564 f310 05/18/07 dgilbert add operator==() to fix mem leak +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/resolution/xspprdGardResolution.C b/src/usr/diag/prdf/common/framework/resolution/xspprdGardResolution.C new file mode 100755 index 000000000..88ea83333 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/xspprdGardResolution.C @@ -0,0 +1,75 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/xspprdGardResolution.C $ */ +/* */ +/* 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 */ + +// Module Description ************************************************** +// +// Description: +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define xspprdGardResolution_C + +#include <xspprdGardResolution.h> +#include <iipServiceDataCollector.h> + +#undef xspprdGardResolution_C +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +int32_t GardResolution::Resolve(STEP_CODE_DATA_STRUCT & error) +{ + error.service_data->Gard(xErrorType); + return SUCCESS; +} + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------ +// DGILBERT Initial Creation +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/resolution/xspprdGardResolution.h b/src/usr/diag/prdf/common/framework/resolution/xspprdGardResolution.h new file mode 100755 index 000000000..4c1462f9a --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/xspprdGardResolution.h @@ -0,0 +1,141 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/xspprdGardResolution.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2001,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 xspprdGardResolution_h +#define xspprdGardResolution_h + +// Class Description ************************************************* +// +// Name: GardResolution +// Base class: Resolution +// +// Description: Set the error type for the failure (determines whether +// Gard will be called) +// Usage: +// +// End Class Description ********************************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#if !defined(iipResolution_h) +#include <iipResolution.h> +#endif + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +/** + Callout a mru and mark it for Gard (deallocation) + @author Doug Gilbert + */ +class GardResolution : public Resolution +{ +public: + + enum ErrorType + { + // No Gard is possible + NoGard = 0, + // Recovered error at threshold + Predictive = 1, + // An uncorrectable error occurred, but the machine continues to run + Uncorrectable = 2, + // Checkstop, failing resources can be removed to prevent future occurances + Fatal = 3, + // Resource has spares that could be used to fix the problem via bist on the next IPL. + Pending = 4, + // This is NoGard unless attn type is CheckStop, then it is Fatal (Func) + CheckStopOnlyGard = 5, //mp01 + //This is to allow Deferred Deconfig, with No Garding + DeconfigNoGard = 6 //mp02 + }; + + + /** + 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 + <br><b>Notes: </b> + </ul><br> + */ + GardResolution(ErrorType et=NoGard) + : xErrorType(et) {} + + /* + 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 sufficient + </ul><br> + */ + // ~xspprdGardResolution(); + + /** + Resolve by adding a the MRU callout to the service data collector + <ul> + <br><b>Parameters: </b> ServiceDataCollector + <br><b>Returns: </b> Return code [SUCCESS | nonZero] + <br><b>Requirements:</b> none. + <br><b>Promises: </b> serviceData::GetMruList().GetCount()++ + serviceData::QueryGard() == this callout + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & error); + + bool operator==(const GardResolution & r) const + { + return (xErrorType == r.xErrorType); + } + +private: // functions +private: // Data + + ErrorType xErrorType; + +}; + + +#endif /* xspprdGardResolution_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- ----- ------------------------------- +// 02/18/99 DRG Initial Creation +// D49420.8 v5r2 12/05/00 mak Change to use PRDcallout +// 05/18/07 drg add operator==() to prevent memory leak +// mp01 D672610 f320 08/28/08 plute Add CheckStopOnlyGard +// mp02 f710 08/06/08 plute Add DeconfigNoGard +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/resolution/xspprdTryResolution.h b/src/usr/diag/prdf/common/framework/resolution/xspprdTryResolution.h new file mode 100755 index 000000000..2dcf9cffc --- /dev/null +++ b/src/usr/diag/prdf/common/framework/resolution/xspprdTryResolution.h @@ -0,0 +1,134 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/resolution/xspprdTryResolution.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 xspprdTryResolution_h +#define xspprdTryResolution_h + +// Class Description ************************************************* +// +// Name: TryResolution +// Base class: Resolution +// +// Description: Try a resolution - if it does not work then +// call a default resolution +// Usage: +// +// End Class Description ********************************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#if !defined(iipResolution_h) +#include <iipResolution.h> +#endif + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +/** + **One line Class description** + @author Doug Gilbert + */ +class TryResolution: public Resolution +{ +public: + /** + Constructor + <ul> + <br><b>Parameter: </b> Resolution to try first + <br><b>Parameter: </b> Resolution if the try resolution fails + <br><b>Returns: </b> Nothing + <br><b>Requirements:</b> None + <br><b>Promises: </b> Object created + <br><b>Exceptions: </b> None + <br><b>Notes: </b> + </ul><br> + */ + TryResolution(Resolution &tryRes, Resolution & defaultRes); + TryResolution(); + + /* + 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> + */ + // ~TryResolution(); + + /** + ** description ** + <ul> + <br><b>Parameters: </b> parms + <br><b>Returns: </b> return + <br><b>Requirements:</b> preconditions + <br><b>Promises: </b> postconditions + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> optional + </ul><br> + */ + + /** + Resolve by calling TryResolution else call DefaultResolution + <ul> + <br><b>Parameters: </b> ServiceDataCollector + <br><b>Returns: </b> Return code [SUCCESS | nonZero] + <br><b>Requirements:</b> none. + <br><b>Promises: </b> if(TryResolution.Resolve() != SUCCESS) + then xDefaultResolution.Resolve(); + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual int32_t Resolve(STEP_CODE_DATA_STRUCT & error); + +private: // functions +private: // Data + +Resolution * xTryResolution; +Resolution * xDefaultResolution; + +}; + +inline +TryResolution::TryResolution(Resolution &tryRes, Resolution & defaultRes) +: xTryResolution(&tryRes), xDefaultResolution(&defaultRes) {} + +inline +TryResolution::TryResolution() + : xTryResolution(NULL), xDefaultResolution(NULL) {} + + +#endif /* xspprdTryResolution_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- --------- ---- -------- -------- ------------------------------- +// d49274.xx v4r5 12/28/99 dgilbert Initial Creation +// f522283 300 09/27/05 dgilbert Make flyweight-able +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/rule/iipTemplates.C b/src/usr/diag/prdf/common/framework/rule/iipTemplates.C new file mode 100755 index 000000000..8d8572ca2 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/iipTemplates.C @@ -0,0 +1,39 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/iipTemplates.C $ */ +/* */ +/* 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 */ + +#include <iipDomainContainer.h> +#include <iipDomainContainer.C> +#include <prdfRuleChip.H> + +template class DomainContainer<PrdfRuleChip>; + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------ +// DGILBERT Initial Creation +// F429488 fips 12/16/03 mkobler Added prdfMcChip template +// F494911 f310 03/04/05 iawillia Added PrdfRuleChip template. +// dg01 f300 04/05/06 dgilbert Added Domain of prdfExtensibleChip +// dg02 F557969 f310 07/05/06 dgilbert Remove obsolite parts +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/rule/prdfGroup.C b/src/usr/diag/prdf/common/framework/rule/prdfGroup.C new file mode 100755 index 000000000..c80ab4aaa --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdfGroup.C @@ -0,0 +1,279 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdfGroup.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 */ + +#include <prdfGroup.H> +#include <prdfBitString.H> +#include <prdfResolutionMap.H> +#include <iipResetErrorRegister.h> +#include <prdfMain.H> +#include <iipServiceDataCollector.h> + +PrdfGroup::~PrdfGroup() +{ + RegisterList_t::const_iterator l_errRegsEnd = cv_errRegs.end(); + for (RegisterList_t::const_iterator i = cv_errRegs.begin(); + i != l_errRegsEnd; + ++i) + { + delete *i; + } + + ResMaps_t::const_iterator l_resMapsEnd = cv_resMaps.end(); + for (ResMaps_t::const_iterator i = cv_resMaps.begin(); + i != l_resMapsEnd; + ++i) + { + delete (ResolutionMap *)(*i).second; + } + + // Delete filters. + FilterList_t::const_iterator l_filterEnd = cv_filters.end(); + for (FilterList_t::const_iterator i = cv_filters.begin(); + i != l_filterEnd; + ++i) + { + delete (*i); + } +} + +int32_t PrdfGroup::Analyze(STEP_CODE_DATA_STRUCT & i_step) +{ + using namespace PRDF; + int32_t l_rc = -1; + ServiceDataCollector l_backupStep(*i_step.service_data); + int32_t l_tmpRC = SUCCESS; + + RegisterList_t::const_iterator l_errRegsEnd = cv_errRegs.end(); + for (RegisterList_t::const_iterator i = cv_errRegs.begin(); + (i != l_errRegsEnd) && (l_rc != SUCCESS); + ++i) + { + (*i_step.service_data) = l_backupStep; + l_tmpRC = (*i)->Analyze(i_step); + + if (PRD_SCAN_COMM_REGISTER_ZERO != l_tmpRC) + { + l_rc = l_tmpRC; + } + } + if (PRD_SCAN_COMM_REGISTER_ZERO == l_tmpRC) + { + l_rc = l_tmpRC; + } + + if (0 == cv_errRegs.size()) + l_rc = cv_defaultRes.Resolve(i_step); + + return l_rc; +}; + +void PrdfGroup::Add(SCAN_COMM_REGISTER_CLASS * i_reg, + const uint8_t * i_bits, + size_t i_bitSize, + Resolution & i_action, + PrdfResetAndMaskPair & i_resets, + uint16_t i_scrID, + bool i_reqTranspose) +{ + prdfFilter * l_transposeFilter = NULL; + uint8_t l_bits[1] = { '\0' }; + ResolutionMap * l_res = cv_resMaps[i_reg]; + + if (NULL == l_res) + { + l_res = cv_resMaps[i_reg] = new prdfResolutionMap(1, cv_defaultRes); + ResetAndMaskErrorRegister * l_errReg = + new ResetAndMaskErrorRegister(*i_reg, *l_res, i_scrID); + cv_errRegs.push_back(l_errReg); + + // Sort reset and mask lists. + std::sort(i_resets.first.begin(), i_resets.first.end()); + std::sort(i_resets.second.begin(), i_resets.second.end()); + + // Remove duplicate resets and masks. + i_resets.first.erase( + std::unique(i_resets.first.begin(), i_resets.first.end()), + i_resets.first.end()); + i_resets.second.erase( + std::unique(i_resets.second.begin(), i_resets.second.end()), + i_resets.second.end()); + + // Add resets. + std::for_each(i_resets.first.begin(), i_resets.first.end(), + std::bind1st( + std::mem_fun(&ResetAndMaskErrorRegister::addReset), + l_errReg) + ); + + // Add masks. + std::for_each(i_resets.second.begin(), i_resets.second.end(), + std::bind1st( + std::mem_fun(&ResetAndMaskErrorRegister::addMask), + l_errReg) + ); + } + + // This action requires a transpose filter (multiple bits &'d) + if (i_reqTranspose) + { + // Create key and transposition filter. Add to filter list. + prdfBitKey l_tmpKey(i_bits, i_bitSize); + l_transposeFilter = new prdfFilterTranspose(l_tmpKey, + cv_nextBitForTranspose); + cv_filters.push_back(l_transposeFilter); + + // Update bit string pointers/values. + l_bits[0] = cv_nextBitForTranspose++; + i_bits = l_bits; + i_bitSize = 1; + + // Check for existing transposition filter, create link as needed. + if (NULL != l_res->getFilter()) + { + l_transposeFilter = new FilterLink(*l_res->getFilter(), + *l_transposeFilter); // pw01 + cv_filters.push_back(l_transposeFilter); + } + + // Assign transpose filter. + l_res->setFilter(l_transposeFilter); + } + + // Add action to resolution. + l_res->Add(i_bits, i_bitSize, &i_action); +}; + +void PrdfGroup::Add(SCAN_COMM_REGISTER_CLASS * i_reg, + Resolution & i_action, + PrdfResetAndMaskPair & i_resets, + uint16_t i_scrID) +{ + ResolutionMap * l_res = cv_resMaps[i_reg]; + + if (NULL == l_res) + { + l_res = cv_resMaps[i_reg] = new prdfResolutionMap(1, cv_defaultRes); + ResetAndMaskErrorRegister * l_errReg = + new ResetAndMaskErrorRegister(*i_reg, *l_res, i_scrID); + cv_errRegs.push_back(l_errReg); + + // Sort reset and mask lists. + std::sort(i_resets.first.begin(), i_resets.first.end()); + std::sort(i_resets.second.begin(), i_resets.second.end()); + + // Remove duplicate resets and masks. + i_resets.first.erase( + std::unique(i_resets.first.begin(), i_resets.first.end()), + i_resets.first.end()); + i_resets.second.erase( + std::unique(i_resets.second.begin(), i_resets.second.end()), + i_resets.second.end()); + + // Add resets. + std::for_each(i_resets.first.begin(), i_resets.first.end(), + std::bind1st( + std::mem_fun(&ResetAndMaskErrorRegister::addReset), + l_errReg) + ); + + // Add masks. + std::for_each(i_resets.second.begin(), i_resets.second.end(), + std::bind1st( + std::mem_fun(&ResetAndMaskErrorRegister::addMask), + l_errReg) + ); + } + + l_res->ReplaceDefaultWith(i_action); + +}; + +void PrdfGroup::AddFilter(prdfFilter * i_filter) +{ + // Add to filter list, for deallocation later. + cv_filters.push_back(i_filter); + + // Iterate through all resolution maps. + for(ResMaps_t::const_iterator i = cv_resMaps.begin(); + i != cv_resMaps.end(); + i++) + { + // Get old filter. + prdfFilter * l_filter = ((ResolutionMap *)(*i).second)->getFilter(); + + // Need new filter link? + if (NULL != l_filter) + { + // Use original filters first. (we add transposes first.) + l_filter = new FilterLink(*l_filter, + *i_filter); // pw01 + + // Add to filter list, for deallocation later. + cv_filters.push_back(l_filter); + } + else + { + l_filter = i_filter; + } + + // Assign filter to resolution map. + ((ResolutionMap *)(*i).second)->setFilter(l_filter); + } +} + + + +const BIT_STRING_CLASS & PrdfGroup::Read(ATTENTION_TYPE i_attn) +{ + static BIT_STRING_BUFFER_CLASS a(64); + return a; +}; + +BIT_LIST_CLASS PrdfGroup::Filter(const BIT_STRING_CLASS & i) +{ + return BIT_LIST_CLASS(); +}; + +int32_t PrdfGroup::Lookup(STEP_CODE_DATA_STRUCT & i_step, BIT_LIST_CLASS & b) +{ + return -1; +}; + +int32_t PrdfGroup::Reset(const BIT_LIST_CLASS & b, STEP_CODE_DATA_STRUCT & i_step) +{ + return -1; +}; + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// F494911 f310 03/04/05 iawillia Initial File Creation +// F510901 f300 07/15/05 iawillia Add support for resets/masks. +// D520844 f300 09/14/05 iawillia Add destructor to free memory. +// D515833 f300 09/19/05 iawillia Use VMap instead of Map. +// F544848 f300 04/03/06 iawillia Add multi-bit support. +// F548507 f300 04/21/06 iawillia Prevent multiple reset/masks. +// F557408 f310 06/16/06 iawillia Add single-bit filter support. +// pw01 D568068 f310 08/29/06 iawillia Fix filter order. +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/rule/prdfGroup.H b/src/usr/diag/prdf/common/framework/rule/prdfGroup.H new file mode 100755 index 000000000..cad9822f2 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdfGroup.H @@ -0,0 +1,113 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdfGroup.H $ */ +/* */ +/* 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 */ + +#ifndef __PRDFGROUP_H +#define __PRDFGROUP_H + +#include <iipErrorRegisterType.h> +#include <iipResetErrorRegister.h> +#include <map> +#include <utility> // for pair + +#include <vector> +#include <prdfFilters.H> + +// forward decls +class Resolution; +class ResolutionMap; +class SCAN_COMM_REGISTER_CLASS; +class ErrorRegister; +// end forward decls + +typedef std::pair<ResetAndMaskErrorRegister::ResetRegisterVector, + ResetAndMaskErrorRegister::ResetRegisterVector> + PrdfResetAndMaskPair; + +/*class PrdfResetAndMaskPair + : public std::pair<ResetAndMaskErrorRegister::ResetRegisterVector, + ResetAndMaskErrorRegister::ResetRegisterVector> + {};*/ + +class PrdfGroup : public ErrorRegisterType +{ + public: + PrdfGroup(Resolution & i_default) + : cv_nextBitForTranspose(64), cv_defaultRes(i_default) {}; + + ~PrdfGroup(); + + int32_t Analyze(STEP_CODE_DATA_STRUCT &); + + void Add(SCAN_COMM_REGISTER_CLASS *, + const uint8_t *, + size_t, + Resolution &, + PrdfResetAndMaskPair &, + uint16_t, // SCRID. + bool + ); // add standard action. + + void Add(SCAN_COMM_REGISTER_CLASS * i_reg, + Resolution & i_action, + PrdfResetAndMaskPair &, + uint16_t i_scrID); // add default action. + + void AddFilter(prdfFilter * i_filter); + + /** + * No Filters applied by this Error Register - so undo is no-op + */ + virtual bool FilterUndo(prdfBitKey & i_bit_list) { return false; } + + protected: + const BIT_STRING_CLASS & Read(ATTENTION_TYPE i_attn); + BIT_LIST_CLASS Filter(const BIT_STRING_CLASS &); + int32_t Lookup(STEP_CODE_DATA_STRUCT &, BIT_LIST_CLASS &); + int32_t Reset(const BIT_LIST_CLASS &, STEP_CODE_DATA_STRUCT &); + + typedef std::vector<ErrorRegister *> RegisterList_t; + typedef std::vector<prdfFilter *> FilterList_t; + + typedef std::map<SCAN_COMM_REGISTER_CLASS *, ResolutionMap *> ResMaps_t; + ResMaps_t cv_resMaps; + RegisterList_t cv_errRegs; + FilterList_t cv_filters; + uint8_t cv_nextBitForTranspose; + Resolution & cv_defaultRes; + +}; + + +#endif + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// F494911 f310 03/04/05 iawillia Initial File Creation +// F510901 f300 07/15/05 iawillia Add support for resets/masks. +// D520844 f300 09/14/05 iawillia Add destructor to free memory. +// D515833 f300 09/19/05 iawillia Use VMap instead of Map. +// F544848 f300 04/03/06 iawillia Add multi-bit support. +// F557408 f310 06/16/06 iawillia Add single-bit filter support. +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/rule/prdfPluginDef.H b/src/usr/diag/prdf/common/framework/rule/prdfPluginDef.H new file mode 100755 index 000000000..16e198860 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdfPluginDef.H @@ -0,0 +1,368 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdfPluginDef.H $ */ +/* */ +/* 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 */ + +#ifndef __PRDFPLUGINDEF_H +#define __PRDFPLUGINDEF_H + +#include <stdint.h> + +#ifdef __HOSTBOOT_MODULE + #include <stdlib.h> +#else + #include <cstdlib> +#endif + +namespace PrdfPluginDef +{ + class ParameterList + { + }; + + template <typename _A> + class SingleParameter : public ParameterList + { + private: + _A cv_value; + + public: + SingleParameter(_A v) : cv_value(v) {}; + operator _A() { return cv_value; }; + }; + + template <typename _A> + inline SingleParameter<_A> * + bindParm(_A v) { return new SingleParameter<_A>(v); }; + + template <typename _A, typename _B> + class TwoParameter : public ParameterList + { + private: + _A cv_valueA; + _B cv_valueB; + + public: + TwoParameter(_A vA, _B vB) : cv_valueA(vA), cv_valueB(vB) {}; + _A getA() { return cv_valueA; }; + _B getB() { return cv_valueB; }; + }; + + template <typename _A, typename _B> + inline TwoParameter<_A, _B> * + bindParm(_A vA, _B vB) { return new TwoParameter<_A,_B>(vA,vB); }; + + template <typename _A, typename _B, typename _C> + class ThreeParameter : public ParameterList + { + private: + _A cv_valueA; + _B cv_valueB; + _C cv_valueC; + + public: + ThreeParameter(_A vA, _B vB, _C vC) + : cv_valueA(vA), cv_valueB(vB), cv_valueC(vC) {}; + _A getA() { return cv_valueA; }; + _B getB() { return cv_valueB; }; + _C getC() { return cv_valueC; }; + }; + + template <typename _A, typename _B, typename _C> + inline ThreeParameter<_A, _B, _C> * + bindParm(_A vA, _B vB, _C vC) + { return new ThreeParameter<_A,_B,_C>(vA,vB,vC); }; + + template <typename _A, typename _B, typename _C, typename _D> + class FourParameter : public ParameterList + { + private: + _A cv_valueA; + _B cv_valueB; + _C cv_valueC; + _D cv_valueD; + + public: + FourParameter(_A vA, _B vB, _C vC, _D vD) + : cv_valueA(vA), cv_valueB(vB), cv_valueC(vC), + cv_valueD(vD) + {}; + _A getA() { return cv_valueA; }; + _B getB() { return cv_valueB; }; + _C getC() { return cv_valueC; }; + _D getD() { return cv_valueD; }; + }; + + template <typename _A, typename _B, typename _C, typename _D> + inline FourParameter<_A, _B, _C, _D> * + bindParm(_A vA, _B vB, _C vC, _D vD) + { return new FourParameter<_A,_B,_C,_D>(vA,vB,vC,vD); }; + + +}; + +class PrdfExtensibleFunctionType +{ + public: + virtual ~PrdfExtensibleFunctionType() {}; +}; + +template <typename _ExtensibleObject> +class PrdfExtensibleFunction : public PrdfExtensibleFunctionType +{ + public: + virtual ~PrdfExtensibleFunction() { } // zs01 + virtual int32_t operator()(_ExtensibleObject * A, + PrdfPluginDef::ParameterList * B) = 0; +}; + +class PrdfExtensibleChip; +class PrdfExtensibleDomain; +typedef PrdfExtensibleFunction<PrdfExtensibleChip> PrdfExtensibleChipFunction; +typedef PrdfExtensibleFunction<PrdfExtensibleDomain> + PrdfExtensibleDomainFunction; + + +template <typename _ExtensibleObject> +class PrdfPlugin : public PrdfExtensibleFunction<_ExtensibleObject> +{ + protected: + int32_t (*_func)(_ExtensibleObject *, PrdfPluginDef::ParameterList *); + public: + explicit PrdfPlugin(int32_t (*func)(_ExtensibleObject *, + PrdfPluginDef::ParameterList *)) + : _func(func) {}; + + int32_t operator()(_ExtensibleObject * A, + PrdfPluginDef::ParameterList * B) + { + int32_t i = 0; + if (NULL != _func) + { + i = _func(A,B); + } + delete B; + return i; + }; +}; + +template <typename _ExtensibleObject> +class PrdfPlugin_0arg : public PrdfExtensibleFunction<_ExtensibleObject> +{ + protected: + int32_t (*_func)(_ExtensibleObject *); + public: + explicit PrdfPlugin_0arg(int32_t (*func)(_ExtensibleObject *)) + : _func(func) {}; + + int32_t operator()(_ExtensibleObject * A, + PrdfPluginDef::ParameterList * B) + { + int32_t i = _func(A); + delete B; + return i; + }; +}; + +template <typename _ExtensibleObject> +inline PrdfPlugin_0arg<_ExtensibleObject> + bind_plugin(int32_t (*func)(_ExtensibleObject *)) + { return PrdfPlugin_0arg<_ExtensibleObject>(func); }; + +template <typename _ExtensibleObject> +inline PrdfPlugin_0arg<_ExtensibleObject> * + bind_plugin_ptr(int32_t (*func)(_ExtensibleObject *), void * ptr) + { return new (ptr) PrdfPlugin_0arg<_ExtensibleObject>(func); }; + +template <typename _A, typename _ExtensibleObject> +class PrdfPlugin_1arg : public PrdfExtensibleFunction<_ExtensibleObject> +{ + protected: + int32_t (*_func)(_ExtensibleObject *, _A); + public: + explicit PrdfPlugin_1arg(int32_t (*func)(_ExtensibleObject *, _A)) + : _func(func) {}; + + int32_t operator()(_ExtensibleObject * A, + PrdfPluginDef::ParameterList * B) + { + int32_t i = _func(A, + (_A)static_cast<PrdfPluginDef::SingleParameter<_A> &>(*B)); + delete B; + return i; + }; +}; + +template <typename _A, typename _ExtensibleObject> +inline PrdfPlugin_1arg<_A, _ExtensibleObject> + bind_plugin(int32_t (*func)(_ExtensibleObject *, _A)) + { return PrdfPlugin_1arg<_A, _ExtensibleObject>(func); }; + +template <typename _A, typename _ExtensibleObject> +inline PrdfPlugin_1arg<_A, _ExtensibleObject> * + bind_plugin_ptr(int32_t (*func)(_ExtensibleObject *, _A), void * ptr) + { return new (ptr) PrdfPlugin_1arg<_A, _ExtensibleObject>(func); }; + + +template <typename _A, typename _B, typename _ExtensibleObject> +class PrdfPlugin_2arg : public PrdfExtensibleFunction<_ExtensibleObject> +{ + protected: + int32_t (*_func)(_ExtensibleObject *, _A, _B); + public: + explicit PrdfPlugin_2arg(int32_t (*func)(_ExtensibleObject *, _A, _B)) + : _func(func) {}; + + int32_t operator()(_ExtensibleObject * A, + PrdfPluginDef::ParameterList * B) + { + int32_t i = _func(A, + static_cast<PrdfPluginDef::TwoParameter<_A,_B> *>(B)->getA(), + static_cast<PrdfPluginDef::TwoParameter<_A,_B> *>(B)->getB()); + delete B; + return i; + }; +}; + +template <typename _A, typename _B, typename _ExtensibleObject> +inline PrdfPlugin_2arg<_A, _B, _ExtensibleObject> + bind_plugin(int32_t (*func)(_ExtensibleObject *, _A, _B)) + { return PrdfPlugin_2arg<_A, _B, _ExtensibleObject>(func); }; + +template <typename _A, typename _B, typename _ExtensibleObject> +inline PrdfPlugin_2arg<_A, _B, _ExtensibleObject> * + bind_plugin_ptr(int32_t (*func)(_ExtensibleObject *, _A, _B), void * ptr) + { return new (ptr) PrdfPlugin_2arg<_A, _B, _ExtensibleObject>(func); }; + + +template <typename _A, typename _B, typename _C, typename _ExtensibleObject> +class PrdfPlugin_3arg : public PrdfExtensibleFunction<_ExtensibleObject> +{ + protected: + int32_t (*_func)(_ExtensibleObject *, _A, _B, _C); + public: + explicit PrdfPlugin_3arg(int32_t (*func) + (_ExtensibleObject *, _A, _B, _C)) + : _func(func) {}; + + int32_t operator()(_ExtensibleObject * A, + PrdfPluginDef::ParameterList * B) + { + int32_t i = _func(A, + static_cast<PrdfPluginDef::ThreeParameter<_A,_B,_C> *> + (B)->getA(), + static_cast<PrdfPluginDef::ThreeParameter<_A,_B,_C> *> + (B)->getB(), + static_cast<PrdfPluginDef::ThreeParameter<_A,_B,_C> *> + (B)->getC() + ); + delete B; + return i; + }; +}; + +template <typename _A, typename _B, typename _C, typename _ExtensibleObject> +inline PrdfPlugin_3arg<_A, _B, _C, _ExtensibleObject> + bind_plugin(int32_t (*func)(_ExtensibleObject *, _A, _B, _C)) + { return PrdfPlugin_3arg<_A, _B, _C, _ExtensibleObject>(func); }; + +template <typename _A, typename _B, typename _C, typename _ExtensibleObject> +inline PrdfPlugin_3arg<_A, _B, _C, _ExtensibleObject> * + bind_plugin_ptr(int32_t (*func)(_ExtensibleObject *, _A, _B, _C), + void * ptr) + { return new (ptr) + PrdfPlugin_3arg<_A, _B, _C, _ExtensibleObject>(func); }; + +template <typename _A, typename _B, typename _C, typename _D, + typename _ExtensibleObject> +class PrdfPlugin_4arg : public PrdfExtensibleFunction<_ExtensibleObject> +{ + protected: + int32_t (*_func)(_ExtensibleObject *, _A, _B, _C, _D); + public: + explicit PrdfPlugin_4arg(int32_t (*func) + (_ExtensibleObject *, _A, _B, _C, _D)) + : _func(func) {}; + + int32_t operator()(_ExtensibleObject * A, + PrdfPluginDef::ParameterList * B) + { + int32_t i = _func(A, + static_cast<PrdfPluginDef::FourParameter<_A,_B,_C,_D> *> + (B)->getA(), + static_cast<PrdfPluginDef::FourParameter<_A,_B,_C,_D> *> + (B)->getB(), + static_cast<PrdfPluginDef::FourParameter<_A,_B,_C,_D> *> + (B)->getC(), + static_cast<PrdfPluginDef::FourParameter<_A,_B,_C,_D> *> + (B)->getD() + ); + delete B; + return i; + }; +}; + +template <typename _A, typename _B, typename _C, typename _D, + typename _ExtensibleObject> +inline PrdfPlugin_4arg<_A, _B, _C, _D, _ExtensibleObject> + bind_plugin(int32_t (*func)(_ExtensibleObject *, _A, _B, _C, _D)) + { return PrdfPlugin_4arg<_A, _B, _C, _D, _ExtensibleObject>(func); }; + +template <typename _A, typename _B, typename _C, typename _D, + typename _ExtensibleObject> +inline PrdfPlugin_4arg<_A, _B, _C, _D, _ExtensibleObject> * + bind_plugin_ptr(int32_t (*func)(_ExtensibleObject *, _A, _B, _C, _D), + void * ptr) + { return new (ptr) + PrdfPlugin_4arg<_A, _B, _C, _D, _ExtensibleObject>(func); }; + + +#define __PRDF_PLUGIN_XYZ(X,Y,Z) X##Y##Z +#define __PRDF_PLUGIN_MAKENAME(X,Y,Z) __PRDF_PLUGIN_XYZ(X,Y,Z) + +#define PRDF_PLUGIN_DEFINE(CHIP,PLUGIN_NAME) \ + class __PRDF_PLUGIN_MAKENAME(PrdfPlugin_Registration_,CHIP,PLUGIN_NAME) \ + { \ + private: \ + PrdfExtensibleFunctionType * cv_plugin; \ + PrdfPluginRegisterClass cv_registerClass; \ + char cv_plugin_space[sizeof(PrdfPlugin<PrdfExtensibleChip>)]; \ + public: \ + __PRDF_PLUGIN_MAKENAME(PrdfPlugin_Registration_,CHIP,PLUGIN_NAME)() : \ + cv_plugin( bind_plugin_ptr(&PRDF::CHIP::PLUGIN_NAME, \ + &cv_plugin_space) ), \ + cv_registerClass(#CHIP,#PLUGIN_NAME,cv_plugin) \ + {} \ + }; \ + __PRDF_PLUGIN_MAKENAME(PrdfPlugin_Registration_,CHIP,PLUGIN_NAME) \ + __PRDF_PLUGIN_MAKENAME(g_PluginRegistration_,CHIP,PLUGIN_NAME) +#endif + +#include <prdfPluginMap.H> + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// F494911 f310 03/04/05 iawillia Initial File Creation +// F522638 f300 09/27/05 iawillia Add 4 parm, fix possible obj strip. +// zs01 D620028 f330 07/25/07 zshelle Support for mcp5 compiler +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/rule/prdfPluginMap.C b/src/usr/diag/prdf/common/framework/rule/prdfPluginMap.C new file mode 100755 index 000000000..6a776d7e8 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdfPluginMap.C @@ -0,0 +1,53 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdfPluginMap.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2005,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 */ + +#include <prdfPluginMap.H> + +PrdfPluginGlobalMap & prdfGetPluginGlobalMap() +{ + static PrdfPluginGlobalMap g_globalPluginMap; + return g_globalPluginMap; +}; + +void PrdfPluginGlobalMap::registerPlugin(const char * i_chipName, + const char * i_pluginName, + PrdfExtensibleFunctionType * i_plugin) +{ + this->cv_globalMap[i_chipName][i_pluginName] = i_plugin; +}; + +PrdfPluginMap & PrdfPluginGlobalMap::getPlugins(const char * i_chipName) +{ + return this->cv_globalMap[i_chipName]; +}; + +PrdfPluginRegisterClass::PrdfPluginRegisterClass( + const char * i_chipName, + const char * i_pluginName, + PrdfExtensibleFunctionType * i_plugin) +{ + prdfGetPluginGlobalMap().registerPlugin(i_chipName, + i_pluginName, + i_plugin); +}; + diff --git a/src/usr/diag/prdf/common/framework/rule/prdfPluginMap.H b/src/usr/diag/prdf/common/framework/rule/prdfPluginMap.H new file mode 100755 index 000000000..dea82cd97 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdfPluginMap.H @@ -0,0 +1,75 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdfPluginMap.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2005,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 __PRDFPLUGINMAP_H +#define __PRDFPLUGINMAP_H + +#include <map> +#include <prdfPluginDef.H> +#include <string.h> +#include <functional> + +class PrdfExtensibleChip; + +/** + * @brief custom comparison functor to pass to a map container + * that uses char* as the key + */ +struct PrdfStrCompare : public std::binary_function<const char*, const char*, bool> +{ + public: + bool operator() (const char* str1, const char* str2) const + { + return strcmp(str1, str2) < 0; + } +}; + +typedef std::map<const char *, PrdfExtensibleFunctionType *, PrdfStrCompare> PrdfPluginMap; + +class PrdfPluginGlobalMap; +PrdfPluginGlobalMap & prdfGetPluginGlobalMap(); + +class PrdfPluginGlobalMap +{ + private: + std::map<const char *, PrdfPluginMap, PrdfStrCompare> cv_globalMap; + + public: + PrdfPluginGlobalMap() : cv_globalMap() {}; + + void registerPlugin(const char * i_chipName, + const char * i_pluginName, + PrdfExtensibleFunctionType * i_plugin); + + PrdfPluginMap & getPlugins(const char * i_chipName); +}; + +class PrdfPluginRegisterClass +{ + public: + PrdfPluginRegisterClass(const char * i_chipName, + const char * i_pluginName, + PrdfExtensibleFunctionType * i_plugin); +}; + +#endif diff --git a/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.C b/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.C new file mode 100755 index 000000000..50d054122 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.C @@ -0,0 +1,1003 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdfRuleChip.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 */ + +#ifndef __HOSTBOOT_MODULE + #include <utilreg.H> // for UtilReg + #include <prdfMfgThresholdMgr.H> + #include <prdfSdcFileControl.H> //for SyncAnalysis +#endif + +#include <iipglobl.h> // for SystemPtr. + +#include <prdfRuleChip.H> +#include <prdrLoadChip.H> +#include <prdrLoadChipCache.H> +#include <prdfOperatorRegister.H> +#include <prdfGroup.H> +#include <prdfPluginMap.H> +#include <prdrCommon.H> // for enums. + +#include <prdfScanFacility.H> // for ScanFacility +#include <iipResolutionFactory.h> // for ResolutionFactory +#include <iipCaptureData.h> // for CaptureData +#include <iipServiceDataCollector.h> // for ServiceDataCollector +#include <prdfErrorSignature.H> // for ErrorSignature +#include <iipResolution.h> // for Resolutions +#include <iipEregResolution.h> // for EregResolution +#include <xspprdDumpResolution.h> // for DumpResolution +#include <xspprdTryResolution.h> // for TryResolution +#include <prdfPluginCallResolution.H> // for PrdfPluginCallResolution +#include <prdfAnalyzeConnected.H> // for prdfAnalyzeConnected +#include <iipSystem.h> // for System +#include <xspprdFlagResolution.h> +#include <prdfPfa5Data.h> // for errl user data flags. + +#include <prdfPlatServices.H> // for getConnected + +#include <errlentry.H> // for errl. +#include <utilfile.H> // for UtilFile +#include <UtilHash.H> // for Util::hashString + +#include <prdfResetOperators.H> +#include <algorithm> + +template <bool Type> +struct ResetAndMaskTransformer + : public std::unary_function<Prdr::PrdrRegister::ResetOrMaskStruct, + ResetAndMaskErrorRegister::ResetRegisterStruct> +{ + ResetAndMaskTransformer(ScanFacility & i_scanFactory, + TARGETING::TargetHandle_t i_pchipHandle , + size_t i_scomlen) + : cv_scanFactory(i_scanFactory), + cv_pchipHandle (i_pchipHandle ), + cv_scomlen(i_scomlen) + {}; + + virtual ~ResetAndMaskTransformer() {}; // zs01 + + virtual ResetAndMaskErrorRegister::ResetRegisterStruct + operator()(const Prdr::PrdrRegister::ResetOrMaskStruct & i) + { + ResetAndMaskErrorRegister::ResetRegisterStruct o; + + o.read = &cv_scanFactory.GetScanCommRegister(cv_pchipHandle , + i.addr_r, + cv_scomlen); + o.write = &cv_scanFactory.GetScanCommRegister(cv_pchipHandle , + i.addr_w, + cv_scomlen); + + switch (i.op) + { + case Prdr::OR: + o.op = getStaticResetOperator<OrOperator<Type> >(); + break; + + case Prdr::AND: + o.op = getStaticResetOperator<AndOperator<Type> >(); + break; + + case Prdr::XOR: + o.op = getStaticResetOperator<XorOperator<Type> >(); + break; + + case Prdr::NOT: + o.op = getStaticResetOperator<NotOperator<Type> >(); + break; + + default: + o.op = NULL; // TODO: ERROR! Assert... + break; + } + + return o; + }; + + private: + ScanFacility & cv_scanFactory; + TARGETING::TargetHandle_t cv_pchipHandle ; + size_t cv_scomlen; +}; + + +void PrdfRuleChip::loadRuleFile(ScanFacility & i_scanFactory, + ResolutionFactory & i_reslFactory) +{ + using namespace PRDF; + + RegMap_t l_regMap; + Reset_t l_resetMap; + PrdfResetAndMaskPair l_currentResets; + uint32_t l_regMax = 0; + uint32_t l_vregMax = 0; + GroupMap_t l_groupMap; + uint32_t l_groupMax = 0; + ActionMap_t l_actionMap; + uint32_t l_actionMax = 0; + uint32_t l_id = 1; + + SharedThreshold_t l_sharedThresholds; + + Prdr::PrdrChip * l_chip; + + /* Initialize local data struct to pass to sub-functions */ + RuleFileData l_localData = { l_regMap, l_groupMap, l_actionMap, + i_scanFactory, i_reslFactory, + this->GetChipHandle(), l_chip, + l_resetMap, l_currentResets, + l_sharedThresholds + }; + + // Parse chip file. + cv_errl = Prdr::LoadChipCache::loadChip(cv_fileName, &l_chip); + if (NULL == l_chip) + { + // TODO: Do we need to percAbend? We were unable to succesfully + // load our chip objects. + return; + } + + // Get default dump type. + cv_dumpType = l_chip->cv_dumpType; + + // Set signature offset for capture data output. + iv_sigOff = l_chip->cv_signatureOffset; + + // create hardware regs. + for (int i = 0; i < l_chip->cv_regCount; i++) + { + uint16_t hashId = l_chip->cv_registers[i].cv_name; + + l_regMap[l_id] = cv_hwRegs[hashId] + = &i_scanFactory.GetScanCommRegister( + this->GetChipHandle(), + l_chip->cv_registers[i].cv_scomAddr, + l_chip->cv_registers[i].cv_scomLen ); + l_regMap[l_id]->SetId(hashId); + + // Copy reset registers. + std::transform + (l_chip->cv_registers[i].cv_resets.begin(), + l_chip->cv_registers[i].cv_resets.end(), + std::back_inserter(l_resetMap[l_id].first), + ResetAndMaskTransformer<RESETOPERATOR_RESET>( + i_scanFactory, + this->GetChipHandle(), + l_chip->cv_registers[i].cv_scomLen) + ); + + // Copy mask registers. + std::transform + (l_chip->cv_registers[i].cv_masks.begin(), + l_chip->cv_registers[i].cv_masks.end(), + std::back_inserter(l_resetMap[l_id].second), + ResetAndMaskTransformer<RESETOPERATOR_MASK>( + i_scanFactory, + this->GetChipHandle(), + l_chip->cv_registers[i].cv_scomLen) + ); + + //This flag signifies that a mapping IS or ISN'T created between a + // uint32_t mapping and a vector of SCAN_COMM_REGISTER_CLASS pointers. + //If there is no mapping outside of the for loop then it is because + // there is a capture type or requirement without a group statement in the rule file. + bool l_group_is_created = false; + // Copy into capture groups. + std::vector<Prdr::PrdrRegister::CaptureInfoStruct>::const_iterator + l_capturesEnd = l_chip->cv_registers[i].cv_captures.end(); + //For each capture in this register save a Group Type or Requirement. + for(std::vector<Prdr::PrdrRegister::CaptureInfoStruct>::const_iterator + j = l_chip->cv_registers[i].cv_captures.begin(); + j != l_capturesEnd; + ++j) + { + if ('G' == (*j).op) + { + cv_hwCaptureGroups[(*j).data[0]].push_back(l_regMap[l_id]); + l_group_is_created = true; //@jl06 Added this to indicate group was created. + } + // @jl04 a Start. + // This else if was added for a new capture "type" for registers primary/secondary. + // Cannot put the "type" in with the G group otherwise it will show up as a + // i_group of 2 which is not called. + else if('T' == (*j).op) + { + //@jl06. d Deleted temporary declaration of PrdfCaptureType in + // favor of an anonymous declaration. Calls ctor twice. + cv_hwCaptureType[l_regMap[l_id]] = + PrdfCaptureType((RegType)(*j).data[0]); //@jl06 c. + } + // @jl04 a Stop. + else if ('f' == (*j).op) + { + PrdfCaptureRequirement req; + req.cv_func = this->getExtensibleFunction(j->func); + + cv_hwCaptureReq[l_regMap[l_id]] = req; + } + else // 'C' + { + PrdfCaptureRequirement req; + req.cv_TargetType = (*j).data[0]; + req.cv_TargetIndex = (*j).data[1]; + req.cv_func = NULL; + + cv_hwCaptureReq[l_regMap[l_id]] = req; + } + } + if (!l_group_is_created) // @jl06 c Add to default group if none there. + { + // Add to default if no group specified. + cv_hwCaptureGroups[1].push_back(l_regMap[l_id]); + } + + l_regMax = l_id++; + + } + + for (int i = 0; i < l_chip->cv_ruleCount; i++) + { + if (l_regMap[l_id]) // check if it already exists. + { + l_vregMax = l_id++; + continue; + } + + l_currentResets = PrdfResetAndMaskPair(); + + SCAN_COMM_REGISTER_CLASS * l_tmp = + this->createVirtualRegister(&l_chip->cv_rules[i], l_localData); + + l_regMap[l_id] = l_tmp; + l_resetMap[l_id] = l_currentResets; + l_vregMax = l_id++; + }; + + // initialize all the pointers for the groups, but don't construct their + // data yet. + Resolution & l_defaultResolution = + i_reslFactory.GetCalloutResolution( this->GetChipHandle(), + MRU_MED ); + for (int i = 0; i < l_chip->cv_groupCount; i++) + { + PrdfGroup * l_tmp = new PrdfGroup(l_defaultResolution); + l_groupMap[l_id] = l_tmp; + l_groupMax = l_id++; + }; + + for (int i = 0; i < l_chip->cv_actionCount; i++) + { + if (l_actionMap[i]) + { + l_actionMax = l_id++; + continue; + } + + // createActionClass will add to the actionMap. + this->createActionClass(i, l_localData); + //l_actionMap[l_id] = l_tmp; + l_actionMax = l_id++; + } + + for (int i = 0; i < l_chip->cv_groupCount; i++) + { + this->createGroup((PrdfGroup *) l_groupMap[i+l_vregMax+1], + i, + l_localData); + } + for (int i = 0; i < NUM_GROUP_ATTN; i++) // @jl02 UNIT_CS Changes. JL + cv_groupAttn[i] = l_groupMap[l_chip->cv_groupAttn[i]]; + + // Call initialize plugin. + PrdfExtensibleChipFunction * l_init = getExtensibleFunction("Initialize", true); + if (NULL != l_init) + { + (*l_init) + (this, + PrdfPluginDef::bindParm<void*>(NULL) + ); + } + + return; +}; + +PrdfRuleChip::~PrdfRuleChip() +{ + if (NULL != cv_dataBundle) + { + delete cv_dataBundle; + } +}; + + +int32_t PrdfRuleChip::Analyze(STEP_CODE_DATA_STRUCT & i_serviceData, + ATTENTION_TYPE i_attnType) +{ + using namespace PRDF; + ServiceDataCollector & i_sdc = *(i_serviceData.service_data); + ErrorSignature & l_errSig = *(i_sdc.GetErrorSignature()); + CaptureData & capture = i_serviceData.service_data->GetCaptureData(); // @jl04 a Add this for Drop call. + + // Set current ATTN type to input value. + // If we don't do this, then the AttnRegisters don't work. + i_sdc.SetCauseAttentionType(i_attnType); // @pw02 @pw04 + + int32_t l_rc = SUCCESS; + + // Set Signature Chip Id. + l_errSig.setChipId( GetId() ); + + // Set default dump flags. //@ecdf + //FIXME: take out hwTableContent for now for Hostboot + #ifdef __HOSTBOOT_MODULE + i_sdc.SetDump(/*(hwTableContent)cv_dumpType,*/ GetChipHandle()); + #else + i_sdc.SetDump((hwTableContent)cv_dumpType, GetChipHandle()); + #endif + + // Get capture data for this chip. Allow override. + PrdfExtensibleChipFunction * l_ignoreCapture = + getExtensibleFunction("PreventDefaultCapture", true); + bool l_shouldPreventDefaultCapture = false; + + (*l_ignoreCapture) + (this, PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&, bool&> + (i_serviceData, l_shouldPreventDefaultCapture)); + + if (!l_shouldPreventDefaultCapture) + { + // Drop secondary capture from earlier chips. + capture.Drop(SECONDARY); + + // Read capture data. + this->CaptureErrorData(i_sdc.GetCaptureData()); + } + + // Analyze group. + ErrorRegisterType * l_errReg = NULL; + switch (i_attnType) + { + case CHECK_STOP: + l_errReg = cv_groupAttn[0]; + break; + + case RECOVERABLE: + l_errReg = cv_groupAttn[1]; + break; + + case SPECIAL: + l_errReg = cv_groupAttn[2]; + break; + + case UNIT_CS: // @jl02 JL Added this code to support the new Unit Check Stop. + l_errReg = cv_groupAttn[3]; // @jl02 JL I don't know if this is the correct cv_groupAttn to add here or if it's needed. + break; + + } + if (NULL != l_errReg) + { //mp02 a Start + //Call any pre analysis functions + PrdfExtensibleChipFunction * l_preAnalysis = + getExtensibleFunction("PreAnalysis", true); + bool analyzed = false; + (*l_preAnalysis)(this, + PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&,bool&> + (i_serviceData,analyzed)); + if ( !analyzed) + l_rc = l_errReg->Analyze(i_serviceData); + } //mp02 a Stop + // mp02d l_rc = l_errReg->Analyze(i_serviceData); + else //@jl07 + l_rc = PRD_SCAN_COMM_REGISTER_ZERO; //@jl07 + + // Don't do reset or mask on CS. @pw03 + if (CHECK_STOP != i_serviceData.service_data->GetAttentionType()) //@pw04 + { + #ifndef __HOSTBOOT_MODULE + SyncAnalysis (i_sdc); //mp01 Add call to Sync SDC + #endif + // Call mask plugin. + if (i_serviceData.service_data->IsAtThreshold()) + { + PrdfExtensibleChipFunction * l_mask = + getExtensibleFunction("MaskError", true); + (*l_mask)(this, + PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(i_serviceData) + ); //@pw01 + } + + // Call reset plugin. + PrdfExtensibleChipFunction * l_reset = + getExtensibleFunction("ResetError", true); + (*l_reset)(this, + PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(i_serviceData) + ); //@pw01 + } + + // Call postanalysis plugin. + // @jl02 JL Adding PostAnalysis plugin call. + PrdfExtensibleChipFunction * l_postanalysis = + getExtensibleFunction("PostAnalysis", true); + // @jl02 the true above means that a plugin may not exist for this call. + // @jl02 JL Adding call for post analysis. + (*l_postanalysis)(this, + PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(i_serviceData)); + + return l_rc; +}; + +int32_t PrdfRuleChip::CaptureErrorData(CaptureData & i_cap, int i_group) +{ + using namespace TARGETING; + using namespace PRDF; + + std::vector<SCAN_COMM_REGISTER_CLASS *>::const_iterator l_hwCaptureEnd = + cv_hwCaptureGroups[i_group].end(); + for (std::vector<SCAN_COMM_REGISTER_CLASS *>::const_iterator i = + cv_hwCaptureGroups[i_group].begin(); + i != l_hwCaptureEnd; + ++i) + { + // Check that requirements are satisfied. + if (PrdfCaptureRequirement() != cv_hwCaptureReq[*i]) + { + PrdfCaptureRequirement req = cv_hwCaptureReq[*i]; + if (NULL != req.cv_func) + { + bool l_cap = true; + (*req.cv_func)(this, PrdfPluginDef::bindParm<bool &>(l_cap)); + if (!l_cap) + continue; + } + else + { + bool l_indexValid =false; + TargetHandleList l_ptargetHandleList = + PlatServices::getConnected(this->GetChipHandle(), + (TARGETING::TYPE) req.cv_TargetType); + TargetHandleList ::iterator itrTarget =l_ptargetHandleList.begin(); + for( ; itrTarget != l_ptargetHandleList.end();itrTarget++ ) + { + if (req.cv_TargetIndex == PlatServices::getTargetPosition(*itrTarget)) + { + l_indexValid = true; + break; + } + } + if(false == l_indexValid) + { + continue; + } + } + } + + i_cap.Add(this->GetChipHandle(), + (*i)->GetId() ^ this->getSignatureOffset(), + *(*i), + CaptureData::BACK, //@jl04 c change this because of proto. + cv_hwCaptureType[*i].cv_regType); //@jl04 c Changed this function call to add a param. + } + + // Call "PostCapture" plugin + PrdfExtensibleChipFunction * l_postCapture = + getExtensibleFunction("PostCapture", true); + + (*l_postCapture) + (this, + PrdfPluginDef::bindParm<CaptureData &, int>(i_cap, i_group) + ); + + return SUCCESS; +} + +SCAN_COMM_REGISTER_CLASS * +PrdfRuleChip::createVirtualRegister( + Prdr::PrdrExpr * i_vReg, + RuleFileData & i_data + ) +{ + SCAN_COMM_REGISTER_CLASS * l_arg[4] = { NULL }; + uint32_t l_tmp32 = 0; + SCAN_COMM_REGISTER_CLASS * l_rc = NULL; + + switch(i_vReg->cv_op) + { + case Prdr::NOT: + l_arg[0] = createVirtualRegister(i_vReg->cv_value[0].p, i_data); + l_rc = &i_data.cv_scanFactory.GetNotRegister(*l_arg[0]); + break; + + case Prdr::LSHIFT: + case Prdr::RSHIFT: + l_arg[0] = createVirtualRegister(i_vReg->cv_value[0].p, i_data); + l_tmp32 = i_vReg->cv_value[1].p->cv_value[0].i; + l_rc = (Prdr::LSHIFT == i_vReg->cv_op + ? + &i_data.cv_scanFactory.GetLeftShiftRegister(*l_arg[0], + l_tmp32) + : + &i_data.cv_scanFactory.GetRightShiftRegister(*l_arg[0], + l_tmp32) + ); + break; + + case Prdr::OR: + case Prdr::AND: + l_arg[0] = createVirtualRegister(i_vReg->cv_value[0].p, i_data); + l_arg[1] = createVirtualRegister(i_vReg->cv_value[1].p, i_data); + l_rc = (Prdr::OR == i_vReg->cv_op + ? + &i_data.cv_scanFactory.GetOrRegister(*l_arg[0], + *l_arg[1]) + : + &i_data.cv_scanFactory.GetAndRegister(*l_arg[0], + *l_arg[1]) + ); + break; + + + case Prdr::REF_REG: + std::copy(i_data.cv_resets[i_vReg->cv_value[0].i].first.begin(), + i_data.cv_resets[i_vReg->cv_value[0].i].first.end(), + std::back_inserter(i_data.cv_currentResets.first)); + std::copy(i_data.cv_resets[i_vReg->cv_value[0].i].second.begin(), + i_data.cv_resets[i_vReg->cv_value[0].i].second.end(), + std::back_inserter(i_data.cv_currentResets.second)); + l_rc = i_data.cv_regMap[i_vReg->cv_value[0].i]; + break; + + case Prdr::REF_RULE: + if (NULL == i_data.cv_regMap[i_vReg->cv_value[0].i]) + i_data.cv_regMap[i_vReg->cv_value[0].i] = + createVirtualRegister( + &i_data.cv_loadChip-> + cv_rules[i_vReg->cv_value[0].i], + i_data); + l_rc = i_data.cv_regMap[i_vReg->cv_value[0].i]; + break; + + case Prdr::ATTNLINK: + if (NULL != i_vReg->cv_value[0].p) + l_arg[0] = createVirtualRegister(i_vReg->cv_value[0].p, i_data); + + if (NULL != i_vReg->cv_value[1].p) + l_arg[1] = createVirtualRegister(i_vReg->cv_value[1].p, i_data); + + if (NULL != i_vReg->cv_value[2].p) + l_arg[2] = createVirtualRegister(i_vReg->cv_value[2].p, i_data); + + if (NULL != i_vReg->cv_value[3].p) + l_arg[3] = createVirtualRegister(i_vReg->cv_value[3].p, i_data); + + l_rc = &i_data.cv_scanFactory.GetAttnTypeRegister(*l_arg[0], /*passing null object*/ + *l_arg[1], /*passing null object*/ + *l_arg[2], /*passing null object*/ + *l_arg[3]); /*passing null object*/ + break; + + case Prdr::BIT_STR: + { + uint32_t l_size = i_vReg->cv_bitStrVect.size(); + BIT_STRING_BUFFER_CLASS l_bs(l_size * 64); + + for (uint32_t i = 0; i < l_size; i++) + { + l_bs.SetFieldJustify(32*(2*i) , 32, + (i_vReg->cv_bitStrVect[i] >> 32) & 0xFFFFFFFF); + l_bs.SetFieldJustify(32*((2*i)+1), 32, + (i_vReg->cv_bitStrVect[i] & 0xFFFFFFFF)); + } + + l_rc = &i_data.cv_scanFactory.GetConstantRegister(l_bs); + } + break; + + } + + return l_rc; +}; + +Resolution * +PrdfRuleChip::createActionClass(uint32_t i_action, + PrdfRuleChip::RuleFileData & i_data) +{ + if (NULL != i_data.cv_actionMap[i_action]) + return i_data.cv_actionMap[i_action]; + + Resolution * l_tmpRes = NULL, * l_retRes = NULL; + for (int i = 0; i < i_data.cv_loadChip->cv_actionSize[i_action]; i++) + { + l_tmpRes = this->createResolution( + &(i_data.cv_loadChip->cv_actions[i_action][i]), + i_data); + if (0 == i) + { + l_retRes = l_tmpRes; + } + else + { + l_retRes = &i_data.cv_reslFactory. + LinkResolutions(*l_retRes, *l_tmpRes); + } + } + + if (NULL == l_retRes) // @pw05 + { + class NullResolution : public Resolution + { + public: + int32_t Resolve(STEP_CODE_DATA_STRUCT & data) + { return SUCCESS; }; + }; + + static NullResolution l_nullRes; + l_retRes = &l_nullRes; + } + + i_data.cv_actionMap[i_action] = l_retRes; + return l_retRes; +}; + +Resolution * +PrdfRuleChip::createResolution(Prdr::PrdrExpr * i_action, + PrdfRuleChip::RuleFileData & i_data) +{ + using namespace PRDF; + + Resolution * l_rc = NULL; + + switch (i_action->cv_op) + { + case Prdr::REF_ACT: + l_rc = this->createActionClass(i_action->cv_value[0].i - + (i_data.cv_loadChip->cv_regCount + + i_data.cv_loadChip->cv_ruleCount + + i_data.cv_loadChip->cv_groupCount + + 1), + i_data); + break; + + case Prdr::REF_GRP: + l_rc = &i_data.cv_reslFactory.GetEregResolution( + *i_data.cv_groupMap[i_action->cv_value[0].i]); + break; + + case Prdr::ACT_TRY: // TRY + l_rc = &i_data.cv_reslFactory.GetTryResolution( + *(this->createResolution(i_action->cv_value[0].p, + i_data)), + *(this->createResolution(i_action->cv_value[1].p, + i_data)) + ); + break; + + case Prdr::ACT_FUNC: // FUNCCALL + l_rc = &i_data.cv_reslFactory.GetPluginCallResolution( + this, + this->getExtensibleFunction(i_action->cv_actFunc) + ); + break; + + case Prdr::ACT_FLAG: // FLAG + l_rc = &i_data.cv_reslFactory.GetFlagResolution( + (ServiceDataCollector::Flag) i_action->cv_value[0].i); + break; + + case Prdr::ACT_THRES: // Threshold + // The values which different parameter will have + // cv_value[0,1] error frequency and time in sec for field threshold + //cv_value[4] true if mnfg threshols needs to be picked up from mnfg file, false otherwise + // cv_value [2,3]: error frequency and time in sec for mnfg threshold if cv_value[4] is false + // otheiwse cv_value[3] tells which threshold needs to pick up from mnfg file + // cv_value[5] maski id if shared threshold + if (0 == i_action->cv_value[5].i) + { + if ( !PlatServices::mfgMode() ) + { + l_rc = &i_data.cv_reslFactory.GetThresholdSigResolution( + ThresholdResolution::ThresholdPolicy( + (uint16_t)i_action->cv_value[0].i, i_action->cv_value[1].i)); + } + else if(i_action->cv_value[4].i) + { + // FIXME : need to uncomment PrdfMfgThresholdMgr after we figure it out + #ifndef __HOSTBOOT_MODULE + l_rc = &i_data.cv_reslFactory.GetThresholdSigResolution( + *(PrdfMfgThresholdMgr::getInstance()-> + getThresholdP(i_action->cv_value[3].i))); + #endif + } + else + { + l_rc = &i_data.cv_reslFactory.GetThresholdSigResolution( + ThresholdResolution::ThresholdPolicy( + (uint16_t)i_action->cv_value[2].i, i_action->cv_value[3].i)); + } + } + else + if (NULL == i_data.cv_sharedThresholds[i_action->cv_value[5].i]) + { + if ( !PRDF::PlatServices::mfgMode() ) + { + l_rc = &i_data.cv_reslFactory. + GetThresholdResolution(i_action->cv_value[5].i, + ThresholdResolution::ThresholdPolicy((uint16_t)i_action->cv_value[0].i, i_action->cv_value[1].i)); + } + else if(i_action->cv_value[4].i) + { + // FIXME : need to uncomment PrdfMfgThresholdMgr after we figure it out + #ifndef __HOSTBOOT_MODULE + l_rc = &i_data.cv_reslFactory. + GetThresholdResolution(i_action->cv_value[5].i, + *(PrdfMfgThresholdMgr::getInstance()-> + getThresholdP(i_action->cv_value[3].i))); + #endif + } + else + { + l_rc = &i_data.cv_reslFactory. + GetThresholdResolution(i_action->cv_value[5].i, + ThresholdResolution::ThresholdPolicy((uint16_t)i_action->cv_value[2].i, i_action->cv_value[3].i)); + } + i_data.cv_sharedThresholds[i_action->cv_value[5].i] = l_rc; + } + else + { + l_rc = i_data.cv_sharedThresholds[i_action->cv_value[5].i]; + } + break; + + + case Prdr::ACT_DUMP: // DUMP : TODO: Allow dump connected. + #ifdef __HOSTBOOT_MODULE + //FIXME: comment out hwtablecontent for hostboot + l_rc = &i_data.cv_reslFactory.GetDumpResolution( + /*(hwTableContent) i_action->cv_value[0].i,*/ + GetChipHandle()); + #else + l_rc = &i_data.cv_reslFactory.GetDumpResolution( + (hwTableContent) i_action->cv_value[0].i, + GetChipHandle()); + #endif + break; + + case Prdr::ACT_GARD: // GARD + l_rc = &i_data.cv_reslFactory.GetGardResolution( + (GardResolution::ErrorType) i_action->cv_value[0].i); + break; + + case Prdr::ACT_ANALY: // ANALYZE + l_rc = &i_data.cv_reslFactory.GetAnalyzeConnectedResolution( + this->GetChipHandle(), + (TARGETING::TYPE) i_action->cv_value[0].i, + i_action->cv_value[1].i); + break; + + case Prdr::ACT_CALL: // CALLOUT + switch ((char)i_action->cv_value[0].i) + { + case 'c': // connected chip. + l_rc = &i_data.cv_reslFactory.GetConnectedCalloutResolution( + this->GetChipHandle(), + (TARGETING::TYPE) i_action->cv_value[2].i, + i_action->cv_value[3].i, + (CalloutPriorityEnum) i_action->cv_value[1].i, + (NULL == i_action->cv_value[4].p ? NULL : + (this->createResolution( + i_action->cv_value[4].p, i_data))) + + ); + break; + + case 'p': // Procedure. + l_rc = &i_data.cv_reslFactory.GetCalloutResolution( + (SymbolicFru) i_action->cv_value[2].i, + (CalloutPriorityEnum) i_action->cv_value[1].i); + break; + + case 's': // SELF + default: + l_rc = &i_data.cv_reslFactory.GetCalloutResolution( + this->GetChipHandle(), + (CalloutPriorityEnum) i_action->cv_value[1].i); + break; + + }; + break; + + case Prdr::ACT_CAPT: // Capture resolution. + l_rc = &i_data.cv_reslFactory.GetCaptureResolution( + this, + i_action->cv_value[0].i); + break; + }; + + return l_rc; +}; + +void PrdfRuleChip::createGroup(PrdfGroup * i_group, + uint32_t i_groupId, + PrdfRuleChip::RuleFileData & i_data) +{ + // Internal class to collapse the bit string. + class CreateBitString + { + public: + static void execute(std::vector<uint8_t> & i_bits, + Prdr::PrdrExpr * i_expr) + { + if (NULL == i_expr) + return; + if (i_expr->cv_op == Prdr::INT_SHORT) + { + i_bits.push_back(i_expr->cv_value[0].i); + } + else // must be an | or & operator. + { + // Expand bit string from left side. + CreateBitString::execute(i_bits, i_expr->cv_value[0].p); + // Expand bit string from right side. + CreateBitString::execute(i_bits, i_expr->cv_value[1].p); + } + }; + }; + + for (int i = 0; i < i_data.cv_loadChip->cv_groupSize[i_groupId]; i++) + { + std::vector<uint8_t> l_bits; // Vector to hold bit string. + + // TODO : handle & transformations. + + // Get expression for group's line. + Prdr::PrdrExpr * l_expr = &i_data.cv_loadChip->cv_groups[i_groupId][i]; + + // Execute internal (recursive) class to generate bit string. + CreateBitString::execute(l_bits, l_expr->cv_value[1].p); + + // Add expression to group. + i_group->Add(i_data.cv_regMap[l_expr->cv_value[0].i], + &(*l_bits.begin()), + l_bits.size(), + *(this->createResolution(l_expr->cv_value[2].p, i_data)), + i_data.cv_resets[l_expr->cv_value[0].i], + (i_data.cv_regMap[l_expr->cv_value[0].i]->GetId() + + i_data.cv_loadChip->cv_signatureOffset) & 0xffff, + Prdr::AND == l_expr->cv_value[1].p->cv_op + ); + + } // end for. + + // Do flags. --- + + // Do Priority filter flag. + if (i_data.cv_loadChip->cv_groupFlags[i_groupId] & + Prdr::PRDR_GROUP_FILTER_PRIORITY) + { + std::vector<uint8_t> l_bits; + CreateBitString::execute(l_bits, + i_data.cv_loadChip->cv_groupPriorityBits[i_groupId]); + + prdfFilter * l_filter = new PrioritySingleBitFilter(l_bits); + i_group->AddFilter(l_filter); + } + + // Do single bit filter flag. + if (i_data.cv_loadChip->cv_groupFlags[i_groupId] & + Prdr::PRDR_GROUP_FILTER_SINGLE_BIT) + { + prdfFilter * l_filter = new SingleBitFilter(); + i_group->AddFilter(l_filter); + } +} + +PrdfExtensibleChipFunction * + PrdfRuleChip::getExtensibleFunction(const char * i_func, bool i_expectNull) +{ + PrdfExtensibleFunctionType * plugin = + prdfGetPluginGlobalMap().getPlugins(cv_fileName)[i_func]; + if (NULL == plugin) + { + static PrdfPlugin<PrdfExtensibleChip> l_nullPlugin(NULL); + plugin = &l_nullPlugin; + + if (!i_expectNull) + { + errlHndl_t l_errl = NULL; + + PRDF_CREATE_ERRL(l_errl, + ERRL_SEV_UNRECOVERABLE, + ERRL_ETYPE_NOT_APPLICABLE, + SRCI_ERR_INFO, + SRCI_NO_ATTR, + PRDF_PRDFRULECHIP, + LIC_REFCODE, + PRDF_CODE_FAIL, + __LINE__, + 0, 0, 0); + + PRDF_ADD_FFDC(l_errl, + cv_fileName, + strlen(cv_fileName), + prdfErrlVer1, + prdfErrlString); + + PRDF_ADD_FFDC(l_errl, + i_func, + strlen(i_func), + prdfErrlVer1, + prdfErrlString); + + PRDF_COMMIT_ERRL(l_errl, ERRL_ACTION_REPORT); + } + + } + return (PrdfExtensibleChipFunction *) plugin; + +} + +SCAN_COMM_REGISTER_CLASS * PrdfRuleChip::getRegister(const char * i_reg, + bool i_expectNull) +{ + uint16_t hashId = Util::hashString( i_reg ); + + SCAN_COMM_REGISTER_CLASS * l_register = cv_hwRegs[hashId]; + + if (NULL == l_register) + { + static PrdfNullRegister l_nullRegister(1024); + l_register = &l_nullRegister; + + if (!i_expectNull) + { + errlHndl_t l_errl = NULL; + PRDF_CREATE_ERRL(l_errl, + ERRL_SEV_UNRECOVERABLE, + ERRL_ETYPE_NOT_APPLICABLE, + SRCI_ERR_INFO, + SRCI_NO_ATTR, + PRDF_PRDFRULECHIP, + LIC_REFCODE, + PRDF_CODE_FAIL, + __LINE__, + 1, 0, 0); + + PRDF_ADD_FFDC(l_errl, + cv_fileName, + strlen(cv_fileName), + prdfErrlVer1, + prdfErrlString); + + + PRDF_ADD_FFDC(l_errl, + i_reg, + strlen(i_reg), + prdfErrlVer1, + prdfErrlString); + + PRDF_COMMIT_ERRL(l_errl, ERRL_ACTION_REPORT); + } + + } + return l_register; +} diff --git a/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.H b/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.H new file mode 100755 index 000000000..054a05971 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.H @@ -0,0 +1,193 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdfRuleChip.H $ */ +/* */ +/* 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 */ + +#ifndef __PRDFRULECHIP_H +#define __PRDFRULECHIP_H + +#include <iipchip.h> +#include <prdfErrlSmartPtr.H> + +#include <iipsdbug.h> // for ATTENTION_TYPE +#include <prdfExtensibleChip.H> +#include <prdfPluginDef.H> + +#include <string.h> +#include <vector> +#include <map> +#include <iipResetErrorRegister.h> +#include "prdrCommon.H" //@jl02 Added this to get the constant value from the enum. +#include <iipCaptureData.h> // @jl04 Added this for the RegType used for register = "PRIMARY" or "SECONDARY" +//--------------------------------------- +// Forward decls. +class SCAN_COMM_REGISTER_CLASS; +class ScanFacility; +class ResolutionFactory; +class STEP_CODE_DATA_STRUCT; +class CaptureData; +class ErrorRegisterType; +class Resolution; +namespace Prdr +{ + class PrdrChip; + class PrdrExpr; +}; +class PrdfGroup; +typedef std::pair<ResetAndMaskErrorRegister::ResetRegisterVector, + ResetAndMaskErrorRegister::ResetRegisterVector> + PrdfResetAndMaskPair; + +// x86 compile wants this here - not forward declaired dgilbert +class PrdfCaptureRequirement +{ + public: + PrdfCaptureRequirement() : + cv_TargetType(TARGETING::TYPE_NA), cv_TargetIndex(0), cv_func(NULL) { }; + + uint32_t cv_TargetType; + uint32_t cv_TargetIndex; + PrdfExtensibleChipFunction * cv_func; + + inline bool operator!=(const PrdfCaptureRequirement & r) + { + return ( (cv_TargetType != r.cv_TargetType) || + (cv_TargetIndex != r.cv_TargetIndex) || + (cv_func != r.cv_func) ); + }; +}; + +//-------------------------------------- +// @jl04 a Start. +// Adding capture requirement type for transporting data. +class PrdfCaptureType +{ + public: + RegType cv_regType; + // if (reg == 1) reg = PRIMARY; + // if (reg == 2) reg = SECONDARY; + PrdfCaptureType(RegType reg = PRIMARY):cv_regType(reg){}; +}; +// @jl04 a Stop. +//-------------------------------------- + + +class PrdfRuleChip : public PrdfExtensibleChip +{ + public: + + typedef std::map<uint32_t, SCAN_COMM_REGISTER_CLASS *> RegMap_t; + typedef std::map<uint32_t, ErrorRegisterType *> GroupMap_t; + typedef std::map<uint32_t, Resolution *> ActionMap_t; + typedef std::map<uint32_t, PrdfResetAndMaskPair> Reset_t; + typedef std::map<uint32_t, Resolution *> SharedThreshold_t; + + struct RuleFileData + { + RegMap_t & cv_regMap; + GroupMap_t & cv_groupMap; + ActionMap_t & cv_actionMap; + + ScanFacility & cv_scanFactory; + ResolutionFactory & cv_reslFactory; + + TARGETING::TargetHandle_t cv_chipHandle; + Prdr::PrdrChip *& cv_loadChip; // pw01 + + Reset_t & cv_resets; + PrdfResetAndMaskPair & cv_currentResets; + + SharedThreshold_t & cv_sharedThresholds; + + }; + + public: + // TODO : add parameter for parent domains, connected chip classes. + PrdfRuleChip(const char * i_fileName, + TARGETING::TargetHandle_t i_pTargetHandle, + ScanFacility & i_scanFactory, + ResolutionFactory & i_reslFactory + ) + : PrdfExtensibleChip(i_pTargetHandle), + cv_fileName(i_fileName), + cv_dumpType(0), //@ecdf + cv_dataBundle(NULL) + { + this->loadRuleFile(i_scanFactory, i_reslFactory); + }; + + ~PrdfRuleChip(); + + int32_t Analyze(STEP_CODE_DATA_STRUCT &, ATTENTION_TYPE); + int32_t CaptureErrorData(CaptureData &, int i_group = 1); + int32_t MaskError(uint32_t i) { return SUCCESS; }; + + PrdfExtensibleChipFunction * + getExtensibleFunction(const char *, bool = false); + SCAN_COMM_REGISTER_CLASS * getRegister(const char *, bool = false); + PrdfDataBundle *& getDataBundle() { return cv_dataBundle; }; + + uint32_t getSignatureOffset() const { return iv_sigOff; }; + + private: + const char * cv_fileName; + PrdfErrlSmartPtr cv_errl; + + uint32_t cv_dumpType; //@ecdf + + uint32_t iv_sigOff; + + std::map<uint16_t, SCAN_COMM_REGISTER_CLASS *> cv_hwRegs; + + typedef std::map<uint32_t, std::vector<SCAN_COMM_REGISTER_CLASS *> > HwCaptureGroup_t; + HwCaptureGroup_t cv_hwCaptureGroups; + + typedef std::map<SCAN_COMM_REGISTER_CLASS *, PrdfCaptureRequirement> HwCaptureReq_t; + HwCaptureReq_t cv_hwCaptureReq; + + //Adding another std::map for passing some data to capture stuff. + typedef std::map<SCAN_COMM_REGISTER_CLASS *, PrdfCaptureType> HwCaptureType_t; + HwCaptureType_t cv_hwCaptureType; + + PrdfDataBundle * cv_dataBundle; + ErrorRegisterType * cv_groupAttn[NUM_GROUP_ATTN]; // @jl02 JL Changed from 3 to 4 with this const type. + + void loadRuleFile(ScanFacility &, + ResolutionFactory &); + + SCAN_COMM_REGISTER_CLASS * + createVirtualRegister(Prdr::PrdrExpr *, + RuleFileData &); + + Resolution * + createActionClass(uint32_t, + RuleFileData &); + + Resolution * + createResolution(Prdr::PrdrExpr *, + RuleFileData &); + + void createGroup(PrdfGroup *, + uint32_t, + RuleFileData &); +}; + +#endif diff --git a/src/usr/diag/prdf/common/framework/rule/prdfRuleFiles.C b/src/usr/diag/prdf/common/framework/rule/prdfRuleFiles.C new file mode 100755 index 000000000..23e90e98d --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdfRuleFiles.C @@ -0,0 +1,45 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdfRuleFiles.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2008,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 __PRDFRULEFILES_H +#define __PRDFRULEFILES_H + +/** + * @file prdfRuleFiles.C + * @brief Contains the name of each chip's associated file. + */ + +namespace PRDF +{ + // Pegasus P8 Chip + const char * Proc = "Proc"; + const char * Ex = "Ex"; + const char * Mcs = "Mcs"; + + // Pegasus Centaur Chip + const char * Membuf = "Membuf"; + const char * Mba = "Mba"; + +}; + +#endif diff --git a/src/usr/diag/prdf/common/framework/rule/prdfRuleFiles.H b/src/usr/diag/prdf/common/framework/rule/prdfRuleFiles.H new file mode 100755 index 000000000..9f9777445 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdfRuleFiles.H @@ -0,0 +1,47 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdfRuleFiles.H $ */ +/* */ +/* 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 */ + +#ifndef __PRDFRULEFILES_H +#define __PRDFRULEFILES_H + +/** + * @file prdfRuleFiles.H + * @brief Contains the name of each chip's associated .prf file. + */ + +namespace PRDF +{ + + // Pegasus P8 Chip + extern const char * Proc; + extern const char * Ex; + extern const char * Mcs; + + // Pegasus Centaur Chip + extern const char * Membuf; + extern const char * Mba; + +}; + +#endif + diff --git a/src/usr/diag/prdf/common/framework/rule/prdrChip.H b/src/usr/diag/prdf/common/framework/rule/prdrChip.H new file mode 100755 index 000000000..51d90b23e --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdrChip.H @@ -0,0 +1,189 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdrChip.H $ */ +/* */ +/* 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 */ + +#ifndef __PRDRCHIP_H +#define __PRDRCHIP_H + +#include <string> +#include <stdint.h> + +#include <netinet/in.h> + +#include <prdrRegister.H> + +class PrdrExtraSignature +{ + public: + uint32_t iv_sig; + std::string * iv_sname; + std::string * iv_desc; + + PrdrExtraSignature(uint32_t i_sig, + std::string * i_sname, + std::string * i_desc) : iv_sig(i_sig), + iv_sname(i_sname), + iv_desc(i_desc) {}; + + PrdrExtraSignature & operator=(const PrdrExtraSignature & l_rhs) + { + this->iv_sig = l_rhs.iv_sig; + this->iv_sname = l_rhs.iv_sname; + this->iv_desc = l_rhs.iv_desc; + + return *this; + }; +}; + +class PrdrChip +{ + public: + std::string * cv_sname; + std::string * cv_name; + uint32_t cv_chipid; + uint32_t cv_targetType; + uint32_t cv_signatureOffset; + uint32_t cv_dumptype; //@ecdf + PrdrRegisterList cv_reglist; + std::list<PrdrExtraSignature> cv_sigExtras; + + uint16_t cv_scomlen; // Default Scom Address. + + std::string cv_name_default; + + PrdrChip() : cv_sname(NULL), + cv_name(&cv_name_default), + cv_chipid(0), + cv_targetType(0), + cv_signatureOffset(0), + cv_dumptype(0), //@ecdf + cv_reglist(), + cv_sigExtras(), + cv_scomlen(0) {}; + + static void merge(PrdrChip * i_l, PrdrChip * i_r) + { + if (NULL != i_r->cv_sname) + i_l->cv_sname = i_r->cv_sname; + if (&i_r->cv_name_default != i_r->cv_name) + i_l->cv_name = i_r->cv_name; + if (0 != i_r->cv_chipid) + i_l->cv_chipid = i_r->cv_chipid; + if (0 != i_r->cv_scomlen) + i_l->cv_scomlen = i_r->cv_scomlen; + if (0 != i_r->cv_targetType) + i_l->cv_targetType = i_r->cv_targetType; + if (0 != i_r->cv_signatureOffset) + i_l->cv_signatureOffset = i_r->cv_signatureOffset; + if (0 != i_r->cv_dumptype) //@ecdf + i_l->cv_dumptype = i_r->cv_dumptype; + + i_l->cv_reglist.insert(i_l->cv_reglist.end(), + i_r->cv_reglist.begin(), + i_r->cv_reglist.end()); + + i_l->cv_sigExtras.insert(i_l->cv_sigExtras.end(), + i_r->cv_sigExtras.begin(), + i_r->cv_sigExtras.end()); + }; + + void print() + { + using namespace std; + cout << "Chip " << *cv_sname << ":" << endl; + cout << "\tLong Name: " << *cv_name << endl; + cout << "\tChip ID: " << cv_chipid << endl; + cout << "\tTarget Type: " << cv_targetType << endl; + cout << "\tSignature Offset: " << cv_signatureOffset << endl; + cout << "\tDefault Dumptype: " << cv_dumptype << endl; //@ecdf + cout << "\tDefault ScomLen: " << cv_scomlen << endl; + cout << "\tRegisters: (" << cv_reglist.size() << ")" << endl; + for (PrdrRegisterList::iterator i = cv_reglist.begin(); + i != cv_reglist.end(); + i++) + { + (*i)->print(); + } + }; + + + int output(FILE * l_file) + { + uint32_t l_temp; + uint16_t l_temp16; + + fwrite("PRDRCHIP", 8, 1, l_file); + + l_temp = htonl(cv_chipid); + fwrite(&l_temp, sizeof(l_temp), 1, l_file); + + l_temp = htonl(cv_targetType); + fwrite(&l_temp, sizeof(l_temp), 1, l_file); + + l_temp = htonl(cv_signatureOffset); + fwrite(&l_temp, sizeof(l_temp), 1, l_file); + + // Write dumptype to file. //@ecdf + l_temp = htonl(cv_dumptype); + fwrite(&l_temp, sizeof(l_temp), 1, l_file); + + l_temp16 = htons(cv_scomlen); + fwrite(&l_temp16, sizeof(l_temp16), 1, l_file); + + l_temp16 = htons(cv_reglist.size()); + fwrite(&l_temp16, sizeof(l_temp16), 1, l_file); + + for (PrdrRegisterList::iterator i = cv_reglist.begin(); + i != cv_reglist.end(); + i++) + { + (*i)->output(l_file, cv_signatureOffset); + } + + return 0; + } + + void outputRegisterFile(std::ostream & o_file) + { + o_file << "( 0x" << std::hex << cv_targetType << ", 0x" << std::hex + << cv_signatureOffset << " )" << std::endl; + + for (PrdrRegisterList::iterator i = cv_reglist.begin(); + i != cv_reglist.end(); + i++) + { + (*i)->outputRegisterFile(o_file, cv_signatureOffset); + } + + }; +}; + +#endif + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// F494911 f310 03/04/05 iawillia Initial File Creation +// ecdf F550548 f300 05/04/06 iawillia eClipz DUMP flags support. +// D586213 f310 02/19/07 iawillia Add extra signature support. +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/rule/prdrCommon.H b/src/usr/diag/prdf/common/framework/rule/prdrCommon.H new file mode 100755 index 000000000..47502a1be --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdrCommon.H @@ -0,0 +1,178 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdrCommon.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2005,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 __PRDRCOMMON_H +#define __PRDRCOMMON_H + +/** + * @file prdrCommon.H + * @brief Common enums, typedefs, etc. between compiler and loader for rule + * table code. + */ + +#include <map> +#include <stdint.h> + +#ifdef __PRD_RULE_COMPILE + #include <string> +#endif + +// @jl02 JL adding a constant for the number of attention types. +enum PrdrNumberOfAttentions +{ + NUM_GROUP_ATTN = 4, +}; + + +/** + * @namespace Prdr + * @brief Namespace to encapsulate Prdr specific enums, classes, and typedefs. + */ +namespace Prdr +{ + /** + * @enum PrdrRegisterFlags + * @brief Flags for which register attributes are contained in a register + * definition. + * + * When loading the .prf file, each register entry will contain a set of + * these flags that describe what attributes are non-default (and therefore + * contained in the file). + */ + enum PrdrRegisterFlags + { + /** Non-default scomlen */ + PRDR_REGISTER_SCOMLEN = 0x1, + /** Resets defined */ + PRDR_REGISTER_RESETS = 0x2, + /** Masks defined */ + PRDR_REGISTER_MASKS = 0x4, + /** Capture requirements */ + PRDR_REGISTER_CAPTURE = 0x8, + }; + + /** + * @enum PrdrGroupFlags + * @brief Flags for which group attributes are contained in a group + * definition. + * + * When loading the .prf file, each group entry will contain a set of + * these flags that describe what attributes are non-default (and therefore + * contained in the file). + */ + enum PrdrGroupFlags + { + /** Single Bit Filter */ + PRDR_GROUP_FILTER_SINGLE_BIT = 0x1, + /** Priority Bit Filter */ + PRDR_GROUP_FILTER_PRIORITY = 0x2, + }; + + /** + * @enum PrdrTimeBaseFlags + * @brief Enums for time base + * + * When reading rule file, these flags can be used to write in prf files + * for time base values. + */ + enum PrdrTimeBaseFlags + { + PRDR_TIME_BASE_SEC = 1, + PRDR_TIME_BASE_MIN = PRDR_TIME_BASE_SEC * 60, + PRDR_TIME_BASE_HOUR = PRDR_TIME_BASE_MIN * 60, + PRDR_TIME_BASE_DAY = PRDR_TIME_BASE_HOUR * 24, + }; + + /** + * @enum PrdrExprOps + * @brief Single char op's defined for .prf files. + * + * Needed for properly reading/writing .prf files. + */ + enum PrdrExprOps + { + REF_RULE = 'r', + REF_REG = 'e', + REF_GRP = 'g', + REF_ACT = 'a', + INTEGER = 'I', + INT_SHORT = 'i', + BIT_STR = 'B', + NOT = '~', + AND = '&', + OR = '|', + XOR = '^', + LSHIFT = 174, // ASCII left-shift + RSHIFT = 175, // ASCII right-shift + RULE = 'R', + GROUP = 'G', + ACTION = 'A', + + ATTNLINK = 'L', + + ACT_THRES = 't', + ACT_ANALY = 'y', + ACT_TRY = '{', + ACT_DUMP = 'd', + ACT_GARD = '-', + ACT_CALL = 'c', + ACT_FUNC = 'f', + ACT_FLAG = 'F', + ACT_CAPT = 'C', + }; + + class PrdrSignatureOp + { + public: + enum { DEFAULT_SIGNATURE = 0x0 }; + + static uint16_t combineSig( uint16_t a, uint16_t b ) + { + // The two signature will be XOR'd together and there is a + // possibility that the signature could be the same, which would + // result in 0. So, rotate the first signature to essentially + // scramble it. This should be able to create a unique signature. + a = ((a & 0xff80) >> 7) | ((a & 0x007f) << 9); // rotate left 9 bits + return ( (a ^ b) & 0xffff ); + }; + }; + + #ifdef __PRD_RULE_COMPILE + typedef std::map<uint16_t, std::string> HashCollisionMap; + #endif +}; + +#endif + + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// D515833 f300 09/19/05 iawillia Add capture support. +// F526728 f300 10/25/05 iawillia Add >> and << operators to rules. +// F534311 f300 01/10/06 iawillia Add Bit string. +// F557408 f310 06/16/06 iawillia Add single-bit filter support. +// jl02 F605874 f330 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/rule/prdrCompile.C b/src/usr/diag/prdf/common/framework/rule/prdrCompile.C new file mode 100755 index 000000000..b379e3f95 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdrCompile.C @@ -0,0 +1,548 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdrCompile.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 */ + +#include <map> +#include <list> +#include <vector> +#include <stack> +#include <fstream> + +// It is important to limit what is included here. We don't want to include +// files that include external components such as the errl or targeting code. +// Otherwise, we will pull in way too much code just to compile this on file. + +#ifdef CONTEXT_x86_nfp + +// TODO: Need support for attributeenums.H in x86.nfp. For now stub out the TYPE +// enum values. + +namespace TARGETING +{ + enum TYPE + { + TYPE_NA = 0x00000000, + TYPE_DIMM = 0x00000003, + TYPE_MEMBUF = 0x00000006, + TYPE_PROC = 0x00000007, + TYPE_EX = 0x0000000A, + TYPE_MCS = 0x0000000F, + TYPE_MBA = 0x00000011, + }; +} + +#else + +#include <attributeenums.H> // For TARGETING::TYPE enum + +#endif + +// define needed to enable x86 rule parser code only +#define __PRD_RULE_COMPILE +#include <prdrCommon.H> +#include <prdrToken.H> +#include <UtilHash.H> + +int yyline; +std::stack<std::pair<std::string, int> > yyincfiles; + +PrdrChip * g_currentChip; // the current chip +std::map<std::string, PrdrExpr *> g_rules; // list of rules. +std::map<std::string, PrdrGroup *> g_groups; // list of bit groups +std::map<std::string, PrdrGroup *> g_actionclasses; // list of actions +std::map<std::string, std::string> g_attentionStartGroup; + +// Internal list of references, to make sure every reference resolved. +std::list<std::pair<std::string, std::string> > g_references; + +Prdr::HashCollisionMap g_groupHashCollision; +Prdr::HashCollisionMap g_regsHashCollision; + +// Used in error reference outputting. +uint32_t g_nextAndBit; +bool g_hadError; + +//-------------------------------------------- +// main +//-------------------------------------------- +int main(int argc, char ** argv) +{ + if (argc != 2) + { + std::cerr << "No destination file given." << std::endl; + exit(-1); + } + + FILE * l_prfFile = fopen(argv[1], "w+"); + if (NULL == l_prfFile) + { + std::cerr << "Error opening file for output." << std::endl; + exit(-1); + } + +#ifndef __HOSTBOOT_MODULE + + std::ofstream l_htmlFile((std::string(argv[1]) + ".html").c_str()); + std::ofstream l_errFile((std::string(argv[1]) + ".err.C").c_str()); + std::ofstream l_regFile((std::string(argv[1]) + ".reg.C").c_str()); + + // Get Backing build or sandbox name. + std::string l_backingBuild(getenv("SANDBOXBASE")); + l_backingBuild = l_backingBuild.substr(l_backingBuild.find_last_of('/')+1); + + // setup HTML headers. + l_htmlFile << "<HTML><HEAD><STYLE type=\"text/css\">" << std::endl; + l_htmlFile << "TABLE { border-collapse: collapse; border: solid; " + << "border-width: 3px; " + << "margin-left: auto; margin-right: auto; width: 100% }" + << std::endl; + l_htmlFile << "TH { border: solid; border-width: thin; padding: 3px }" + << std::endl; + l_htmlFile << "TD { border: solid; border-width: thin; padding: 3px }" + << std::endl; + l_htmlFile << "</STYLE>" << std::endl; + + // setup error signature file. + l_errFile << "#include <prdrErrlPluginSupt.H>" << std::endl; + l_errFile << "PRDR_ERROR_SIGNATURE_TABLE_START "; + + // setup register id file. + l_regFile << "#include <prdrErrlPluginSupt.H>" << std::endl; + l_regFile << "PRDR_REGISTER_ID_TABLE_START "; + +#endif + + yyline = 1; // current line is 1. + g_currentChip = NULL; // initialize current chip. + + uint16_t l_size; + + // parse standard input. + yyparse(); + + // verify references. + prdrCheckReferences(); + + // output chip. + if (NULL != g_currentChip) + { + g_currentChip->output(l_prfFile); +#ifndef __HOSTBOOT_MODULE + g_currentChip->outputRegisterFile(l_regFile); +#endif + //g_currentChip->print(); + } + else + { + yyerror("No chip define!"); + exit(1); + } + +#ifndef __HOSTBOOT_MODULE + + l_htmlFile << "<TITLE> PRD Table: " + << g_currentChip->cv_name->substr(1, + g_currentChip->cv_name->length()-2) + << "</TITLE>" + << std::endl; + l_htmlFile << "</HEAD><BODY>" << std::endl; + +#endif + + // output rules. + l_size = htons((uint16_t)g_rules.size()); + fwrite(&l_size, sizeof(l_size), 1, l_prfFile); + for (std::map<std::string, PrdrExpr *>::iterator i = g_rules.begin(); + i != g_rules.end(); + i++) + { + (*i).second->output(l_prfFile); + }; + +#ifndef __HOSTBOOT_MODULE + // set error register HOM_TYPE + l_errFile << "( 0x" << std::hex << g_currentChip->cv_targetType << ", 0x" + << std::hex << g_currentChip->cv_signatureOffset + << " )" << std::endl; +#endif + + // output bit groups + uint32_t l_pos = 0; + l_size = htons((uint16_t)g_groups.size()); + fwrite(&l_size, sizeof(l_size), 1, l_prfFile); + l_size = htons((uint16_t)prdrGetRefId(&g_attentionStartGroup["CHECK_STOP"])); + fwrite(&l_size, sizeof(l_size), 1, l_prfFile); + l_size = htons((uint16_t)prdrGetRefId(&g_attentionStartGroup["RECOVERABLE"])); + fwrite(&l_size, sizeof(l_size), 1, l_prfFile); + l_size = htons((uint16_t)prdrGetRefId(&g_attentionStartGroup["SPECIAL"])); + fwrite(&l_size, sizeof(l_size), 1, l_prfFile); + //@jl02 JL Adding this code to account for the new Attention entry type. + l_size = htons((uint16_t)prdrGetRefId(&g_attentionStartGroup["UNIT_CS"])); // @jl02 + fwrite(&l_size, sizeof(l_size), 1, l_prfFile); // @jl02 + +#ifndef __HOSTBOOT_MODULE + + l_htmlFile << "<H2> Register Groups </H2>" << std::endl; + l_htmlFile << "Generated from " << l_backingBuild << "<BR>" << std::endl; + +#endif + + for (std::map<std::string, PrdrGroup *>::iterator i = g_groups.begin(); + i != g_groups.end(); + i++, l_pos++) + { + (*i).second->output(l_prfFile); +#ifndef __HOSTBOOT_MODULE + (*i).second->generateDoxygen(l_htmlFile, (*i).first, l_errFile); +#endif + }; + + // output action classes. + l_size = htons((uint16_t)g_actionclasses.size()); + fwrite(&l_size, sizeof(l_size), 1, l_prfFile); + +#ifndef __HOSTBOOT_MODULE + + l_htmlFile << "<H2> Actions </H2>" << std::endl; + l_htmlFile << "Generated from " << l_backingBuild << "<BR>" << std::endl; + l_htmlFile << "<TABLE>" << std::endl; + l_htmlFile << "<TR><TH> Action Class </TH> " + << "<TH> Description </TH> " + << "<TH> Actions </TH></TR>" << std::endl; + +#endif + + for (std::map<std::string, PrdrGroup *>::iterator i = + g_actionclasses.begin(); + i != g_actionclasses.end(); + i++) + { + (*i).second->output(l_prfFile); +#ifndef __HOSTBOOT_MODULE + (*i).second->generateDoxygen(l_htmlFile, (*i).first); +#endif + }; + +#ifndef __HOSTBOOT_MODULE + l_htmlFile << "</TABLE>" << std::endl; +#endif + + fclose(l_prfFile); + +#ifndef __HOSTBOOT_MODULE + l_htmlFile << "</HTML>"; + l_htmlFile.close(); +#endif + +#ifndef __HOSTBOOT_MODULE + // Add chip's extra signatures. + l_errFile << "//---- Extra Signatures ----" << std::endl; + for (std::list<PrdrExtraSignature>::iterator i + = g_currentChip->cv_sigExtras.begin(); + i != g_currentChip->cv_sigExtras.end(); + i++) + { + l_errFile << "\tPRDR_ERROR_SIGNATURE ( 0x" + << std::setfill('0') << std::setw(8) << std::hex + << i->iv_sig << ", " << *(i->iv_sname) << ", " + << *(i->iv_desc) << ")" << std::endl; + } + + + + l_errFile << "PRDR_ERROR_SIGNATURE_TABLE_END" << std::endl; + l_errFile.close(); + + l_regFile << "PRDR_REGISTER_ID_TABLE_END" << std::endl; + l_regFile.close(); +#endif + + return (g_hadError ? -1 : 0); +}; + +std::map<std::string, uint32_t> g_refId; +std::map<std::string, char> g_refType; + +uint16_t prdrGetRefId(std::string * i_name) +{ + if (NULL == i_name) + { + yyerror("ICE - NPE."); + return 0; + } + + uint32_t l_refId = g_refId[*i_name]; + + //fprintf(stderr, "%s: %08x\n", i_name->c_str(), l_refId); + return l_refId; +}; +char prdrGetRefType(std::string * i_name) +{ + if (NULL == i_name) + { + yyerror("ICE - NPE."); + return 0; + } + + char l_refType = g_refType[*i_name]; + + return l_refType; +}; + +void prdrCheckReferences() +{ + do + { + uint32_t l_refId = 1; + + if (NULL == g_currentChip) + break; + + for (PrdrRegisterList::iterator i = g_currentChip->cv_reglist.begin(); + i != g_currentChip->cv_reglist.end(); + i++) + { + g_refId[*(*i)->cv_sname] = l_refId++; + g_refType[*(*i)->cv_sname] = Prdr::REF_REG; + } + + for (std::map<std::string, PrdrExpr *>::iterator i = g_rules.begin(); + i != g_rules.end(); + i++) + { + g_refId[(*i).first] = l_refId++; + g_refType[(*i).first] = Prdr::REF_RULE; + } + + for (std::map<std::string, PrdrGroup *>::iterator i = g_groups.begin(); + i != g_groups.end(); + i++) + { + g_refId[(*i).first] = l_refId++; + g_refType[(*i).first] = Prdr::REF_GRP; + } + + for (std::map<std::string, PrdrGroup *>::iterator i = + g_actionclasses.begin(); + i != g_actionclasses.end(); + i++) + { + g_refId[(*i).first] = l_refId++; + g_refType[(*i).first] = Prdr::REF_ACT; + } + + for (std::list<std::pair<std::string, std::string> >::iterator i = + g_references.begin(); + i != g_references.end(); + i++) + { + if (std::string::npos == (*i).first.find(g_refType[(*i).second])) + { + if (char() == g_refType[(*i).second]) + { + std::string l_tmp = "Undefined reference for "; + l_tmp += (*i).second; + yyerror(l_tmp.c_str()); + } + else + { + std::string l_tmp = "Bad reference type: expected "; + l_tmp += (*i).first + " but found "; + l_tmp += g_refType[(*i).second]; + l_tmp += " for " + (*i).second; + yyerror(l_tmp.c_str()); + } + } + } + + } while (false); + return; +}; + +std::list<std::string> prdrParseDoxygen(std::string & i_string) +{ + std::list<std::string> l_result; + + std::string l_input = i_string; + std::string l_tmp; + + for (int i = 0; i < 2; i++) // grab title and short desc. + { + std::string::size_type l_pos = l_input.find('\n'); + l_result.push_back(l_input.substr(0, l_pos)); + l_input.erase(0,l_pos+1); + } + l_result.push_back(l_input); // push long desc. + + // TODO : take care of the @tags. + + return l_result; +}; + +uint32_t prdrCaptureGroupMap( const std::string & i_arg ) +{ + if ( 0 == i_arg.compare("never") ) + { + return 0; + } + else if ( 0 == i_arg.compare("default") ) + { + return 1; + } + else + { + uint16_t hash = Util::hashString( i_arg.c_str() ); + Prdr::HashCollisionMap::iterator i = g_groupHashCollision.find(hash); + if ( g_groupHashCollision.end() != i ) + { + if ( 0 != i_arg.compare(i->second) ) + { + g_hadError = true; // Compile error + + std::cerr << "Capture Group hash collision '" << i_arg << "' " + << std::hex << "[0x" + << std::setfill('0') << std::setw(4) + << hash << "]" + << ": previous group was '" << i->second << "'" + << std::endl; + } + } + g_groupHashCollision[hash] = i_arg; + + return hash; + } +} + +uint32_t prdrCaptureTypeMap(const std::string & i_arg) +{ + if ("primary" == i_arg) + return 1; + if ("secondary" == i_arg) + return 2; + return 1; +} + +#include <prdfCalloutMap.H> // for enums +#undef __prdfCalloutMap_H +#define PRDF_RULE_COMPILER_ENUMS +#include <prdfCalloutMap.H> // for string-to-enum arrays +#undef PRDF_RULE_COMPILER_ENUMS + +std::map<std::string, uint32_t> g_ActionArgMap; +uint32_t prdrActionArgMap(const std::string & i_arg) +{ + using namespace PRDF; + + static bool l_initialized = false; + + do + { + if (l_initialized) + break; + + // Initialize Callout priorities. + for (CalloutPriority_t * i = calloutPriorityArray; NULL != i->str; i++) + { + g_ActionArgMap[i->str] = i->val; + } + + // Initialize target types. + g_ActionArgMap["TYPE_PROC"] = TARGETING::TYPE_PROC; + g_ActionArgMap["TYPE_EX"] = TARGETING::TYPE_EX; + g_ActionArgMap["TYPE_MCS"] = TARGETING::TYPE_MCS; + g_ActionArgMap["TYPE_MEMBUF"] = TARGETING::TYPE_MEMBUF; + g_ActionArgMap["TYPE_MBA"] = TARGETING::TYPE_MBA; + + // Initialize symbolic callouts. + for ( SymCallout_t * i = symCalloutArray; NULL != i->str; i++ ) + { + g_ActionArgMap[i->str] = i->val; + } + +#if 0 + // Initialize SDC Flags. + // FIXME: Not quite happy with the way this is implemented. Would like + // to move the macros to another file like we did with + // prdfCalloutMap.H, but will need to do this later. + #define PRDF_SDC_FLAGS_MAP_ONLY + #define PRDF_SDC_FLAGS_MAP + #define PRDF_SDC_FLAG(name, value) \ + g_ActionArgMap[#name] = value; + #define PRDF_SDC_FLAGS_MAP_END + #undef iipServiceDataCollector_h + #include <iipServiceDataCollector.h> +#endif + + // Initialize Gard values. + // TODO: Map these from xspprdGardResolution.h + g_ActionArgMap["NoGard"] = 0; + g_ActionArgMap["Predictive"] = 1; + g_ActionArgMap["Uncorrectable"] = 2; + g_ActionArgMap["Fatal"] = 3; + g_ActionArgMap["Pending"] = 4; + g_ActionArgMap["CheckStopOnlyGard"] = 5; + g_ActionArgMap["DeconfigNoGard"] = 6; //mp01 + +#ifdef __HOSTBOOT_MODULE + // FIXME: Hostboot currently does not support dump contents. This is a + // temporary fix. + g_ActionArgMap["DUMP_CONTENT_HW"] = 0; + g_ActionArgMap["DUMP_CONTENT_SH"] = 1; + g_ActionArgMap["DUMP_CONTENT_HWSUPERNOVA"] = 2; +#else + // Initialize Dump values. //@ecdf + #include <hdctContent.H> + #undef __hdctContent_H__ + #undef HDCT_CONTENT_T + #undef HDCT_CONTENT_V + #undef HDCT_CONTENT_T_END + #define HDCT_CONTENT_T + #define HDCT_CONTENT_V(name, value) \ + g_ActionArgMap["DUMP_" #name] = value; + #define HDCT_CONTENT_T_END + #undef HDCT_COMMAND_T + #undef HDCT_COMMAND_V + #undef HDCT_COMMAND_T_END + #define HDCT_COMMAND_T + #define HDCT_COMMAND_V(name, value) + #define HDCT_COMMAND_T_END + #include <hdctContent.H> + + // Initialize MFG thresholds. + #define PRDF_MFGTHRESHOLD_TABLE_BEGIN + #define PRDF_MFGTHRESHOLD_TABLE_END + #define PRDF_MFGTHRESHOLD_ENTRY(a,b,c) \ + g_ActionArgMap[#a] = b; + #include <prdfMfgThresholds.H> +#endif + + l_initialized = true; + + } while (false); + + if (g_ActionArgMap.end() == g_ActionArgMap.find(i_arg)) //@pw01 + { + yyerror((std::string("Undefined argument: ")+i_arg).c_str()); + } + + return g_ActionArgMap[i_arg]; +} diff --git a/src/usr/diag/prdf/common/framework/rule/prdrCompile.lex b/src/usr/diag/prdf/common/framework/rule/prdrCompile.lex new file mode 100755 index 000000000..dccb64828 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdrCompile.lex @@ -0,0 +1,213 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdrCompile.lex $ */ +/* */ +/* 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 */ + +/* Pre C stuff: headers, etc. */ +%{ + +/** @file prdrCompile.lex + * + * This file contains all of the flex code for parsing rule-table tokens. + */ + +#include <stdlib.h> + +#include <prdrToken.H> // Token structure definition. +#include <prdrCompile.y.H> // Token enums from yacc code. + +#define YY_NO_UNPUT // No "Unput" function defined. +%} + +/* --- Basic type definitions --- */ + +/* Digits */ +digit [0-9] +hexdigit [0-9a-fA-F] + +/* Numerical constants */ +integer {digit}+ +hexint 0[xX]{hexdigit}+ + /* Bit-string is a hex string between two back-ticks */ +bitstring `{hexdigit}+` + +/* White space */ +whitespace [ \t]* +newline \n + +/* # starts a comment line */ +comment #.*{newline} + +/* IDs are any letter or underscore followed by any number of letters/numbers */ +id [A-Za-z_][A-Za-z0-9_]* + +/* --- end Basic type definitions --- */ + +/* Define special parse contexts for comments and .include headers */ +%x DOX_COMMENT +%x INCLUDED + +/* --- Begin Token Definitions --- */ +%% + + /* Parse numerical constants to "INTEGER" type. */ +{integer} { sscanf(yytext, "%llu", &yylval.long_integer); return PRDR_INTEGER; } +{hexint} { sscanf(yytext, "%llx", &yylval.long_integer); return PRDR_INTEGER; } + + /* Parse a bitstring to "BIT_STRING" type. */ +{bitstring} { + yylval.str_ptr = new std::string(yytext); + return PRDR_BIT_STRING; + } + /* Parse a string to a "STRING" type. Any number of characters between two + * quotes. + */ +\"[^"]*\" { + yylval.str_ptr = new std::string(yytext); + return PRDR_STRING; + } + /* Special end-of-file character. */ +<<EOF>> { return 0; } + + /* Various keyword tokens converted directly to the enum type. */ +chipid { return PRDR_CHIPID; } +sigoff { return PRDR_SIGNATURE_OFFSET; } +PRDR_ERROR_SIGNATURE { return PRDR_SIGNATURE_EXTRA; } +targettype { return PRDR_TARGETTYPE; } +register { return PRDR_REGISTER; } +name { return PRDR_NAME_KW; } +scomaddr { return PRDR_SCOMADDR; } +scomlen { return PRDR_SCOMLEN; } +bit { return PRDR_BIT_KW; } +reset { return PRDR_RESET_ADDR; } +mask { return PRDR_MASK_ADDR; } + +chip { return PRDR_CHIP; } +group { return PRDR_GROUP; } +type { return PRDR_TYPE; } /* @jl04 a Add this for primary/secondary type.*/ +actionclass { return PRDR_ACTIONCLASS; } +rule { return PRDR_RULE; } + +threshold { return PRDR_ACT_THRESHOLD; } +analyse { return PRDR_ACT_ANALYSE; } +analyze { return PRDR_ACT_ANALYSE; } +try { return PRDR_ACT_TRY; } +dump { return PRDR_ACT_DUMP; } +funccall { return PRDR_ACT_FUNCCALL; } +gard { return PRDR_ACT_GARD; } +callout { return PRDR_ACT_CALLOUT; } +flag { return PRDR_ACT_FLAG; } +capture { return PRDR_ACT_CAPTURE; } + +connected { return PRDR_CONNECTED; } +alternate { return PRDR_ALTERNATE; } +procedure { return PRDR_PROCEDURE; } + +attntype { return PRDR_ATTNTYPE; } +shared { return PRDR_SHARED_KW; } +req { return PRDR_REQUIRED_KW; } +field { return PRDR_FLD_KW; } +mfg { return PRDR_MFG_KW; } +mfg_file { return PRDR_MFG_FILE_KW; } +sec { return PRDR_TIME_SEC; } +min { return PRDR_TIME_MIN; } +hour { return PRDR_TIME_HOUR; } +day { return PRDR_TIME_DAY; } + +filter { return PRDR_FILTER; } +singlebit { return PRDR_FILTER_SINGLE_BIT; } +priority { return PRDR_FILTER_PRIORITY; } + +"\<\<" { return PRDR_OP_LEFTSHIFT; } +"\>\>" { return PRDR_OP_RIGHTSHIFT; } + + /* Parse an "ID" type */ +{id} { yylval.str_ptr = new std::string(yytext); return PRDR_ID;} + + /* Ignore extra white space */ +{whitespace} { } + /* Newline or comment line increments line count */ +{newline} { yyline++; } +{comment} { yyline++; } + + /* Any other arbitrary character is returned unchanged (used for parens, |, + * {, etc. in yacc code). + */ +. { return yytext[0]; } + + /* When we find the .included directive, we need to enter a special parse + * context. There is a preprocessor that runs that changes .include directives + * to a .included / .end_included pair. This is used for line counting on + * errors. + */ +"\.included" BEGIN INCLUDED; + /* Ignore extra whitespace */ +<INCLUDED>{whitespace} { } + /* Find the name of the file that was included, push current file and line + * number on to a "stack". When the included file is complete, we pop a pair + * of the stack to determine where we left off in the old file. + */ +<INCLUDED>\".*\" { + yyincfiles.push( + std::pair<std::string,int>( + std::string(yytext), + yyline) + ); + yyline = 1; + } + /* The newline after the .included indicates the .included directive is + * complete. We then return to the "INITIAL" context to parse the included + * file properly. + */ +<INCLUDED>{newline} BEGIN INITIAL; + /* The .end_included directive indicates an included file has ended. Pop the + * parent file/line number off the stack. + */ +"\.end_included" { + yyline = yyincfiles.top().second; + yyincfiles.pop(); + } + + /* A "slash-star-star" indicates a special comment context. This is used for + * the doxygen-style commenting and HTML documentation generation. + */ +"/**"+[ \t]* BEGIN DOX_COMMENT; + /* A "star-slash" indicates the end of a doxygen comment context. (just like + * C++) + */ +<DOX_COMMENT>[ \t]*\*[/] BEGIN INITIAL; + /* Any number of tabs at the beginning of a line, followed by a star followed + * by anything but a slash, followed by any number of tabs is ignored. + */ +<DOX_COMMENT>\n[ \t]*\*[^/][ \t]* { yyline++; return PRDR_DOX_ENDL; } + /* Find any comment line itself (non-star, non-newline) */ +<DOX_COMMENT>[^*\n]* { + yylval.str_ptr = new std::string(yytext); + return PRDR_DOX_COMMENT; + } + /* New-line in a comment is a special token. */ +<DOX_COMMENT>\n { yyline++; return PRDR_DOX_ENDL; } +%% + +/* User Code */ +int yywrap() { return 1;}; // We're only parsing one file, so always return 1. + // This is a lex-ism. + diff --git a/src/usr/diag/prdf/common/framework/rule/prdrCompile.y b/src/usr/diag/prdf/common/framework/rule/prdrCompile.y new file mode 100755 index 000000000..f5e98391e --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdrCompile.y @@ -0,0 +1,999 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdrCompile.y $ */ +/* */ +/* 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 */ + +/* chip.y */ + +/** @file prdrCompile.y + * + * This file contains all of the yacc code for parsing rule-table syntax and + * creating the abstract-syntax tree. + * + * None of this code is ran on the FSP. It is all used to generate data + * files. + * + * Important background: + * + * Compilers, such as yacc/bison, have the concept of a terminal vs. + * non-terminal token. A terminal token is one which is not built from others, + * such as a keyword. A non-terminal token is one that has syntax associated + * with it, such as an "expression" token that is made up of many sub-tokens. + * + * Suggested reading material on parsers/compilers would be + * http://en.wikipedia.org/wiki/Backus-Naur_form + */ + +/* Pre C stuff: headers, etc. */ +%{ +#include <prdrToken.H> +#include <prdrCommon.H> + +#include <string> + +#include <prdrRegister.H> // REVIEW NOTE: Move to token.h? + +%} + +/* Union for the 'yylval' variable in lex or $$ variables in yacc code. Used + * to store the data associated with a parsed token. + */ +%union{ + + /* NOTE: Though we will read from rule file every integer as 64 bit number, + * when creating prf file we will use, 64 bit number only for + * registers. For other we will use it as per need (mostly 32 bit) and + * number will be truncated. It will be dictated by code defined in + * prdrExpr.H and other rule parsing classes. */ + + /** 64 bit unsigned integer value from a token. */ + uint64_t long_integer; + + /** string value from a token. */ + std::string * str_ptr; + /** Parsed list of registers. */ + PrdrRegisterList * reglist; + /** A single parsed register. */ + PrdrRegister * reg; + /** A structure for the reset / mask keywords. */ + PrdrResetOrMaskStruct * reg_mask; + /** A chip object */ + PrdrChip * chip; + /** A sub-expression token. */ + PrdrExpr * expr; + /** A parsed group of bit-operation / action pairs */ + PrdrGroup * grp; + /** A list of strings */ + std::list<std::string *>* strlist; + /** A list of filters */ + std::list<PrdrGroup_Filter *>* filterlist; +} + + /* Indicates the name for the start symbol. (non-terminal) */ +%start input + + /* Define a number of terminal symbols and the portion of the union + * associated with each of them. + */ +%token <long_integer> PRDR_INTEGER +%token <str_ptr> PRDR_ID +%token <str_ptr> PRDR_STRING +%token <str_ptr> PRDR_BIT_STRING + + /* Define a number of terminal symbols without associated data: + * the keywords. + */ +%token PRDR_CHIP +%token PRDR_GROUP +%token PRDR_TYPE +%token PRDR_ACTIONCLASS +%token PRDR_RULE + +%token PRDR_CHIPID +%token PRDR_TARGETTYPE +%token PRDR_SIGNATURE_OFFSET +%token PRDR_SIGNATURE_EXTRA +%token PRDR_REGISTER +%token PRDR_NAME_KW +%token PRDR_SCOMADDR +%token PRDR_SCOMLEN +%token PRDR_RESET_ADDR +%token PRDR_MASK_ADDR +%token PRDR_BIT_KW +%token PRDR_OP_LEFTSHIFT +%token PRDR_OP_RIGHTSHIFT + +%token PRDR_ACT_THRESHOLD +%token PRDR_ACT_ANALYSE +%token PRDR_ACT_TRY +%token PRDR_ACT_DUMP +%token PRDR_ACT_FUNCCALL +%token PRDR_ACT_GARD +%token PRDR_ACT_CALLOUT +%token PRDR_ACT_FLAG +%token PRDR_ACT_CAPTURE + +%token PRDR_CONNECTED +%token PRDR_ALTERNATE +%token PRDR_PROCEDURE + +%token PRDR_ATTNTYPE +%token PRDR_SHARED_KW +%token PRDR_REQUIRED_KW +%token PRDR_MFG_KW +%token PRDR_FLD_KW +%token PRDR_MFG_FILE_KW +%token PRDR_TIME_SEC +%token PRDR_TIME_MIN +%token PRDR_TIME_HOUR +%token PRDR_TIME_DAY + +%token PRDR_FILTER +%token PRDR_FILTER_SINGLE_BIT +%token PRDR_FILTER_PRIORITY + + /* Terminal tokens for Doxygen-style comments */ +%token <str_ptr> PRDR_DOX_COMMENT +%token <str_ptr> PRDR_DOX_ENDL + + /* Non-terminal tokens and the data-type associated with them. */ +%type <reg> register reglines regline +%type <reg_mask> register_mask +%type <chip> chiplines chipline +%type <expr> ruleexpr ruleexpr_small ruleexpr_shift ruleop1 ruleop2 +%type <expr> bitgroup bitandlist bitorlist +%type <expr> time_units +%type <grp> grouplines groupline +%type <grp> actionlines + +%type <expr> actionline +%type <expr> action_threshold action_shared_threshold action_analyse +%type <expr> action_analyse_conn action_try action_capture +%type <expr> action_dump action_gard action_callout action_funccall action_flag +%type <expr> action_callout_alt + +%type <strlist> grpattns grpattns_item +%type <filterlist> grpfilters grpfilt_items grpfilt_item + +%type <str_ptr> dox_comment dox_commentline dox_commentblk + +%% +/* Grammars */ + + /* The 'input' (or start token) is simply any number of lines. */ +input: + | input line +; + + /* Lines can be a full chip, group, rule, or actionclass. */ +line: chip + | group + | rule + | actionclass +; + + /* A chip is a chip-keyword, id, and any number of "lines" */ +chip: PRDR_CHIP PRDR_ID '{' chiplines '}' ';' + { + // Create a default chip object is chiplines are empty. + if (NULL == $4) + $4 = new PrdrChip(); + + // Assign chip's shortname from ID. + $4->cv_sname = $2; + + // Set current chip to be this chip. + g_currentChip = $4; + } +; + + /* Any number of lines can make up a chiplines token. */ +chiplines: { $$ = NULL; } // empty line. + | chiplines chipline ';' + { + // Merge the chip lines together into a single object as needed. + if (NULL != $1) + { + if (NULL == $2) + $$ = NULL; + else + { + // Both are non-NULL, merge. + PrdrChip::merge($1, $2); + $$ = $1; + delete $2; + } + } + else + { + if (NULL == $2) + $$ = NULL; + else + $$ = $2; + } + } + +; + + /* Create a chip object based on the contents of the line. */ +chipline: { $$ = NULL; } // allow a free ;. + | PRDR_CHIPID PRDR_INTEGER + { + $$ = new PrdrChip(); + $$->cv_chipid = $2; + } + | PRDR_SIGNATURE_OFFSET PRDR_INTEGER + { + $$ = new PrdrChip(); + $$->cv_signatureOffset = $2; + } + | PRDR_SIGNATURE_EXTRA '(' PRDR_ID ',' PRDR_INTEGER ',' + PRDR_STRING ',' PRDR_STRING ')' + { + $$ = new PrdrChip(); + $$->cv_sigExtras.push_back(PrdrExtraSignature($5, $7, $9)); + } + | PRDR_TARGETTYPE PRDR_ID + { + $$ = new PrdrChip(); + $$->cv_targetType = prdrActionArgMap(*$2); + } + | PRDR_NAME_KW PRDR_STRING + { + $$ = new PrdrChip(); + $$->cv_name = $2; + } + | register // register non-terminal token. + { + $$ = new PrdrChip(); + $$->cv_reglist.push_back($1); + } + | PRDR_SCOMLEN PRDR_INTEGER + { + $$ = new PrdrChip(); + $$->cv_scomlen = $2; + } + | PRDR_ACT_DUMP PRDR_ID //@ecdf + { + $$ = new PrdrChip(); + $$->cv_dumptype = prdrActionArgMap(*$2); + } +; + + /* A register is the register-keyword, id, and a number of "lines". */ +register: PRDR_REGISTER PRDR_ID '{' reglines '}' + { + // Create register object as needed. + if (NULL == $4) + $$ = new PrdrRegister(); + else + $$ = $4; + + // Assign short-name. + $$->cv_sname = $2; + } +; + /* Any number of lines can make up a reglines token. */ +reglines: { $$ = NULL; } + | reglines regline ';' + { + // Merge register lines as needed. + if (NULL != $1) + { + if (NULL == $2) + $$ = NULL; + else + { + // Both are non-NULL, merge. + PrdrRegister::merge($1, $2); + $$ = $1; + delete $2; + } + } + else + { + if (NULL == $2) + $$ = NULL; + else + $$ = $2; + } + } +; + + /* Define all of the lines (expressions) that can be found in a register */ +regline: { $$ = NULL; } + | PRDR_NAME_KW PRDR_STRING + { + $$ = new PrdrRegister(); + $$->cv_name = $2; + } + | PRDR_NAME_KW PRDR_ID + { + $$ = new PrdrRegister(); + $$->cv_name = $2; + } + | PRDR_SCOMADDR PRDR_INTEGER + { + $$ = new PrdrRegister(); + $$->cv_scomaddr = $2; + } + | PRDR_SCOMLEN PRDR_INTEGER + { + $$ = new PrdrRegister(); + $$->cv_scomlen = $2; + + // Indicate that the register contains a non-default scomlen. + $$->cv_flags |= Prdr::PRDR_REGISTER_SCOMLEN; + } + | PRDR_RESET_ADDR '(' register_mask ')' + { + $$ = new PrdrRegister(); + + // Add reset register to list. + $$->cv_resets.push_back(*$3); + delete $3; + } + | PRDR_MASK_ADDR '(' register_mask ')' + { + $$ = new PrdrRegister(); + + // Add mask register to list. + $$->cv_masks.push_back(*$3); + delete $3; + } + | PRDR_ACT_CAPTURE PRDR_GROUP PRDR_ID + { + $$ = new PrdrRegister(); + + // Define capture group. + PrdrCaptureReqStruct tmp; + tmp.type = PrdrCaptureReqStruct::PRDR_CAPTURE_GROUPID; + tmp.data[0] = prdrCaptureGroupMap(*$3); + + $$->cv_captures.push_back(tmp); + } +//@jl04 Add a new capture "type" here for regsiters. + | PRDR_ACT_CAPTURE PRDR_TYPE PRDR_ID + { + $$ = new PrdrRegister(); + + // Define capture type. + PrdrCaptureReqStruct tmp; + tmp.type = PrdrCaptureReqStruct::PRDR_CAPTURE_TYPE; + tmp.data[0] = prdrCaptureTypeMap(*$3); + $$->cv_captures.push_back(tmp); + } +//@jl04 End. + + | PRDR_ACT_CAPTURE PRDR_REQUIRED_KW PRDR_CONNECTED '(' PRDR_ID ')' + { + $$ = new PrdrRegister(); + + // Define capture "connected" requirement. + PrdrCaptureReqStruct tmp; + tmp.type = PrdrCaptureReqStruct::PRDR_CAPTURE_CONN; + tmp.data[0] = prdrActionArgMap(*$5); + tmp.data[1] = 0; + + $$->cv_captures.push_back(tmp); + } + | PRDR_ACT_CAPTURE PRDR_REQUIRED_KW PRDR_CONNECTED '(' PRDR_ID ',' PRDR_INTEGER ')' + { + $$ = new PrdrRegister(); + + // Define capture "connected" requirement. + PrdrCaptureReqStruct tmp; + tmp.type = PrdrCaptureReqStruct::PRDR_CAPTURE_CONN; + tmp.data[0] = prdrActionArgMap(*$5); + tmp.data[1] = $7; + + $$->cv_captures.push_back(tmp); + } + | PRDR_ACT_CAPTURE PRDR_REQUIRED_KW PRDR_ACT_FUNCCALL '(' PRDR_STRING ')' + { + $$ = new PrdrRegister(); + + // Define funccall requirement. + PrdrCaptureReqStruct tmp; + tmp.type = PrdrCaptureReqStruct::PRDR_CAPTURE_FUNC; + tmp.str = *$5; + + $$->cv_captures.push_back(tmp); + } +; + + /* Define the possible reset/mask instructions. */ +register_mask: '|' ',' PRDR_INTEGER + { + $$ = new PrdrResetOrMaskStruct(); + $$->type = '|'; + $$->addr_r = $3; + $$->addr_w = $3; + } + | '|' ',' PRDR_INTEGER ',' PRDR_INTEGER + { + $$ = new PrdrResetOrMaskStruct(); + $$->type = '|'; + $$->addr_r = $3; + $$->addr_w = $5; + } + | '&' ',' PRDR_INTEGER + { + $$ = new PrdrResetOrMaskStruct(); + $$->type = '&'; + $$->addr_r = $3; + $$->addr_w = $3; + } + | '&' ',' PRDR_INTEGER ',' PRDR_INTEGER + { + $$ = new PrdrResetOrMaskStruct(); + $$->type = '&'; + $$->addr_r = $3; + $$->addr_w = $5; + } + | '^' ',' PRDR_INTEGER + { + $$ = new PrdrResetOrMaskStruct(); + $$->type = '^'; + $$->addr_r = $3; + $$->addr_w = $3; + } + | '^' ',' PRDR_INTEGER ',' PRDR_INTEGER + { + $$ = new PrdrResetOrMaskStruct(); + $$->type = '^'; + $$->addr_r = $3; + $$->addr_w = $5; + } + | '~' ',' PRDR_INTEGER + { + $$ = new PrdrResetOrMaskStruct(); + $$->type = '~'; + $$->addr_r = $3; + $$->addr_w = $3; + } + | '~' ',' PRDR_INTEGER ',' PRDR_INTEGER + { + $$ = new PrdrResetOrMaskStruct(); + $$->type = '~'; + $$->addr_r = $3; + $$->addr_w = $5; + } +; + + /* Define a group object. */ +group: PRDR_GROUP PRDR_ID grpattns grpfilters '{' grouplines '}' ';' + { + // Add to group map. + g_groups[*$2] = $6; + + // Add attentions to attention start list. + if (NULL != $3) + { + for (std::list<std::string *>::iterator i = $3->begin(); + i != $3->end(); + ++i) + { + g_attentionStartGroup[*(*i)] = *$2; + delete (*i); + } + } + + // Add filters to group. + if (NULL != $4) + { + for (std::list<PrdrGroup_Filter *>::iterator i = $4->begin(); + i != $4->end(); + ++i) + { + (*i)->AddFilter($6); + delete (*i); + } + } + + // Free string for group name. + delete $2; + } +; + + /* Definitions for attention directives. */ +grpattns: { $$ = NULL; } + | PRDR_ATTNTYPE grpattns_item { $$ = $2; } +; + + /* Individual attention types defined for group. */ +grpattns_item: grpattns_item ',' PRDR_ID + { + $$ = $1; + $$->push_back($3); + } + | PRDR_ID + { + $$ = new std::list<std::string *>; + $$->push_back($1); + } +; + + /* Definitions for filter directives. */ +grpfilters: { $$ = NULL; } + | PRDR_FILTER grpfilt_items { $$ = $2; } +; + + /* Individual filter types defined for group. */ +grpfilt_items: grpfilt_items ',' grpfilt_item + { + $$ = $1; + $$->push_back(*($3->begin())); + } + | grpfilt_item + { + $$ = $1; + } +; + +grpfilt_item: PRDR_FILTER_SINGLE_BIT + { + $$ = new std::list<PrdrGroup_Filter *>; + $$->push_back(new PrdrGroup_Filter_SingleBit); + } +; + +grpfilt_item: PRDR_FILTER_PRIORITY '(' bitandlist ')' + { + $$ = new std::list<PrdrGroup_Filter *>; + $$->push_back(new PrdrGroup_Filter_Priority($3)); + } +; + + + +grouplines: { $$ = new PrdrGroup(); } + | grouplines groupline ';' + { + PrdrGroup::merge($1,$2); + $$ = $1; + delete $2; + } | grouplines dox_comment groupline ';' + { + $3->setComment(*$2); + PrdrGroup::merge($1,$3); + $$ = $1; + delete $3; + } +; + +groupline: { $$ = new PrdrGroup(); } + | '(' PRDR_ID ',' bitgroup ')' '?' PRDR_ID + { + $$ = new PrdrGroup(); + $$->cv_rules.push_front(new PrdrExprRule($2,$4,$7)); + g_references.push_front(PrdrRefPair("r",*$2)); + g_references.push_front(PrdrRefPair("a",*$7)); + } + | '(' PRDR_ID ',' bitgroup ')' '?' action_analyse + { + $$ = new PrdrGroup(); + $$->cv_rules.push_front(new PrdrExprRule($2,$4,static_cast<PrdrExprRef *>($7)->cv_name)); + g_references.push_front(PrdrRefPair("r",*$2)); + g_references.push_front(PrdrRefPair("g",*static_cast<PrdrExprRef *>($7)->cv_name)); + } + | PRDR_ID + { + $$ = new PrdrGroup(); + $$->cv_rules.push_front(new PrdrExprRef($1)); + g_references.push_front(PrdrRefPair("g",*$1)); + } +; + +bitgroup: PRDR_BIT_KW '(' bitandlist ')' { $$ = $3; } + | PRDR_BIT_KW '(' bitorlist ')' { $$ = $3; } +; + +// TODO: Change to & instead of , +bitandlist: bitandlist ',' PRDR_INTEGER + { + $$ = new PrdrExprOp2(Prdr::AND, + $1, + new PrdrExprInt($3, Prdr::INT_SHORT)); + } + | PRDR_INTEGER + { + $$ = new PrdrExprInt($1, Prdr::INT_SHORT); + } +; + +bitorlist: bitorlist '|' PRDR_INTEGER + { + $$ = new PrdrExprOp2(Prdr::OR, + $1, + new PrdrExprInt($3, Prdr::INT_SHORT)); + } + | PRDR_INTEGER '|' PRDR_INTEGER + { + $$ = new PrdrExprOp2(Prdr::OR, + new PrdrExprInt($1, Prdr::INT_SHORT), + new PrdrExprInt($3, Prdr::INT_SHORT)); + } +; + +// TODO: Merge attention types. +rule: PRDR_RULE PRDR_ID '{' ruleexpr ';' '}' ';' + { + g_rules[*$2] = new PrdrExprOp1(Prdr::RULE, $4); + delete $2; + } + | PRDR_RULE PRDR_ID '{' PRDR_ID ':' ruleexpr ';' '}' ';' + { + g_rules[*$2] = new PrdrExprOp1(Prdr::RULE, + new PrdrExprAttnLink($4, $6, NULL, NULL, NULL, NULL, NULL, NULL)); + delete $2; + delete $4; + } + | PRDR_RULE PRDR_ID '{' PRDR_ID ':' ruleexpr ';' + PRDR_ID ':' ruleexpr ';' + '}' ';' + { + g_rules[*$2] = new PrdrExprOp1(Prdr::RULE, + new PrdrExprAttnLink($4, $6, $8, $10, NULL, NULL, NULL, NULL)); + delete $2; + delete $4; + delete $8; + } + | PRDR_RULE PRDR_ID '{' PRDR_ID ':' ruleexpr ';' + PRDR_ID ':' ruleexpr ';' + PRDR_ID ':' ruleexpr ';' + '}' ';' + { + g_rules[*$2] = new PrdrExprOp1(Prdr::RULE, + new PrdrExprAttnLink($4, $6, $8, $10, $12, $14, NULL, NULL)); + delete $2; + delete $4; + delete $8; + delete $12; + } + | PRDR_RULE PRDR_ID '{' PRDR_ID ':' ruleexpr ';' + PRDR_ID ':' ruleexpr ';' + PRDR_ID ':' ruleexpr ';' + PRDR_ID ':' ruleexpr ';' + '}' ';' + { + g_rules[*$2] = new PrdrExprOp1(Prdr::RULE, + new PrdrExprAttnLink($4, $6, $8, $10, $12, $14, $16, $18)); + delete $2; + delete $4; + delete $8; + delete $12; + delete $16; + } +; + +ruleexpr: ruleexpr_small { $$ = $1; } + | ruleexpr_small ruleop2 ruleexpr + { + $$ = $2; + static_cast<PrdrExprOp2 *>($$)->cv_arg[0] = $1; + static_cast<PrdrExprOp2 *>($$)->cv_arg[1] = $3; + } + | ruleexpr_shift { $$ = $1; } +; + +ruleexpr_small: '(' ruleexpr ')' { $$ = $2; } + | PRDR_ID + { + $$ = new PrdrExprRef($1); + g_references.push_front(PrdrRefPair("re", *$1)); + } + | ruleop1 ruleexpr_small + { + $$ = $1; + static_cast<PrdrExprOp1 *>($$)->cv_arg = $2; + } + | PRDR_BIT_STRING + { + $$ = new PrdrExprBitString(*$1); + delete $1; + } +; + +ruleexpr_shift: ruleexpr_small PRDR_OP_LEFTSHIFT PRDR_INTEGER + { + $$ = new PrdrExprOp2(Prdr::LSHIFT, + $1, + new PrdrExprInt($3)); + + } + | ruleexpr_small PRDR_OP_RIGHTSHIFT PRDR_INTEGER + { + $$ = new PrdrExprOp2(Prdr::RSHIFT, + $1, + new PrdrExprInt($3, Prdr::INT_SHORT)); + } +; + +ruleop1: '~' + { + $$ = new PrdrExprOp1(Prdr::NOT); + } +; + +ruleop2: '|' + { + $$ = new PrdrExprOp2(Prdr::OR); + } + | '&' + { + $$ = new PrdrExprOp2(Prdr::AND); + } + | '^' + { + $$ = new PrdrExprOp2(Prdr::XOR); + } +; + +actionclass: PRDR_ACTIONCLASS PRDR_ID '{' actionlines '}' ';' + { + g_actionclasses[*$2] = $4; + delete $2; + } + | dox_comment PRDR_ACTIONCLASS PRDR_ID '{' actionlines '}' ';' + { + $5->setComment(*$1); + g_actionclasses[*$3] = $5; + delete $3; + } +; + +actionlines: + { + $$ = new PrdrGroup(Prdr::ACTION); + } + | actionlines actionline ';' + { + if (NULL != $2) + $1->cv_rules.push_back($2); + $$ = $1; + } +; + +actionline: + { + $$ = NULL; + } + | PRDR_ID + { + $$ = new PrdrExprRef($1); + g_references.push_front(PrdrRefPair("a", *$1)); + } + | action_threshold { $$ = $1; } + | action_shared_threshold { $$ = $1; } + | action_analyse { $$ = $1; } + | action_analyse_conn { $$ = $1; } + | action_try { $$ = $1; } + | action_dump { $$ = $1; } + | action_gard { $$ = $1; } + | action_callout { $$ = $1; } + | action_funccall { $$ = $1; } + | action_flag { $$ = $1; } + | action_capture { $$ = $1; } +; + +action_threshold: PRDR_ACT_THRESHOLD '(' ')' + { + $$ = new PrdrExprAct_Thresh(); + } + | PRDR_ACT_THRESHOLD '(' PRDR_FLD_KW '(' PRDR_INTEGER time_units ')' ')' + { + $$ = new PrdrExprAct_Thresh($5, $6); + } + | PRDR_ACT_THRESHOLD '(' PRDR_FLD_KW '(' PRDR_INTEGER time_units ')' ',' PRDR_MFG_KW '(' PRDR_INTEGER time_units ')' ')' + { + $$ = new PrdrExprAct_Thresh($5, $6, $11, $12); + } + | PRDR_ACT_THRESHOLD '(' PRDR_FLD_KW '(' PRDR_INTEGER time_units ')' ',' PRDR_MFG_FILE_KW '(' PRDR_ID ')' ')' + { + $$ = new PrdrExprAct_Thresh($5, $6, 0, NULL, $11); + } +; + +action_shared_threshold: action_threshold PRDR_SHARED_KW '(' PRDR_INTEGER ')' + { + static_cast<PrdrExprAct_Thresh *>($1)->cv_3 = $4; + $$ = $1; + } +; + +time_units: + { + $$ = new PrdrExprTime(0xffffffff, Prdr::PRDR_TIME_BASE_SEC); + } + // FIXME: (RTC 51218) It is impossible to reach a theshold of 1000 per + // second because PRD cannot respond to attentions that quickly (at + // least on the FSP). Need to add code to check if the threshold is + // possible to based on the reaction type per attention ratio. + | '/' PRDR_TIME_SEC + { + $$ = new PrdrExprTime(1, Prdr::PRDR_TIME_BASE_SEC); + } + | '/' PRDR_TIME_MIN + { + $$ = new PrdrExprTime(1, Prdr::PRDR_TIME_BASE_MIN); + } + | '/' PRDR_TIME_HOUR + { + $$ = new PrdrExprTime(1, Prdr::PRDR_TIME_BASE_HOUR); + } + | '/' PRDR_TIME_DAY + { + $$ = new PrdrExprTime(1, Prdr::PRDR_TIME_BASE_DAY); + } + | '/' PRDR_INTEGER PRDR_TIME_SEC + { + $$ = new PrdrExprTime($2, Prdr::PRDR_TIME_BASE_SEC); + } + | '/' PRDR_INTEGER PRDR_TIME_MIN + { + $$ = new PrdrExprTime($2, Prdr::PRDR_TIME_BASE_MIN); + } + | '/' PRDR_INTEGER PRDR_TIME_HOUR + { + $$ = new PrdrExprTime($2, Prdr::PRDR_TIME_BASE_HOUR); + } + | '/' PRDR_INTEGER PRDR_TIME_DAY + { + $$ = new PrdrExprTime($2, Prdr::PRDR_TIME_BASE_DAY); + } +; + +action_analyse: PRDR_ACT_ANALYSE '(' PRDR_ID ')' + { + $$ = new PrdrExprRef($3); + g_references.push_front(PrdrRefPair("g",*$3)); + } +; + +action_analyse_conn: PRDR_ACT_ANALYSE '(' PRDR_CONNECTED '(' PRDR_ID ')' ')' + { + $$ = new PrdrExprAct_Analyse($5); + } +; + +action_analyse_conn: PRDR_ACT_ANALYSE '(' PRDR_CONNECTED '(' PRDR_ID ',' PRDR_INTEGER ')' ')' + { + $$ = new PrdrExprAct_Analyse($5, $7); + } +; + +action_try: PRDR_ACT_TRY '(' actionline ',' actionline ')' + { + $$ = new PrdrExprAct_Try($3,$5); + } +; + +action_dump: PRDR_ACT_DUMP '(' PRDR_ID ')' //@ecdf + { + $$ = new PrdrExprAct_Dump($3); + } + // TODO: Allow Dump connected. +; + +action_gard: PRDR_ACT_GARD '(' PRDR_ID ')' + { + $$ = new PrdrExprAct_Gard($3); + } +; + +action_callout: PRDR_ACT_CALLOUT '(' PRDR_ID ')' + { + $$ = new PrdrExprAct_Callout($3); + } + | PRDR_ACT_CALLOUT '(' PRDR_CONNECTED '(' PRDR_ID action_callout_alt ')' ',' PRDR_ID ')' + { + $$ = new PrdrExprAct_Callout($9, $5, PrdrExprAct_Callout::CALLOUT_CHIP, 0xffffffff, $6); + } + | PRDR_ACT_CALLOUT '(' PRDR_CONNECTED '(' PRDR_ID ',' PRDR_INTEGER action_callout_alt ')' ',' PRDR_ID ')' + { + $$ = new PrdrExprAct_Callout($11, $5, PrdrExprAct_Callout::CALLOUT_CHIP, $7, $8); + } + + + | PRDR_ACT_CALLOUT '(' PRDR_PROCEDURE '(' PRDR_ID ')' ',' PRDR_ID ')' + { + $$ = new PrdrExprAct_Callout($8, $5, PrdrExprAct_Callout::CALLOUT_PROC); + } + +; + +action_callout_alt: + { + $$ = NULL; + } + | ',' PRDR_ALTERNATE '(' actionline ')' + { + $$ = $4; + } +; + +action_funccall: PRDR_ACT_FUNCCALL '(' PRDR_STRING ')' + { + $$ = new PrdrExprAct_Funccall($3); + } + | PRDR_ACT_FUNCCALL '(' PRDR_STRING ',' PRDR_ID ')' + { + $$ = new PrdrExprAct_Funccall($3, $5); + } +; + +action_flag: PRDR_ACT_FLAG '(' PRDR_ID ')' + { + $$ = new PrdrExprAct_Flag($3); + } +; + +action_capture: PRDR_ACT_CAPTURE '(' PRDR_ID ')' + { + $$ = new PrdrExprAct_Capture($3); + } +; + + +dox_comment: dox_commentblk + { + $$ = $1; + } + | dox_commentblk dox_comment + { + (*$1) += (*$2); + $$ = $1; + } +; + +dox_commentblk: dox_commentline + { + $$ = $1; + } + | PRDR_DOX_ENDL + { + $$ = new std::string("\n"); + } +; + +dox_commentline: PRDR_DOX_COMMENT + { + $$ = $1; + } +; + +%% +/* Additional C Code */ + +void yyerror(const char * s) +{ + if (yyincfiles.empty()) + fprintf(stderr, "Line %d: %s\n", yyline, s); + else + fprintf(stderr, "File %s Line %d: %s\n", + yyincfiles.top().first.c_str(), + yyline, + s); + + g_hadError = true; +} + diff --git a/src/usr/diag/prdf/common/framework/rule/prdrExpr.H b/src/usr/diag/prdf/common/framework/rule/prdrExpr.H new file mode 100755 index 000000000..dd3748b9c --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdrExpr.H @@ -0,0 +1,1044 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdrExpr.H $ */ +/* */ +/* 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 */ + +#ifndef __PRDREXPR_H +#define __PRDREXPR_H + +#include <map> +#include <list> +#include <sstream> +#include <stdint.h> +#include <typeinfo> // for typeid + +#include <netinet/in.h> + +#include <prdrCommon.H> // for enums. + +// -- Forward defs // +class PrdrExpr; +uint16_t prdrGetRefId(std::string *); +char prdrGetRefType(std::string *); +void prdrCheckReferences(); +uint32_t prdrActionArgMap(const std::string &); +uint32_t prdrCaptureGroupMap(const std::string &); +uint32_t prdrCaptureTypeMap(const std::string &); // @jl04 Type for registers. +std::list<std::string> prdrParseDoxygen(std::string & i_string); +class PrdrChip; +extern PrdrChip * g_currentChip; +extern std::map<std::string, PrdrExpr *> g_rules; +extern void yyerror(const char *); +extern uint32_t g_nextAndBit; +extern bool g_hadError; +// -- end Forward defs // + +using Prdr::PrdrSignatureOp; + +class PrdrExpr +{ + public: + + virtual int output(FILE *) = 0; + + virtual void setComment(std::string & i_comment) + { cv_doxcomment = i_comment; }; + + virtual void generateDoxygen(std::ostream & o_stream, + std::string & o_trailing, + std::ostream & o_errFile = std::cerr) + { o_stream << "Using default."; }; + + virtual uint16_t getSignature() + { + std::cerr << "def sig: " << typeid(*this).name() + << std::endl; + return PrdrSignatureOp::DEFAULT_SIGNATURE; + }; + + + PrdrExpr() : cv_doxcomment("") {}; + virtual ~PrdrExpr() {}; + + protected: + std::string cv_doxcomment; +}; + +class PrdrExprRef : public PrdrExpr +{ + public: + std::string * cv_name; + + PrdrExprRef(std::string * n) : cv_name(n) {}; + + int output(FILE * i_file) + { + char l_op = prdrGetRefType(cv_name); + uint16_t l_id = htons(prdrGetRefId(cv_name)); + + fwrite(&l_op, 1, 1, i_file); + fwrite(&l_id, sizeof(l_id), 1, i_file); + + return 0; + }; + + void generateDoxygen(std::ostream & o_stream, + std::string & o_trailing, + std::ostream & o_errFile = std::cerr) + { + o_stream << "<A HREF=\"#" << *cv_name << "\">" + << *cv_name << "</A>"; + } + + virtual uint16_t getSignature() + { + if (Prdr::REF_REG == prdrGetRefType(cv_name)) + { + return Util::hashString(cv_name->c_str()); + } + else + { + PrdrExpr * tmp = g_rules[*cv_name]; + if (NULL == tmp) + { + std::cerr << "NPE: " << *cv_name << std::endl; + } + return (NULL == tmp ? + PrdrSignatureOp::DEFAULT_SIGNATURE + : tmp->getSignature() + ); + } + }; + +}; + +class PrdrExprInt : public PrdrExpr +{ + public: + uint32_t cv_value; + char cv_op; + + PrdrExprInt() : cv_op(Prdr::INTEGER) {}; + PrdrExprInt(uint32_t v, char o = Prdr::INTEGER) : cv_value(v), + cv_op(o) {}; + + int output(FILE * i_file) + { + char tmp = cv_op; + fwrite(&tmp, 1, 1, i_file); + + if (Prdr::INTEGER != cv_op) + { + uint16_t temp = htons((uint16_t) cv_value); + fwrite(&temp, sizeof(temp), 1, i_file); + } + else + { + uint32_t temp = htonl(cv_value); + fwrite(&temp, sizeof(temp), 1, i_file); + } + + return 0; + }; + + void generateDoxygen(std::ostream & o_stream, + std::string & o_trailing, + std::ostream & o_errFile = std::cerr) + { + o_stream << cv_value; + o_errFile << std::setfill('0') << std::setw(2) << std::hex + << cv_value; + }; + + uint16_t getSignature() { return PrdrSignatureOp::DEFAULT_SIGNATURE; }; +}; + +class PrdrExprTime : public PrdrExpr +{ + public: + + uint32_t iv_units; + Prdr::PrdrTimeBaseFlags iv_base; + + PrdrExprTime() : + iv_units(0xffffffff), iv_base(Prdr::PRDR_TIME_BASE_SEC) + {} + + PrdrExprTime( uint32_t units, Prdr::PrdrTimeBaseFlags base ) : + iv_units(units), iv_base(base) + {} + + int output( FILE * i_file ) + { + uint32_t seconds = 0xffffffff; + if ( (seconds / iv_base) > iv_units ) + seconds = iv_units * iv_base; + + seconds = htonl( seconds ); + fwrite( &seconds, sizeof(seconds), 1, i_file ); + + return 0; + } + + void generateDoxygen( std::ostream & o_stream, + std::string & o_trailing, + std::ostream & o_errFile = std::cerr ) + { + o_stream << iv_units << " "; + switch ( iv_base ) + { + case Prdr::PRDR_TIME_BASE_SEC: o_stream << "sec"; break; + case Prdr::PRDR_TIME_BASE_MIN: o_stream << "min"; break; + case Prdr::PRDR_TIME_BASE_HOUR: o_stream << "hour"; break; + case Prdr::PRDR_TIME_BASE_DAY: o_stream << "day"; break; + default: ; + } + } +}; + +class PrdrExprBitString : public PrdrExpr +{ + public: + std::string cv_value; + char cv_op; + + PrdrExprBitString() : cv_value(), cv_op(Prdr::BIT_STR) {}; + PrdrExprBitString(std::string v, char o = Prdr::BIT_STR) : cv_value(v), + cv_op(o) {}; + + int output(FILE * i_file) + { + char tmp = cv_op; + fwrite(&tmp, 1, 1, i_file); + + // subtract 2 backticks. + uint8_t len = (cv_value.length() - 2) * 4; + fwrite(&len, sizeof(len), 1, i_file); + + uint8_t tmp8 = 0; + + len = len / 4; + + // Output binary data from hex. + for (int i = 0; i < len; i++) + { + if (isdigit(cv_value[i+1])) + { + tmp8 |= cv_value[i+1] - '0'; + } + else + { + tmp8 |= toupper(cv_value[i+1]) - 'A' + 0xa; + } + + if (i == (len - 1)) + { + while ((i % 2) != 1) + { + tmp8 <<= 4; + i++; + } + } + if (i % 2 == 1) + { + fwrite(&tmp8, sizeof(tmp8), 1, i_file); + tmp8 = 0; + } + + tmp8 <<= 4; + } + + return 0; + }; + + void generateDoxygen(std::ostream & o_stream, + std::string & o_trailing, + std::ostream & o_errFile = std::cerr) + { + o_stream << cv_value; + o_errFile << cv_value; + }; + + uint16_t getSignature() { return PrdrSignatureOp::DEFAULT_SIGNATURE; }; +}; + + +class PrdrExprOp1 : public PrdrExpr +{ + public: + char cv_op; + PrdrExpr * cv_arg; + + PrdrExprOp1(char o) : cv_op(o) {}; + PrdrExprOp1(char o, PrdrExpr * a) : cv_op(o), cv_arg(a) {}; + + int output(FILE * i_file) + { + fwrite(&cv_op, 1, 1, i_file); + cv_arg->output(i_file); + + return 0; + }; + + void generateDoxygen(std::ostream & o_stream, + std::string & o_trailing, + std::ostream & o_errFile = std::cerr) + { + o_stream << cv_op << " "; + if (NULL != cv_arg) + cv_arg->generateDoxygen(o_stream, o_trailing, o_errFile); + }; + + uint16_t getSignature() + { + return (NULL == cv_arg ? + PrdrSignatureOp::DEFAULT_SIGNATURE + : cv_arg->getSignature() + ); + } + +}; + +class PrdrExprOp2 : public PrdrExpr +{ + public: + PrdrExpr * cv_arg[2]; + char cv_op; + + PrdrExprOp2(char o) : cv_op(o) {}; + PrdrExprOp2(char o, PrdrExpr * a1, PrdrExpr * a2) : cv_op(o) + { + cv_arg[0] = a1; cv_arg[1] = a2; + }; + + int output(FILE * i_file) + { + fwrite(&cv_op, 1, 1, i_file); + cv_arg[0]->output(i_file); + cv_arg[1]->output(i_file); + + return 0; + }; + + void generateDoxygen(std::ostream & o_stream, + std::string & o_trailing, + std::ostream & o_errFile = std::cerr) + { + if (NULL != cv_arg[0]) + cv_arg[0]->generateDoxygen(o_stream, o_trailing, o_errFile); + o_stream << " " << cv_op << " "; + + if (NULL != cv_arg[1]) + cv_arg[1]->generateDoxygen(o_stream, o_trailing, o_errFile); + }; + + uint16_t getSignature() + { + return PrdrSignatureOp::combineSig( + (NULL == cv_arg[0] ? + PrdrSignatureOp::DEFAULT_SIGNATURE + : cv_arg[0]->getSignature() + ), + (NULL == cv_arg[1] ? + PrdrSignatureOp::DEFAULT_SIGNATURE + : cv_arg[1]->getSignature() + )); + }; + +}; + +class PrdrExprAttnLink : public PrdrExpr +{ + public: + static const int MAX_ATTNS = 4; + PrdrExpr * cv_arg[MAX_ATTNS]; + + PrdrExprAttnLink(std::string * attn1, PrdrExpr * exp1, + std::string * attn2, PrdrExpr * exp2, + std::string * attn3, PrdrExpr * exp3, + std::string * attn4, PrdrExpr * exp4) + { + for (int i = 0; i < MAX_ATTNS; i++) + cv_arg[i] = NULL; + + cv_arg[decodeAttnType(attn1)] = exp1; + if (NULL != exp2) + cv_arg[decodeAttnType(attn2)] = exp2; + if (NULL != exp3) + cv_arg[decodeAttnType(attn3)] = exp3; + if (NULL != exp4) + cv_arg[decodeAttnType(attn4)] = exp4; + }; + + int output(FILE * i_file) + { + char cv_op = Prdr::ATTNLINK; + fwrite(&cv_op, 1, 1, i_file); + + cv_op = 0; + for (int i = 0; i < MAX_ATTNS; i++) + if (NULL != cv_arg[i]) + cv_op++; + fwrite(&cv_op, 1, 1, i_file); + + for (int i = 0; i < MAX_ATTNS; i++) + if (NULL != cv_arg[i]) + { + cv_op = i; + fwrite(&cv_op, 1, 1, i_file); + cv_arg[i]->output(i_file); + } + + return 0; + } + + uint16_t getSignature() + { + uint16_t l_val = PrdrSignatureOp::DEFAULT_SIGNATURE; + for (int i = 0; i < MAX_ATTNS; i++) + if (NULL != cv_arg[i]) + l_val = PrdrSignatureOp::combineSig(l_val, + cv_arg[i]->getSignature()); + else + l_val = PrdrSignatureOp::combineSig(l_val, + PrdrSignatureOp::DEFAULT_SIGNATURE); + return l_val; + }; + + protected: + int decodeAttnType(std::string * attn) + { + if (NULL == attn) + { + yyerror("ICE - NPE."); + } + else if ("CHECK_STOP" == *attn) + { + return 0; + } + else if ("RECOVERABLE" == *attn) + { + return 1; + } + else if ("SPECIAL" == *attn) + { + return 2; + } + else if ("PROC_CS" == *attn) + { + return 3; + } + else if ("UNIT_CS" == *attn) // @jl02 Add UNIT_CS check. + { + return 3; // @jl02 + } + else + { + char error[256]; + strcpy(error, "Invalid attention name: "); + strncat(error, attn->c_str(), 255); + + yyerror(error); + } + return 0; + }; +}; + + +class PrdrExprRule : public PrdrExpr +{ + public: + std::string * cv_rulename; + PrdrExpr * cv_bits; + std::string * cv_actionname; + + PrdrExprRule(std::string * r, PrdrExpr * b, std::string * a) + : cv_rulename(r), cv_bits(b), cv_actionname(a) {}; + + int output(FILE * i_file) + { + uint16_t l_ref; + char l_op; + + l_op = Prdr::REF_RULE; + fwrite(&l_op, 1, 1, i_file); + l_ref = htons(prdrGetRefId(cv_rulename)); + fwrite(&l_ref, sizeof(l_ref), 1, i_file); + + cv_bits->output(i_file); + + l_op = prdrGetRefType(cv_actionname); + fwrite(&l_op, 1, 1, i_file); + l_ref = htons(prdrGetRefId(cv_actionname)); + fwrite(&l_ref, sizeof(l_ref), 1, i_file); + + return 0; + }; + + void generateDoxygen(std::ostream & o_stream, + std::string & o_trailing, + std::ostream & o_errFile = std::cerr) + { + std::list<std::string> l_parsed = prdrParseDoxygen(cv_doxcomment); + + std::string l_name("N/A"), l_short("N/A"), l_long(""); + std::ostringstream l_errFront, l_errBits, l_errBack; + + l_errFront << "\tPRDR_ERROR_SIGNATURE ( 0x" + << std::setfill('0') << std::setw(4) + << std::hex + << ( (PrdrExprRef(cv_rulename).getSignature() + + g_currentChip->cv_signatureOffset) & 0xffff ) + << "00"; + + o_stream << "<TD align=\"center\">"; + cv_bits->generateDoxygen(o_stream, o_trailing, l_errBits); + + if (std::string() != l_parsed.front()) + { + l_name = l_parsed.front(); + } + l_parsed.pop_front(); + + if (std::string() != l_parsed.front()) + { + l_short = l_parsed.front(); + } + l_parsed.pop_front(); + + if (std::string() != l_parsed.front()) + { + l_long = l_parsed.front(); + } + + o_stream << "<TD align=\"center\">"; + if (std::string() != l_long) + { + o_stream << "<A HREF=\"#" << l_name << "\">"; + + o_trailing += "<B><A NAME='" + l_name + "'>" ; + o_trailing += l_name + ": </A></B>"; + + o_trailing += l_short + "<BR>"; + o_trailing += l_long + "<BR><BR>\n"; + } + o_stream << l_name; + if (std::string() != l_long) + { + o_stream << "</A>"; + o_trailing += "</A>"; + } + + o_stream << "<TD>" << l_short; + + + o_stream << "<TD><A HREF=\"#" << *cv_actionname << "\">" + << *cv_actionname << "</A>"; + + l_errBack << ", \"" << l_name << "\", \"" << l_short << "\""; + l_errBack << " )" << std::endl; + + for (size_t i = 0; i < (l_errBits.str().length()/2); i++) + { + o_errFile << l_errFront.str(); + + if (typeid(*cv_bits).name() == typeid(PrdrExprOp2).name()) + { + if (static_cast<PrdrExprOp2 *>(cv_bits)->cv_op == Prdr::AND) + { + o_errFile << std::setfill('0') << std::setw(2) + << std::hex; + o_errFile << g_nextAndBit; + g_nextAndBit++; + + i = 256; + } + else + { + o_errFile << l_errBits.str()[2*i] + << l_errBits.str()[2*i+1]; + } + } + else + { + o_errFile << l_errBits.str()[2*i] + << l_errBits.str()[2*i+1]; + } + + o_errFile << l_errBack.str(); + } + }; +}; + +class PrdrExprAct_Try : public PrdrExpr +{ + public: + PrdrExpr * cv_left, * cv_right; + + PrdrExprAct_Try(PrdrExpr * l, PrdrExpr * r) : cv_left(l), + cv_right(r) {}; + + int output(FILE * i_file) + { + char l_op; + + l_op = Prdr::ACT_TRY; + fwrite(&l_op, 1, 1, i_file); + cv_left->output(i_file); + cv_right->output(i_file); + + return 0; + }; + + void generateDoxygen(std::ostream & o_stream, + std::string & o_trailing, + std::ostream & o_errFile = std::cerr) + { + o_stream << "try { "; + if (NULL != cv_left) + cv_left->generateDoxygen(o_stream, o_trailing, o_errFile); + o_stream << ", "; + if (NULL != cv_right) + cv_right->generateDoxygen(o_stream, o_trailing, o_errFile); + o_stream << " } "; + }; + +}; + +class PrdrExprAct_Thresh : public PrdrExpr +{ + public: + PrdrExpr* cv_thresholdTime[2]; + //Maximum threshold value supported is 255 + uint8_t cv_field; + uint8_t cv_mfg; + uint32_t cv_3; + std::string * cv_mfg_file_thr; + + PrdrExprAct_Thresh( uint8_t i_field = 0, PrdrExpr * i_fieldTime = NULL, + uint8_t i_mfg = 0, PrdrExpr * i_mfgTime = NULL, + std::string * i_mfg_file = NULL ) : + cv_field(i_field), cv_mfg(i_mfg), cv_mfg_file_thr(i_mfg_file) + { + cv_thresholdTime[0] = i_fieldTime; + cv_thresholdTime[1] = i_mfgTime; + }; + + int output(FILE * i_file) + { + char l_op; + l_op = Prdr::ACT_THRES; + fwrite(&l_op, 1, 1, i_file); + + if (NULL == cv_thresholdTime[0]) + l_op = 0; + else if ( (NULL == cv_thresholdTime[1]) && + (NULL == cv_mfg_file_thr)) + { + l_op = 1; + } + else + l_op = 2; + + if (0 != cv_3) + l_op |= 0x40; + + if (NULL != cv_mfg_file_thr) + l_op |= 0x20; + + fwrite(&l_op, 1, 1, i_file); + + if (NULL != cv_thresholdTime[0]) + { + fwrite(&cv_field, sizeof(cv_field), 1, i_file); + cv_thresholdTime[0]->output(i_file); + if (NULL != cv_thresholdTime[1]) + { + fwrite(&cv_mfg, sizeof(cv_mfg), 1, i_file); + cv_thresholdTime[1]->output(i_file); + } + else if (NULL != cv_mfg_file_thr) + { + uint32_t l_tmp32 = prdrActionArgMap(*cv_mfg_file_thr); + l_tmp32 = htonl(l_tmp32); + fwrite(&l_tmp32, sizeof(l_tmp32), 1, i_file); + } + } + + if (0 != cv_3) + { + uint32_t l_tmp32 = htonl(cv_3); + fwrite(&l_tmp32, 4, 1, i_file); + } + + return 0; + } + + void generateDoxygen(std::ostream & o_stream, + std::string & o_trailing, + std::ostream & o_errFile = std::cerr) + { + o_stream << "threshold("; + if (NULL != cv_thresholdTime[0]) + { + uint32_t units = cv_field; + o_stream <<" field"; + o_stream << "("; + o_stream << units; + o_stream << ","; + cv_thresholdTime[0]->generateDoxygen(o_stream, o_trailing, o_errFile); + o_stream << ")"; + if (NULL != cv_thresholdTime[1]) + { + units = cv_mfg; + o_stream << ", mfg"; + o_stream << "("; + o_stream << units; + o_stream << ","; + cv_thresholdTime[1]->generateDoxygen(o_stream, o_trailing, o_errFile); + o_stream << ")"; + } + else if (NULL != cv_mfg_file_thr) + { + o_stream << ", mfg_file"; + o_stream << "("; + o_stream << *cv_mfg_file_thr; + o_stream << ")"; + } + } + o_stream << ")"; + if (0 != cv_3) + { + o_stream << " shared(" << cv_3 << ")"; + } + }; + +}; + + +class PrdrExprAct_Dump : public PrdrExpr //@ecdf +{ + public: + std::string * cv_1; + + PrdrExprAct_Dump(std::string * i_1) : cv_1(i_1) {}; + + int output(FILE * i_file) + { + char l_op; + + l_op = Prdr::ACT_DUMP; + fwrite(&l_op, 1, 1, i_file); + + uint32_t l_dType; + + if (NULL == cv_1) + l_dType = prdrActionArgMap("DUMP_CONTENT_HW"); + else + l_dType = prdrActionArgMap(*cv_1); + l_dType = htonl(l_dType); + fwrite(&l_dType, sizeof(l_dType), 1, i_file); + + return 0; + }; + + void generateDoxygen(std::ostream & o_stream, + std::string & o_trailing, + std::ostream & o_errFile = std::cerr) + { + o_stream << "dump( " << *cv_1 << " ) "; + }; + +}; + +class PrdrExprAct_Gard : public PrdrExpr +{ + public: + std::string * cv_1; + + PrdrExprAct_Gard(std::string * i_1) : cv_1(i_1) {}; + + int output(FILE * i_file) + { + char l_op; + + l_op = Prdr::ACT_GARD; + fwrite(&l_op, 1, 1, i_file); + + uint32_t l_gType = htonl(prdrActionArgMap(*cv_1)); + fwrite(&l_gType, sizeof(l_gType), 1, i_file); + + return 0; + }; + + void generateDoxygen(std::ostream & o_stream, + std::string & o_trailing, + std::ostream & o_errFile = std::cerr) + { + o_stream << "gard( " << *cv_1 << " ) "; + }; + +}; + +class PrdrExprAct_Analyse : public PrdrExpr +{ + public: + std::string * cv_1; + uint32_t cv_2; + + PrdrExprAct_Analyse( std::string * i_1, uint32_t i_2 = 0xffffffff ) : + cv_1(i_1), cv_2(i_2) + {} + + int output(FILE * i_file) + { + char l_op = Prdr::ACT_ANALY; + fwrite(&l_op, 1, 1, i_file); + + uint32_t l_chipType = htonl(prdrActionArgMap(*cv_1)); + fwrite(&l_chipType, sizeof(l_chipType), 1, i_file); + + uint32_t l_chipIndx = htonl(cv_2); + fwrite(&l_chipIndx, sizeof(l_chipIndx), 1, i_file); + + return 0; + }; + + void generateDoxygen(std::ostream & o_stream, + std::string & o_trailing, + std::ostream & o_errFile = std::cerr) + { + o_stream << "analyze ( "; + o_stream << "connected ( " << *cv_1 ; + if ( 0xffffffff != cv_2 ) + o_stream << ", " << cv_2; + o_stream << " ) ) "; + } + +}; + +class PrdrExprAct_Callout : public PrdrExpr +{ + public: + std::string * cv_1, * cv_2; + uint32_t cv_3; + + PrdrExpr * cv_alt; + + enum Callout_type + { + CALLOUT_SELF = 's', + CALLOUT_CHIP = 'c', + CALLOUT_PROC = 'p', + }; + + Callout_type cv_type; + + PrdrExprAct_Callout(std::string * i_1, + std::string * i_2 = NULL, + Callout_type i_t = CALLOUT_SELF, + uint32_t i_3 = 0xffffffff, + PrdrExpr * i_alt = NULL) : + cv_1(i_1), cv_2(i_2), cv_3(i_3), cv_alt(i_alt), cv_type(i_t) + {} + + int output(FILE * i_file) + { + char l_op; + + l_op = Prdr::ACT_CALL; + fwrite(&l_op, 1, 1, i_file); + + l_op = cv_type; + fwrite(&l_op, 1, 1, i_file); + + uint32_t l_priority = htonl(prdrActionArgMap(*cv_1)); + fwrite(&l_priority, sizeof(l_priority), 1, i_file); + + if (CALLOUT_SELF != cv_type) + { + uint32_t l_arg = htonl(prdrActionArgMap(*cv_2)); + fwrite(&l_arg, sizeof(l_arg), 1, i_file); + + l_arg = htonl(cv_3); + fwrite(&l_arg, sizeof(l_arg), 1, i_file); + // Write bool for ALT resolution. + l_op = (NULL == cv_alt ? 0 : 1); + fwrite(&l_op, 1, 1, i_file); + + // Write ALT resolution. + if (NULL != cv_alt) + cv_alt->output(i_file); + } + + return 0; + }; + + void generateDoxygen(std::ostream & o_stream, + std::string & o_trailing, + std::ostream & o_errFile = std::cerr) + { + o_stream << "callout ( "; + if (CALLOUT_SELF == cv_type) + { + o_stream << "SELF, " << *cv_1 << " )"; + } + else if (CALLOUT_PROC == cv_type) + { + o_stream << "procedure ( " << *cv_2 << " ), " << *cv_1 << " ) "; + } + else + { + o_stream << "connected ( " << *cv_2 ; + if ( 0xffffffff != cv_3 ) + o_stream << ", " << cv_3; + o_stream << " ), " << *cv_1 << " ) "; + } + } + +}; + +class PrdrExprAct_Funccall : public PrdrExpr +{ + public: + std::string * cv_1, * cv_2; + + PrdrExprAct_Funccall(std::string * i_1, std::string * i_2 = NULL) : + cv_1(i_1), cv_2(i_2) {}; + + int output(FILE * i_file) + { + char l_op; + + l_op = Prdr::ACT_FUNC; + fwrite(&l_op, 1, 1, i_file); + + if ('"' == (*cv_1)[0]) + (*cv_1) = cv_1->substr(1, cv_1->size() - 2); + fwrite(cv_1->c_str(), cv_1->size() + 1, 1, i_file); + + uint32_t l_chip; + if (NULL != cv_2) + l_chip = htonl(prdrActionArgMap(*cv_2)); + else + l_chip = 0; + fwrite(&l_chip, sizeof(l_chip), 1, i_file); + + return 0; + }; + + void generateDoxygen(std::ostream & o_stream, + std::string & o_trailing, + std::ostream & o_errFile = std::cerr) + { + o_stream << "funccall( " << *cv_1; + if (NULL != cv_2) + o_stream << ", " << *cv_2; + o_stream << " ) "; + }; + + +}; + +class PrdrExprAct_Flag : public PrdrExpr +{ + public: + std::string * cv_1; + + PrdrExprAct_Flag(std::string * i_1) : cv_1(i_1) {}; + + int output(FILE * i_file) + { + char l_op; + + l_op = Prdr::ACT_FLAG; + fwrite(&l_op, 1, 1, i_file); + + uint32_t l_flag = htonl(prdrActionArgMap(*cv_1)); + fwrite(&l_flag, sizeof(l_flag), 1, i_file); + + return 0; + }; + + void generateDoxygen(std::ostream & o_stream, + std::string & o_trailing, + std::ostream & o_errFile = std::cerr) + { + o_stream << "flag( " << *cv_1 << " ) "; + }; + + +}; + +class PrdrExprAct_Capture : public PrdrExpr +{ + public: + std::string * cv_1; + + PrdrExprAct_Capture(std::string * i_1) : cv_1(i_1) {}; + + int output(FILE * i_file) + { + char l_op; + + l_op = Prdr::ACT_CAPT; + fwrite(&l_op, 1, 1, i_file); + + uint32_t l_group = htonl(prdrCaptureGroupMap(*cv_1)); + fwrite(&l_group, sizeof(l_group), 1, i_file); + + return 0; + }; + + void generateDoxygen(std::ostream & o_stream, + std::string & o_trailing, + std::ostream & o_errFile = std::cerr) + { + o_stream << "capture( " << *cv_1 << " ) "; + }; + + +}; + + +extern std::map<std::string, PrdrExpr *> g_rules; + +typedef std::pair<std::string, std::string> PrdrRefPair; +extern std::list<PrdrRefPair> g_references; + +#endif + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// F494911 f310 03/04/05 iawillia Initial File Creation +// D515833 f300 09/19/05 iawillia Add capture support. +// F526728 f300 10/25/05 iawillia Add >> and << registers. +// F534311 f300 01/10/06 iawillia Add bit string expression. +// F544848 f300 04/03/06 iawillia Add multi-bit support. +// F549888 f300 05/01/06 iawillia Add Proc. CS attention. +// ecdf F550548 f300 05/04/06 iawillia eClipz DUMP flags support. +// D555348 f310 06/05/06 iawillia Update HTML generation. +// jl02 F605874 f330 07/31/07 lukas Add functions to PRD framework/Galaxy +// 2 code for unit CS. +// @jl04 F630836 f330 09/17/07 lukas Add error log Cap. type. +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/rule/prdrGroup.H b/src/usr/diag/prdf/common/framework/rule/prdrGroup.H new file mode 100755 index 000000000..5d310ba9b --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdrGroup.H @@ -0,0 +1,247 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdrGroup.H $ */ +/* */ +/* 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 */ + +#ifndef __PRDRGROUP_H +#define __PRDRGROUP_H + +#include <string> +#include <list> +#include <netinet/in.h> + +#include <prdrExpr.H> +#include <prdrCommon.H> + +class PrdrChip; +extern PrdrChip * g_currentChip; +extern uint32_t g_nextAndBit; +class PrdrGroup_Filter; + +class PrdrGroup +{ + public: + std::list<PrdrExpr *> cv_rules; + PrdrExpr * cv_priorityList; + + char cv_op; + uint8_t cv_flags; + std::string cv_doxcomment; + + PrdrGroup() : + cv_priorityList(NULL), + cv_op(Prdr::GROUP), + cv_flags(0), + cv_doxcomment() {}; + PrdrGroup(char o) : + cv_priorityList(NULL), + cv_op(o), + cv_flags(0), + cv_doxcomment() {}; + + static void merge(PrdrGroup * i_l, PrdrGroup * i_r) + { + // Copy over rules. + i_l->cv_rules.insert(i_l->cv_rules.end(), + i_r->cv_rules.begin(), + i_r->cv_rules.end()); + + // Merge flags. + i_l->cv_flags |= i_r->cv_flags; + + // Set Priority list. + if (NULL != i_l->cv_priorityList) + i_r->cv_priorityList = i_l->cv_priorityList; + + }; + + void setComment(std::string & i_comment) + { + if (Prdr::GROUP == cv_op) + { + PrdrExpr * l_front = *(cv_rules.begin()); + if (NULL == l_front) + { + // ICE. + } + else + { + l_front->setComment(i_comment); + } + } + else if (Prdr::ACTION == cv_op) + { + cv_doxcomment = i_comment; + } + }; + + + void generateDoxygen(std::ostream & o_stream, + std::string i_name, + std::ostream & o_errFile = std::cerr) + { + std::string l_trailingInfo = ""; + + if (Prdr::GROUP == cv_op) + { + o_stream << "<H3><A NAME='" + i_name + "'>" + << i_name << "</A></H3>"; + + o_stream << "<TABLE><THEAD>" + << "<TR><TH colspan=\"4\" align=\"left\">" + << "Register Group: " << i_name + << "</TR>" << std::endl; + + o_stream << "<TR><TH width=\"7%\">Bit(s)<TH width=\"25%\">" + << "Name<TH width=\"50%\">Short Description" + << "<TH width=\"18%\">Actions</TR>" + << "</THEAD><TBODY>" + << std::endl; + + g_nextAndBit = 64; + } + else if (Prdr::ACTION == cv_op) + { + o_stream << "<TR>"; + o_stream << "<TD><P><A NAME='" << i_name << "'>" + << i_name << "</A></P></TD> "; + o_stream << "<TD>"; + if (std::string() != cv_doxcomment) + { + o_stream << cv_doxcomment; + } + o_stream << "</TD>"; + + o_stream << "<TD>" << std::endl; + } + + for (std::list<PrdrExpr *>::iterator i = cv_rules.begin(); + i != cv_rules.end(); + i++) + { + if (Prdr::GROUP == cv_op) + { + o_stream << "<TR>"; + } + else if (Prdr::ACTION == cv_op) + { + if (i != cv_rules.begin()) + o_stream << "<BR>" << std::endl; + + } + (*i)->generateDoxygen(o_stream, l_trailingInfo, o_errFile); + if (Prdr::GROUP == cv_op) + { + o_stream << "</TR>" << std::endl; + } + + } + if (Prdr::GROUP == cv_op) + { + o_stream << "</TBODY></TABLE><BR>" << std::endl; + o_stream << l_trailingInfo << std::endl; + o_stream << "</A>"; + } + else if (Prdr::ACTION == cv_op) + { + o_stream << "</TD></TR>" << std::endl; + } + }; + + int output(FILE * i_file) + { + fwrite(&cv_op, 1, 1, i_file); + + uint16_t l_ruleCount = htons(cv_rules.size()); + fwrite(&l_ruleCount, sizeof(l_ruleCount), 1, i_file); + + // Write flags for GROUP op. + if (Prdr::GROUP == cv_op) + { + fwrite(&cv_flags, 1, 1, i_file); + if (Prdr::PRDR_GROUP_FILTER_PRIORITY & cv_flags) + { + cv_priorityList->output(i_file); + } + } + + + for (std::list<PrdrExpr *>::iterator i = cv_rules.begin(); + i != cv_rules.end(); + i++) + { + (*i)->output(i_file); + } + + return 0; + }; + + +}; + +extern std::map<std::string, PrdrGroup *> g_groups; +extern std::map<std::string, PrdrGroup *> g_actionclasses; +extern std::map<std::string, std::string> g_attentionStartGroup; + +class PrdrGroup_Filter +{ + public: + virtual ~PrdrGroup_Filter() { } // zs01 + virtual void AddFilter(PrdrGroup *) = 0; +}; + +class PrdrGroup_Filter_SingleBit : public PrdrGroup_Filter +{ + public: + void AddFilter(PrdrGroup * i_group) + { + i_group->cv_flags |= Prdr::PRDR_GROUP_FILTER_SINGLE_BIT; + }; +}; + +class PrdrGroup_Filter_Priority : public PrdrGroup_Filter +{ + public: + PrdrGroup_Filter_Priority(PrdrExpr * i_list) : iv_list(i_list) {}; + + void AddFilter(PrdrGroup * i_group) + { + i_group->cv_flags |= Prdr::PRDR_GROUP_FILTER_PRIORITY; + i_group->cv_priorityList = iv_list; + }; + + private: + PrdrExpr * iv_list; +}; + + +#endif + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// F494911 f310 03/04/05 iawillia Initial File Creation +// F544848 f300 04/03/06 iawillia Add multi-bit support. +// D555348 f310 06/05/06 iawillia Update HTML generation. +// F557408 f310 06/16/06 iawillia Add single-bit filter support. +// zs01 D620028 f330 07/25/07 zshelle Support for mcp5 compiler +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/rule/prdrLoadChip.C b/src/usr/diag/prdf/common/framework/rule/prdrLoadChip.C new file mode 100755 index 000000000..dd76a6234 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdrLoadChip.C @@ -0,0 +1,505 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdrLoadChip.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 */ + +#include <string.h> // for memcmp +#include <prdrCommon.H> + +#include <prdrLoadChip.H> +#include <errlentry.H> +#include <utilstream.H> +#include <UtilFunct.H> + +#include <prdf_service_codes.H> +#include <prdfThresholdResolutions.H> +#include <iipglobl.h> +#include <UtilHash.H> // for Util::hashString + +#include <algorithm> // for std::generate_n + +namespace Prdr +{ + +void prdrReadExpr(UtilStream & i_stream, PrdrExpr & o_expr); + +// NOTE: caller must call delete[] to release the buffer +void prdrReadString(UtilStream & i_stream, char *& o_string) +{ + char l_pBuf[100]; + memset(l_pBuf,'\0',100); + char* l_pCursor = l_pBuf; + + char l_tmp; + + do + { + i_stream >> l_tmp; + if ('\0' != l_tmp) + { + *l_pCursor = l_tmp; + l_pCursor++; + } + } while ('\0' != l_tmp); + + o_string = new char[strlen(l_pBuf) + 1]; + strcpy(o_string, l_pBuf); +} + +/** + * @brief read bit string data out from the stream + */ +void prdrReadBitString(UtilStream & i_stream, std::vector<uint64_t> & o_vector) +{ + uint64_t l_tmp64; + uint8_t l_tmp8; + i_stream >> l_tmp8; + + int length = (l_tmp8 / 8) + ((l_tmp8 % 8) != 0 ? 1 : 0); + + for (int i = 0; i < (length/8); i++) + { + i_stream >> l_tmp64; + o_vector.push_back(l_tmp64); + } +} + +errlHndl_t prdrLoadChip(UtilStream & i_stream, PrdrChip & o_chip) +{ + errlHndl_t l_errl = NULL; + + do + { + char l_temp[8]; + + // read header. + i_stream >> l_temp; + if (0 != memcmp(l_temp, "PRDRCHIP", 8)) + { + PRDF_ERR("prdrLoadChip() bad chip file - l_temp: %s ", l_temp); + // Bad chip file. + /*@ + * @errortype + * @refcode LIC_REFCODE + * @subsys EPUB_FIRMWARE_SP + * @reasoncode PRDF_CODE_FAIL + * + * @moduleid PRDF_PRDRLOADCHIP + * @userdata1 0x50524452 ("PRDR") + * @userdata2 0x43484950 ("CHIP") + * @devdesc Attempted to load chip rule file that lacked + * the proper header "PRDRCHIP". + */ + PRDF_CREATE_ERRL(l_errl, + ERRL_SEV_UNRECOVERABLE, + ERRL_ETYPE_NOT_APPLICABLE, + SRCI_ERR_INFO, + SRCI_NO_ATTR, + PRDF_PRDRLOADCHIP, + LIC_REFCODE, + PRDF_CODE_FAIL, + 0x50524452, // PRDR + 0x43484950, // CHIP + 0, 0); + break; + } + + // read chip info. + i_stream >> o_chip.cv_chipId; + i_stream >> o_chip.cv_targetType; + i_stream >> o_chip.cv_signatureOffset; + i_stream >> o_chip.cv_dumpType; //@ecdf + i_stream >> o_chip.cv_scomLen; + + // read registers. + i_stream >> o_chip.cv_regCount; + + if (o_chip.cv_regCount != 0) + { + o_chip.cv_registers = new PrdrRegister[o_chip.cv_regCount]; + for (uint32_t i = 0; i < o_chip.cv_regCount; i++) + { + i_stream >> o_chip.cv_registers[i].cv_name; + i_stream >> o_chip.cv_registers[i].cv_flags; + i_stream >> o_chip.cv_registers[i].cv_scomAddr; + + if (o_chip.cv_registers[i].cv_flags & + Prdr::PRDR_REGISTER_SCOMLEN) + { + i_stream >> o_chip.cv_registers[i].cv_scomLen; + } + else + { + o_chip.cv_registers[i].cv_scomLen = o_chip.cv_scomLen; + } + + if (o_chip.cv_registers[i].cv_flags & + Prdr::PRDR_REGISTER_RESETS) + { + // Read 'n' from stream. Read that many reset structs out + // of the stream, insert into cv_resets for register. + std::generate_n( + std::back_inserter( + o_chip.cv_registers[i].cv_resets + ), + Util::unary_input<uint16_t, UtilStream>(i_stream)(), + Util::unary_input<PrdrRegister::ResetOrMaskStruct, + UtilStream> (i_stream) + ); + + } + + if (o_chip.cv_registers[i].cv_flags & + Prdr::PRDR_REGISTER_MASKS) + { + // Read 'n' from stream. Read that many mask structs out + // of the stream, insert into cv_masks for register. + std::generate_n( + std::back_inserter( + o_chip.cv_registers[i].cv_masks + ), + Util::unary_input<uint16_t, UtilStream>(i_stream)(), + Util::unary_input<PrdrRegister::ResetOrMaskStruct, + UtilStream> (i_stream) + ); + + } + + if (o_chip.cv_registers[i].cv_flags & + Prdr::PRDR_REGISTER_CAPTURE) + { + // Read 'n' from stream. Read that many mask structs out + // of the stream, insert into cv_masks for register. + std::generate_n( + std::back_inserter( + o_chip.cv_registers[i].cv_captures + ), + Util::unary_input<uint16_t, UtilStream>(i_stream)(), + Util::unary_input<PrdrRegister::CaptureInfoStruct, + UtilStream> (i_stream) + ); + } + } + } + + // read rules. + i_stream >> o_chip.cv_ruleCount; + if (o_chip.cv_ruleCount != 0) + { + o_chip.cv_rules = new PrdrExpr[o_chip.cv_ruleCount]; + for (uint32_t i = 0; i < o_chip.cv_ruleCount; i++) + { + i_stream >> l_temp[0]; // should be 'R' + prdrReadExpr(i_stream, o_chip.cv_rules[i]); + } + } + + // read groups. + i_stream >> o_chip.cv_groupCount; + for (int i = 0; i < NUM_GROUP_ATTN; i++) // @jl02 JL Added this enum type for the number of Attention types. + i_stream >> o_chip.cv_groupAttn[i]; + if (o_chip.cv_groupCount != 0) + { + o_chip.cv_groups = new PrdrExpr * [o_chip.cv_groupCount]; + o_chip.cv_groupSize = new uint16_t[o_chip.cv_groupCount]; + o_chip.cv_groupFlags = new uint8_t[o_chip.cv_groupCount]; + o_chip.cv_groupPriorityBits = new PrdrExpr * [o_chip.cv_groupCount]; + for (uint32_t i = 0; i < o_chip.cv_groupCount; i++) + { + i_stream >> l_temp[0]; // should be 'G' + i_stream >> o_chip.cv_groupSize[i]; + i_stream >> o_chip.cv_groupFlags[i]; + if (Prdr::PRDR_GROUP_FILTER_PRIORITY & o_chip.cv_groupFlags[i]) + { + o_chip.cv_groupPriorityBits[i] = new PrdrExpr(); + prdrReadExpr(i_stream, *o_chip.cv_groupPriorityBits[i]); + } + else + { + o_chip.cv_groupPriorityBits[i] = NULL; + } + if (0 != o_chip.cv_groupSize[i]) + { + o_chip.cv_groups[i] = new PrdrExpr[o_chip.cv_groupSize[i]]; + for (uint32_t j = 0; j < o_chip.cv_groupSize[i]; j++) + { + prdrReadExpr(i_stream, o_chip.cv_groups[i][j]); + if (Prdr::REF_RULE == o_chip.cv_groups[i][j].cv_op) + { + for (int k = 1; k <= 2; k++) + { + o_chip.cv_groups[i][j].cv_value[k].p = + new PrdrExpr(); + o_chip.cv_groups[i][j].cv_deletePtr[k] = true; + + prdrReadExpr(i_stream, + *o_chip.cv_groups[i][j].cv_value[k].p); + } + } + } + } + else + { + o_chip.cv_groups[i] = new PrdrExpr[0]; /*accessing beyond memory*/ + // False error BEAM. + }; + } + } + + // read actions. + i_stream >> o_chip.cv_actionCount; + if (o_chip.cv_actionCount != 0) + { + o_chip.cv_actions = new PrdrExpr * [o_chip.cv_actionCount]; + o_chip.cv_actionSize = new uint16_t[o_chip.cv_actionCount]; + for (uint32_t i = 0; i < o_chip.cv_actionCount; i++) + { + i_stream >> l_temp[0]; // should be 'A' + i_stream >> o_chip.cv_actionSize[i]; + if (0 != o_chip.cv_actionSize[i]) + { + o_chip.cv_actions[i] = + new PrdrExpr[o_chip.cv_actionSize[i]]; + for (uint32_t j = 0; j < o_chip.cv_actionSize[i]; j++) + { + prdrReadExpr(i_stream, o_chip.cv_actions[i][j]); + } + } + else //@pw01 + { + o_chip.cv_actions[i] = NULL; + } + } + } + + } while (false); + + if (NULL == l_errl) + l_errl = i_stream.getLastError(); + + return l_errl; +} + +void prdrReadExpr(UtilStream & i_stream, PrdrExpr & o_expr) +{ + unsigned char l_tmpChar; + uint32_t l_tmp32; + uint16_t l_tmp16; + uint8_t l_tmp8; + bool l_tmpBool; + + i_stream >> o_expr.cv_op; + + switch(o_expr.cv_op) + { + case Prdr::AND: + case Prdr::OR: + case Prdr::XOR: + case Prdr::LSHIFT: + case Prdr::RSHIFT: + case Prdr::ACT_TRY: + o_expr.cv_value[0].p = new PrdrExpr(); + o_expr.cv_deletePtr[0] = true; + prdrReadExpr(i_stream, *o_expr.cv_value[0].p); + + o_expr.cv_value[1].p = new PrdrExpr(); + o_expr.cv_deletePtr[1] = true; + prdrReadExpr(i_stream, *o_expr.cv_value[1].p); + break; + + case Prdr::NOT: + o_expr.cv_value[0].p = new PrdrExpr(); + o_expr.cv_deletePtr[0] = true; + prdrReadExpr(i_stream, *o_expr.cv_value[0].p); + break; + + case Prdr::INTEGER: + case Prdr::ACT_GARD: + case Prdr::ACT_FLAG: + i_stream >> o_expr.cv_value[0].i; + break; + + case Prdr::REF_RULE: + case Prdr::REF_REG: + case Prdr::REF_GRP: + case Prdr::REF_ACT: + case Prdr::INT_SHORT: + i_stream >> l_tmp16; + o_expr.cv_value[0].i = l_tmp16; + break; + + case Prdr::BIT_STR: + o_expr.cv_bitStrVect.clear(); + prdrReadBitString(i_stream, o_expr.cv_bitStrVect); + break; + + case Prdr::ACT_THRES: + o_expr.cv_value[0].i = ThresholdResolution::cv_fieldDefault.interval; + o_expr.cv_value[1].i = ThresholdResolution::cv_fieldDefault.threshold; + o_expr.cv_value[2].i = ThresholdResolution::cv_mnfgDefault.interval; + o_expr.cv_value[3].i = ThresholdResolution::cv_mnfgDefault.threshold; + //The syntax of thresholds in rule file is + // op field_threshold field_intervale + //optional fields (mnfg_threshold, mnfg_interval } | mnfg_ilr_threshold | maskid + i_stream >> l_tmpChar; + l_tmpBool = (0x40 == (0x40 & l_tmpChar)); + l_tmpChar &= (~0x40); + o_expr.cv_value[4].i = (0x20 == (0x20 & l_tmpChar)); + l_tmpChar &= (~0x20); + // The values which different parameter will have + // cv_value[0,1] error frequency and time in sec for field threshold + //cv_value[4] true if mnfg threshols needs to be picked up from mnfg file, false otherwise + // cv_value [2, 3]: error frequency and time in sec for mnfg threshold if cv_value[4] is false + // otherwise cv_value[3] tells which threshold needs to pick up from mnfg file + // cv_value[5] maski id if shared threshold + if (0 != l_tmpChar) + for (uint8_t i = 0; i < l_tmpChar; i++) + { + if ( (1 != i) || (0 == o_expr.cv_value[4].i) ) + { + //entry has errorFrequency + i_stream >> l_tmp8; + o_expr.cv_value[2*i].i = l_tmp8; + } + i_stream >> o_expr.cv_value[2*i + 1].i; + } + if (l_tmpBool) + i_stream >> o_expr.cv_value[5]; + break; + + case Prdr::ACT_ANALY: + i_stream >> o_expr.cv_value[0].i; + i_stream >> o_expr.cv_value[1].i; + break; + + case Prdr::ACT_FUNC: + o_expr.cv_actFunc = NULL; + prdrReadString(i_stream, o_expr.cv_actFunc); + + i_stream >> o_expr.cv_value[1].i; + break; + + case Prdr::ACT_CALL: + i_stream >> l_tmpChar; + o_expr.cv_value[0].i = l_tmpChar; + i_stream >> o_expr.cv_value[1].i; + if ('s' != o_expr.cv_value[0].i) + { + i_stream >> o_expr.cv_value[2].i; + i_stream >> o_expr.cv_value[3].i; + + // Read ALT bool. + i_stream >> l_tmpChar; + if (0 != l_tmpChar) + { + o_expr.cv_value[4].p = new PrdrExpr(); + o_expr.cv_deletePtr[4] = true; + prdrReadExpr(i_stream, *o_expr.cv_value[4].p); + } + else + o_expr.cv_value[4].p = NULL; + } + break; + + case Prdr::ACT_DUMP: //@ecdf + i_stream >> o_expr.cv_value[0].i; + break; + + case Prdr::ATTNLINK: + i_stream >> l_tmpChar; // get count + l_tmp32 = l_tmpChar; + for (size_t i = 0; i < l_tmp32; i++) + { + i_stream >> l_tmpChar; // get index + o_expr.cv_value[l_tmpChar].p = new PrdrExpr(); + o_expr.cv_deletePtr[l_tmpChar] = true; + prdrReadExpr(i_stream, *o_expr.cv_value[l_tmpChar].p); + } + break; + + case Prdr::ACT_CAPT: + i_stream >> o_expr.cv_value[0].i; + + default: + break; + } +} + +PrdrRegister::PrdrRegister() : cv_name(0) +{} + +PrdrRegister::~PrdrRegister() +{ + for(std::vector<CaptureInfoStruct>::iterator + j = cv_captures.begin(); + j != cv_captures.end(); + ++j) + { + if (NULL != (*j).func) + { + delete[] (*j).func; + (*j).func = NULL; + } + } +} + +PrdrExpr::PrdrExpr() +{ + cv_op = 0; + cv_actFunc = NULL; + // Clear out the pointers and 'delete' settings. + for (uint32_t i = 0; i < MAX_VALUES; i++) + { + cv_deletePtr[i] = false; + cv_value[i].p = NULL; + } +} + +PrdrExpr::~PrdrExpr() +{ + // Special things for certain operator types... + switch (cv_op) + { + // On function call operator and bit string, + // cv_value[0].p points to a string. + case Prdr::ACT_FUNC: + if(NULL != cv_actFunc) + { + delete[] cv_actFunc; + cv_actFunc = NULL; + } + break; + case Prdr::BIT_STR: + cv_bitStrVect.clear(); + break; + + // No other special cases yet. + default: + break; + } + + // Delete all pointers. + for (uint32_t i = 0; i < MAX_VALUES; i++) + if (cv_deletePtr[i]) + delete (cv_value[i].p); +}; + +} // end namespace. diff --git a/src/usr/diag/prdf/common/framework/rule/prdrLoadChip.H b/src/usr/diag/prdf/common/framework/rule/prdrLoadChip.H new file mode 100755 index 000000000..4a54e5f1e --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdrLoadChip.H @@ -0,0 +1,240 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdrLoadChip.H $ */ +/* */ +/* 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 */ + +#ifndef __PRDRLOADCHIP_H +#define __PRDRLOADCHIP_H + +/** + * @file prdrLoadChip.H + * @brief Describes classes and enums needed to load a .prf file. + */ + + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#include <stdint.h> + +#include <errlentry.H> +#include <utilstream.H> + +#include <vector> + +#include <prdrCommon.H> +#include <targeting/common/target.H> + +//-------------------------------------------------------------------- + +/** + * @namespace Prdr + * @brief Namespace to encapsulate Prdr specific enums, classes, and typedefs. + */ +namespace Prdr +{ + /** + * @brief read string data out from the stream + * @note caller must call delete[] to release the buffer + */ + void prdrReadString(UtilStream & i_stream, char *& o_string); + + /** + * @class PrdrRegister + * @brief Holds data associated with a register. + */ + class PrdrRegister + { + public: + uint16_t cv_name; /** hash id of Register Short Name */ + + uint32_t cv_flags; /** Attribute flags */ + + uint64_t cv_scomAddr; /** Scom Address */ + uint16_t cv_scomLen; /** Scom Length */ + + PrdrRegister(); + ~PrdrRegister(); + + struct ResetOrMaskStruct + { + char op; + uint64_t addr_r; + uint64_t addr_w; + + friend UtilStream& operator>>(UtilStream& i_left, + ResetOrMaskStruct & i_right) + { + return (i_left >> i_right.op + >> i_right.addr_r + >> i_right.addr_w); + }; + }; + + std::vector<ResetOrMaskStruct> cv_resets; + std::vector<ResetOrMaskStruct> cv_masks; + + struct CaptureInfoStruct + { + uint8_t op; + uint32_t data[2]; + char * func; + + friend UtilStream& operator>>(UtilStream& i_left, + CaptureInfoStruct & i_right) + { + i_left >> i_right.op; + int loopMax = 0; + switch (i_right.op) + { + case 'G': + case 'T': + loopMax = 1; + break; + + case 'C': + loopMax = 2; + break; + + case 'f': + loopMax = 0; + break; + } + + for (int i = 0; i < loopMax; i++) + i_left >> i_right.data[i]; + + i_right.func = NULL; + if ('f' == i_right.op) + { + prdrReadString(i_left, i_right.func); + } + + return i_left; + } + }; + + std::vector<CaptureInfoStruct> cv_captures; + + }; + + /** + * @class PrdrExpr + * @brief Contains data for the basic rule object, the "expression". + */ + class PrdrExpr + { + public: + union value { uint32_t i; PrdrExpr * p; }; + + /** Maximum number of entries a expression can have. */ + static const uint32_t MAX_VALUES = 6; + + unsigned char cv_op; /** Type of expr this is. */ + + // Arrays for the expression entries. cv_deletePtr remembers if + // the p-value should be 'deleted' when we destruct this object. + bool cv_deletePtr[MAX_VALUES]; + value cv_value[MAX_VALUES]; + + // action function pointer + char * cv_actFunc; + // vector of bit string data + std::vector<uint64_t> cv_bitStrVect; + + /** + * @func PrdrExpr() + * @brief Default constructor. Clear entry arrays. + */ + PrdrExpr(); + + /** + * @func ~PrdrExpr() + * @brief Default destructor. Delete all attached pointers, as + * requested. + */ + ~PrdrExpr(); + + private: + // Don't let us copy these things, we don't want to mess with the + // pointer tree. + PrdrExpr(const PrdrExpr & i_copy) {}; + }; + + class PrdrChip + { + public: + uint32_t cv_chipId; + TARGETING::TYPE cv_targetType; + uint32_t cv_signatureOffset; // Offset for error register ids. + uint32_t cv_dumpType; // default dump content type. + uint16_t cv_scomLen; // default scom length. + uint16_t cv_regCount; + PrdrRegister * cv_registers; + uint16_t cv_ruleCount; + PrdrExpr * cv_rules; + uint16_t cv_groupCount; + uint16_t cv_groupAttn[NUM_GROUP_ATTN]; + uint16_t * cv_groupSize; + uint8_t * cv_groupFlags; + PrdrExpr ** cv_groupPriorityBits; + PrdrExpr ** cv_groups; + uint16_t cv_actionCount; + uint16_t * cv_actionSize; + PrdrExpr ** cv_actions; + + PrdrChip() : cv_regCount(0), cv_registers(NULL), + cv_ruleCount(0), cv_rules(NULL), + cv_groupCount(0), cv_groupSize(NULL), + cv_groupFlags(NULL), cv_groupPriorityBits(NULL), + cv_groups(NULL), + cv_actionCount(0), cv_actionSize(NULL), + cv_actions(NULL) + { + }; + + ~PrdrChip() + { + if (NULL != cv_registers) delete[] cv_registers; + if (NULL != cv_rules) delete[] cv_rules; + for (int i = 0; i < cv_groupCount; i++) + { + if (NULL != cv_groupPriorityBits[i]) + delete cv_groupPriorityBits[i]; + if (NULL != cv_groups[i]) + delete[] cv_groups[i]; + } + if (NULL != cv_groups) delete[] cv_groups; + if (NULL != cv_groupSize) delete[] cv_groupSize; + if (NULL != cv_groupFlags) delete[] cv_groupFlags; + if (NULL != cv_groupPriorityBits) delete[] cv_groupPriorityBits; + for (int i = 0; i < cv_actionCount; i++) + if (NULL != cv_actions[i]) delete[] cv_actions[i]; + if (NULL != cv_actions) delete[] cv_actions; + if (NULL != cv_actionSize) delete[] cv_actionSize; + }; + }; + + errlHndl_t prdrLoadChip(UtilStream & i_stream, PrdrChip & o_chip); + +}; +#endif diff --git a/src/usr/diag/prdf/common/framework/rule/prdrLoadChipCache.C b/src/usr/diag/prdf/common/framework/rule/prdrLoadChipCache.C new file mode 100755 index 000000000..a23e286aa --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdrLoadChipCache.C @@ -0,0 +1,170 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdrLoadChipCache.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2006,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 __HOSTBOOT_MODULE + +#include <utilreg.H> // for UtilReg + +#endif + + +#include <string.h> // for strncat +#include <prdrLoadChipCache.H> +#include <utilfile.H> +#include <prdfTrace.H> + +namespace Prdr +{ + // Declare private member instance. + LoadChipCache::Cache_t LoadChipCache::cv_cache; + + //--------------------------------------------------------------------- + void LoadChipCache::flushCache() + { + // Delete all objects within the cache. + for (Cache_t::iterator i = cv_cache.begin(); + i != cv_cache.end(); + ++i) + { + if (NULL != i->second) + delete (PrdrChip*)i->second; + } + + // Clear map. + cv_cache.clear(); + }; + //--------------------------------------------------------------------- + + //--------------------------------------------------------------------- + errlHndl_t LoadChipCache::loadChip(const char * i_file, + PrdrChip ** o_chip) + { + errlHndl_t l_errl = NULL; + *o_chip = NULL; + + Cache_t::iterator i = cv_cache.find(i_file); + + if (cv_cache.end() != i) // Found object in cache. + { + (*o_chip) = (PrdrChip*)(*i).second; + l_errl = NULL; + } + else + { + (*o_chip) = new PrdrChip; + + do + { + // NOTE: to patch PRF files require rebuilding + // entire Hostboot image and put in a special + // location on FSP /nfs mount. + // FIXME: if we need to patch prf files directly + // on Hostboot, need to discuss with Patrick + // about a possibility of creating a new PNOR + // partition outside of the cryptographically + // signed area just for PRD. + +#ifdef __HOSTBOOT_MODULE + + char* l_filePathName; + size_t l_filePathSize = strlen(i_file) + 4 + 1; // 4 is for ".prf" + l_filePathName = new char[l_filePathSize]; + strcpy(l_filePathName, i_file); + strncat(l_filePathName, ".prf", l_filePathSize-1); + + UtilFile l_ruleFile(l_filePathName); + if (!l_ruleFile.exists()) + { + // FIXME: do we need to log and commit an error here? + PRDF_ERR("LoadChipCache::loadChip() failed to find %s", l_filePathName); + } + else + { + l_ruleFile.Open("r"); + } + + delete[] l_filePathName; + +#else + + // Read the correct directory path for flash. + size_t l_rootPathSize = 256; + char l_rootPath[256] = { '\0' }; + l_errl = UtilReg::read("fstp/RO_Root", + (void *) l_rootPath, + l_rootPathSize); + strncat(l_rootPath, "prdf/", 255); + strncat(l_rootPath, i_file, 255); + strncat(l_rootPath, ".prf", 255); + + if (NULL != l_errl) break; + + // Read /nfs/data/... directory path + size_t l_nfsPathSize = 256; + char l_nfsPath[256] = { '\0' }; + l_errl = UtilReg::read("fstp/NFS_Root", + (void *) l_nfsPath, + l_nfsPathSize); + + strncat(l_nfsPath, "prdf/", 255); + strncat(l_nfsPath, i_file, 255); + strncat(l_nfsPath, ".prf", 255); + + if (NULL != l_errl) break; + + // Open File to read chip. + UtilFile l_ruleFile(l_nfsPath); + if (!l_ruleFile.exists()) // check for NFS file. + { + l_ruleFile.Open(l_rootPath, "r"); + } + else + { + l_ruleFile.Open("r"); + } + +#endif + // Load chip object. + l_errl = Prdr::prdrLoadChip(l_ruleFile, *(*o_chip)); + + } while (0); + + if (NULL == l_errl) + { + // Add chip object to the cache. + cv_cache[i_file] = *o_chip; + } + else + { + PRDF_ERR("LoadChipCache::loadChip() l_errl is not null!"); + delete *o_chip; + (*o_chip) = NULL; + } + + } + + return l_errl; + + }; + //--------------------------------------------------------------------- +} diff --git a/src/usr/diag/prdf/common/framework/rule/prdrLoadChipCache.H b/src/usr/diag/prdf/common/framework/rule/prdrLoadChipCache.H new file mode 100755 index 000000000..16ecb5762 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdrLoadChipCache.H @@ -0,0 +1,82 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdrLoadChipCache.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2006,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 prdrLoadChipCache.H + * @brief Contains class information for a rule-chip loader cache. + */ + +#include <errlentry.H> +#include <prdrLoadChip.H> +#include <map> +#include <prdfPluginMap.H> + +namespace Prdr +{ + /** + * @class LoadChipCache + * @brief Creates a cache of the .prf rule-chips so the files only need to + * be parsed a single time. + */ + class LoadChipCache + { + public: + /** + * @fn flushCache + * @brief Clears any objects within the cache and frees all memory + * associated with them. + * + * @note After this call any pointers obtained from 'loadChip' are + * invalid. + */ + static void flushCache(); + + /** + * @fn loadChip + * @brief Loads a .prf file specified and returns a pointer to an + * associated chip object. + * + * This function will first look in NFS and then in flash for an + * associated chip file, assuming the object was not already in + * the cache. + * + * Any pointer returned should not be deleted. Its memory will be + * freed after the call to 'flushCache'. + * + * @param i_file - File name to open, eg. "SomeIoChip.prf". + * @param o_chip - Pointer to the object loaded from the file or + * retrieved from the cache. + * + * @note Caller must check o_chip for NULL pointers, indicating that + * the chip file could not be found / loaded. + * + * @retuns errlHndl_t - In the event of a registry or file failure. + */ + static errlHndl_t loadChip(const char * i_file, PrdrChip ** o_chip); + + private: + /** The file cache. */ + typedef std::map<const char *, PrdrChip *, PrdfStrCompare> Cache_t; + static Cache_t cv_cache; + }; +}; diff --git a/src/usr/diag/prdf/common/framework/rule/prdrRegister.H b/src/usr/diag/prdf/common/framework/rule/prdrRegister.H new file mode 100755 index 000000000..ac005899b --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdrRegister.H @@ -0,0 +1,300 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdrRegister.H $ */ +/* */ +/* 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 */ + +#ifndef __PRDRREGISTER_H +#define __PRDRREGISTER_H + +#include <stdio.h> +#include <string.h> +#include <algorithm> + +#include <string> +#include <list> + +#include <stdint.h> + +#include <iostream> +#include <iomanip> +#include <netinet/in.h> + +// define needed to enable x86 rule parser code only +#define __PRD_RULE_COMPILE +#include <prdrCommon.H> +#include <UtilHash.H> + +#ifdef __HOSTBOOT_MODULE + #include <endian.h> + # define htonll(x) htobe64(x) +#else + #include <utilendian.H> +#endif + +extern Prdr::HashCollisionMap g_regsHashCollision; +extern bool g_hadError; + +struct PrdrResetOrMaskStruct +{ + uint8_t type; + uint64_t addr_r; + uint64_t addr_w; + + void output(FILE * l_file) + { + fwrite(&type, 1, 1, l_file); + + uint64_t l_tmp64; + + l_tmp64 = htonll(addr_r); + fwrite(&l_tmp64, sizeof (l_tmp64), 1, l_file); + + l_tmp64 = htonll(addr_w); + fwrite(&l_tmp64, sizeof (l_tmp64), 1, l_file); + } +}; + +struct PrdrCaptureReqStruct +{ + uint8_t type; + uint32_t data[2]; + std::string str; + + enum + { + PRDR_CAPTURE_GROUPID = 'G', + PRDR_CAPTURE_CONN = 'C', + PRDR_CAPTURE_FUNC = 'f', + PRDR_CAPTURE_TYPE = 'T', // Added this for storing a register's type in the capture struct. + }; + + void output(FILE * l_file) + { + fwrite(&type, 1, 1, l_file); + uint32_t l_tmp32; + + int loopMax = 0; + + switch (type) + { + case PRDR_CAPTURE_GROUPID: + case PRDR_CAPTURE_TYPE: + loopMax = 1; + break; + + case PRDR_CAPTURE_CONN: + loopMax = 2; + break; + + case PRDR_CAPTURE_FUNC: + loopMax = 0; + break; + } + + for (int i = 0; i < loopMax; i++) + { + l_tmp32 = htonl(data[i]); + fwrite(&l_tmp32, 4, 1, l_file); + } + if (type == PRDR_CAPTURE_FUNC) + { + if ('"' == (str)[0]) + str = str.substr(1, str.size() - 2); + fwrite(str.c_str(), str.size() + 1, 1, l_file); + } + }; +}; + +class PrdrRegister +{ + public: + + std::string * cv_sname; + std::string * cv_name; + + uint32_t cv_flags; + + uint64_t cv_scomaddr; + uint16_t cv_scomlen; + + std::string cv_name_default; + + std::list<PrdrResetOrMaskStruct> cv_resets; + std::list<PrdrResetOrMaskStruct> cv_masks; + + std::list<PrdrCaptureReqStruct> cv_captures; + + PrdrRegister() : + cv_sname(NULL), + cv_name(&cv_name_default), + cv_flags(0), + cv_scomaddr(0), + cv_scomlen(0), + cv_resets(0), cv_masks(0), cv_captures(0) + {}; + + static void merge(PrdrRegister * i_l, PrdrRegister * i_r) + { + if (NULL != i_r->cv_sname) + i_l->cv_sname = i_r->cv_sname; + if (&i_r->cv_name_default != i_r->cv_name) + i_l->cv_name = i_r->cv_name; + if (0 != i_r->cv_flags) + i_l->cv_flags = i_r->cv_flags; + if (0 != i_r->cv_scomaddr) + i_l->cv_scomaddr = i_r->cv_scomaddr; + if (0 != i_r->cv_scomlen) + i_l->cv_scomlen = i_r->cv_scomlen; + if (0 != i_r->cv_resets.size()) + { + std::copy( i_r->cv_resets.begin(), + i_r->cv_resets.end(), + std::back_inserter(i_l->cv_resets) ); + } + if (0 != i_r->cv_masks.size()) + { + std::copy( i_r->cv_masks.begin(), + i_r->cv_masks.end(), + std::back_inserter(i_l->cv_masks) ); + } + if (0 != i_r->cv_captures.size()) + { + std::copy( i_r->cv_captures.begin(), + i_r->cv_captures.end(), + std::back_inserter(i_l->cv_captures) ); + } + }; + + void print() + { + using std::cout; + using std::endl; + cout << "Register " << *cv_sname << ":" << endl; + cout << "\tLong Name: " << *cv_name << endl; + cout << "\tScom Addr: " << cv_scomaddr << endl; + cout << "\tScom Len: " << cv_scomlen << endl; + }; + + int output( FILE * l_file, uint16_t i_sigOff ) + { + // Check for hash collisions + uint16_t hash = Util::hashString( cv_sname->c_str() ) ^ i_sigOff; + Prdr::HashCollisionMap::iterator i = g_regsHashCollision.find(hash); + if ( g_regsHashCollision.end() != i ) + { + g_hadError = true; // Compile error + + std::cerr << "Register hash collision '" << *cv_sname << "' " + << std::hex << "[0x" + << std::setfill('0') << std::setw(4) + << hash << "]"; + + if ( 0 != cv_sname->compare(i->second) ) + { + std::cerr << ": previous register was '" << i->second << "'"; + } + + std::cerr << std::endl; + } + g_regsHashCollision[hash] = (*cv_sname); + + // Setup flags + if (0 != cv_resets.size()) + cv_flags |= Prdr::PRDR_REGISTER_RESETS; + if (0 != cv_masks.size()) + cv_flags |= Prdr::PRDR_REGISTER_MASKS; + if (0 != cv_captures.size()) + cv_flags |= Prdr::PRDR_REGISTER_CAPTURE; + + // output data + uint32_t l_temp; + uint16_t l_temp16; + + l_temp16 = htons(Util::hashString( cv_sname->c_str() )); + fwrite(&l_temp16, sizeof(l_temp16), 1, l_file); + + l_temp = htonl(cv_flags); + fwrite(&l_temp, sizeof(l_temp), 1, l_file); + + uint64_t l_temp64 = htonll(cv_scomaddr); + fwrite(&l_temp64, sizeof(l_temp64), 1, l_file); + + if (cv_flags & Prdr::PRDR_REGISTER_SCOMLEN) + { + l_temp16 = htons(cv_scomlen); + fwrite(&l_temp16, sizeof(l_temp16), 1, l_file); + } + + if (cv_flags & Prdr::PRDR_REGISTER_RESETS) + { + l_temp16 = htons(cv_resets.size()); + fwrite(&l_temp16, sizeof(l_temp16), 1, l_file); + + std::for_each( cv_resets.begin(), cv_resets.end(), + std::bind2nd( + std::mem_fun_ref(&PrdrResetOrMaskStruct::output), + l_file) ); + } + + if (cv_flags & Prdr::PRDR_REGISTER_MASKS) + { + l_temp16 = htons(cv_masks.size()); + fwrite(&l_temp16, sizeof(l_temp16), 1, l_file); + + std::for_each( cv_masks.begin(), cv_masks.end(), + std::bind2nd( + std::mem_fun_ref(&PrdrResetOrMaskStruct::output), + l_file) ); + } + + if (cv_flags & Prdr::PRDR_REGISTER_CAPTURE) + { + l_temp16 = htons(cv_captures.size()); + fwrite(&l_temp16, sizeof(l_temp16), 1, l_file); + + std::for_each( cv_captures.begin(), cv_captures.end(), + std::bind2nd( + std::mem_fun_ref(&PrdrCaptureReqStruct::output), + l_file) ); + } + + return 0; + }; + + void outputRegisterFile(std::ostream & o_file, uint16_t i_sigOff) + { + uint16_t hash = Util::hashString( cv_sname->c_str() ) ^ i_sigOff; + + o_file << "\tPRDR_REGISTER_ID ( " + << std::hex + << "0x" << std::setfill('0') << std::setw(4) + << hash << ", " + << *cv_sname << ", " << *cv_name << ", " + << "0x" << std::setfill('0') << std::setw(16) + << cv_scomaddr << "ULL )" + << std::endl; + }; +}; + +typedef std::list<PrdrRegister *> PrdrRegisterList; + +#endif + diff --git a/src/usr/diag/prdf/common/framework/rule/prdrSignatures.H b/src/usr/diag/prdf/common/framework/rule/prdrSignatures.H new file mode 100755 index 000000000..eb5223005 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdrSignatures.H @@ -0,0 +1,36 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdrSignatures.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 */ + +#include <stdint.h> + +// Create a constant integer for PRDR_ERROR_SIGNATURE( foo, 0x1, "asdf", "ASDF") +#define PRDR_ERROR_SIGNATURE(a,b,c,d) \ + const uint32_t PRDFSIG_##a = b + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// D586213 f310 02/19/07 iawillia Add extra signature support. +// End Change Log ***************************************************** + diff --git a/src/usr/diag/prdf/common/framework/rule/prdrToken.H b/src/usr/diag/prdf/common/framework/rule/prdrToken.H new file mode 100755 index 000000000..38e7bb061 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdrToken.H @@ -0,0 +1,66 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/rule/prdrToken.H $ */ +/* */ +/* 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 */ + +#ifndef __PRDRTOKEN_H +#define __PRDRTOKEN_H + +/** + * @file prdrToken.H + * @brief Collect of function defines and includes for prdrcompiler. + */ + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#include <string> +#include <stack> +#include <utility> + +#include <prdrRegister.H> +#include <prdrChip.H> +#include <prdrExpr.H> +#include <prdrGroup.H> + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +extern int yylex(); +extern int yyparse(); +extern void yyerror(const char *); + +extern int yyline; +extern std::stack<std::pair<std::string, int> > yyincfiles; + +extern PrdrChip * g_currentChip; + +#endif + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// F494911 f310 03/04/05 iawillia Initial File Creation +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/rule/prdrpp b/src/usr/diag/prdf/common/framework/rule/prdrpp new file mode 100755 index 000000000..de808f420 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/prdrpp @@ -0,0 +1,76 @@ +#!/usr/bin/perl +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/framework/rule/prdrpp $ +# +# 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 + +use strict; + +my @search_dirs = (); + +foreach my $arg (@ARGV) +{ + if ($arg =~ m/-I/) + { + $arg =~ s/-I//; + push @search_dirs, $arg; + } +} +read_file(\*STDIN); + +sub read_file +{ + my $file = shift; + while (my $line = <$file>) + { + if ($line =~ m/^\.include.*\".*\".*/) + { + my $include = $line; + chomp($include); + $include =~ s/.*\"(.*)\".*/$1/; + print ".included \"$include\"\n"; + open_file($include); + print ".end_included\n"; + } + else + { + print $line; + } + + } +} + +sub open_file +{ + my $filename = shift; + foreach my $dir (@search_dirs) + { + my $fileDirName = "$dir/$filename"; + if (-e $fileDirName) + { + open FILE, "< $fileDirName" || die "Error opening $fileDirName"; + read_file(\*FILE); + close FILE; + return; + } + } + print STDERR "prdrpp: $filename not found!\n"; +} diff --git a/src/usr/diag/prdf/common/framework/rule/tables.mk b/src/usr/diag/prdf/common/framework/rule/tables.mk new file mode 100755 index 000000000..6c0ee1823 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/rule/tables.mk @@ -0,0 +1,57 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/framework/rule/tables.mk $ +# +# IBM CONFIDENTIAL +# +# COPYRIGHT International Business Machines Corp. 2005,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 + +#------------------------------------------------------------------- +# To add a new chip, modify PRDR_RULE_TABLES line. +# To change system type, modify VPATH line in rule/Makefile +#------------------------------------------------------------------- + +# Add Rule tables here: +# FIXME: This is now a duplicate of PRDR_RULE_TABLE_TARGETS in prd_ruletable.mk +PRDR_RULE_TABLES = \ + Proc.prf \ + Ex.prf \ + Mcs.prf \ + Membuf.prf \ + Mba.prf + +#------------------------------------------------------------------ +# Change nothing below this line unless you know what you're doing! +#------------------------------------------------------------------ + + + +# Stuff for errl plugin. + # Define required .o's +PRDR_ERRL_PLUGINS = ${PRDR_RULE_TABLES:S/\.prf/.prf.err.C/g} +PRDR_ERRL_PLUGINS += ${PRDR_RULE_TABLES:S/\.prf/.prf.reg.C/g} +PRDR_ERRL_PLUGINS_OFILES = ${PRDR_ERRL_PLUGINS:S/\.C/.o/g} + # Ensure that we'll use the latest .C's to build the .o's. +#${PRDR_ERRL_PLUGINS_OFILES} : ${.TARGET:S/\.o/\.C/g} +%.prf.err.o: %.prf.err.C +%.prf.reg.o: %.prf.reg.C +%.prf.err.C: %.prf +%.prf.reg.C: %.prf +%.prf: %.rule +# end errl plugin. + 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); + } + } +} diff --git a/src/usr/diag/prdf/common/iipconst.h b/src/usr/diag/prdf/common/iipconst.h new file mode 100755 index 000000000..00fafb0fe --- /dev/null +++ b/src/usr/diag/prdf/common/iipconst.h @@ -0,0 +1,90 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/iipconst.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 IIPCONST_H +#define IIPCONST_H + +/** + @file iipconst.h + @brief Common iternal constants used by PRD +*/ + +/*--------------------------------------------------------------------*/ +/* Includes */ +/*--------------------------------------------------------------------*/ + +#if !defined(PRDF_TYPES_H) +#include <prdf_types.h> +#endif + +/*--------------------------------------------------------------------*/ +/* User Types */ +/*--------------------------------------------------------------------*/ + +// Type Specification ////////////////////////////////////////////////// +// +// Purpose: TARGETING::TargetHandle_t is used to identify a Chip instance. +// +// End Type Specification ////////////////////////////////////////////// + +namespace PRDF +{ + // FIXME - These may be replaced by something that is globally available. + typedef uint32_t HUID; + enum { INVALID_HUID = 0 }; +} // end namespace PRDF + +/*--------------------------------------------------------------------*/ +/* Constants */ +/*--------------------------------------------------------------------*/ + +#ifndef SUCCESS +#define SUCCESS 0 +#endif + +#ifndef FAIL +#define FAIL -1 +#endif + +enum DOMAIN_ID +{ + UKNOWN_DOMAIN = 0, + + FABRIC_DOMAIN = 0x71, + EX_DOMAIN = 0x72, + MCS_DOMAIN = 0x73, + MEMBUF_DOMAIN = 0x74, + MBA_DOMAIN = 0x75, + XBUS_DOMAIN = 0x76, + ABUS_DOMAIN = 0x77, + + CLOCK_DOMAIN_FAB = 0x90, + CLOCK_DOMAIN_MCS = 0x91, + CLOCK_DOMAIN_MEMBUF = 0x92, + + END_DOMAIN_ID +}; + + + +#endif diff --git a/src/usr/diag/prdf/common/iipglobl.h b/src/usr/diag/prdf/common/iipglobl.h new file mode 100755 index 000000000..f9b7e64f2 --- /dev/null +++ b/src/usr/diag/prdf/common/iipglobl.h @@ -0,0 +1,561 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/iipglobl.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 IIPGLOBL_H +#define IIPGLOBL_H + +/* Module Description *************************************************/ +/* */ +/* Name: iipglobl.h */ +/* */ +/* Description: This module contains the Processor Runtime + Diagnostics global variable and type declarations. */ +/* */ +/* End Module Description *********************************************/ + +/*--------------------------------------------------------------------*/ +/* Includes */ +/*--------------------------------------------------------------------*/ + +#ifdef __HOSTBOOT_MODULE + #include <errl/errlmanager.H> + #include <util/singleton.H> +#else + #include <errlentry.H> + #include <hwsvSvrErrl.H> + #include <utilsingleton.H> + // FIXME: uncomment dump include when Adriana's fix is in + //#include <dumpHWURequest_applet.H> +#endif + +#include <prdfTrace.H> +#include <prdf_types.h> +#include <prdfErrlSmartPtr.H> + +/*--------------------------------------------------------------------*/ +/* Forward References */ +/*--------------------------------------------------------------------*/ + +class System; + +/*--------------------------------------------------------------------*/ +/* Global Variables */ +/*--------------------------------------------------------------------*/ + +namespace PRDF +{ + extern System * systemPtr; + extern PrdfErrlSmartPtr g_prd_errlHndl; +} + +/*--------------------------------------------------------------------*/ +/* Singleton macros common to both FSP and Hostboot */ +/*--------------------------------------------------------------------*/ +/** + * @brief common singleton declaration to specific platform + * + * @param[in] __T__ + * Type of singleton, fully namespaced + * + * @param[in] __NAME__ + * Symbol name for singleton + */ + +/** + * @brief common singleton "getter" to the specific platform + * + * @param[in] __TYPE__ + * Typedef for singleton, as created above + * + * @return Singleton reference for the given singleton + */ + +// ----------- Hostboot macros begin ----------- +#ifdef __HOSTBOOT_MODULE + +#define PRDF_DECLARE_SINGLETON(__T__,__NAME__) \ + typedef Singleton<__T__> __NAME__ + + +#define PRDF_GET_SINGLETON(__TYPE__) \ + __TYPE__::instance() + +// ----------- FSP macros begin ----------- +#else + +#define PRDF_DECLARE_SINGLETON(__T__,__NAME__) \ + typedef util::SingletonHolder<__T__> __NAME__ + +#define PRDF_GET_SINGLETON(__TYPE__) \ + __TYPE__::Instance() + +#endif +// end Singleton macros + +/*--------------------------------------------------------------------*/ +/* Errl macros common to both FSP and Hostboot */ +/*--------------------------------------------------------------------*/ + +/** + * @brief Convert any integer to uint64_t + */ +#define PRDF_GET_UINT64(x) static_cast<uint64_t>(x) + +/** + * @brief store two uint32_t to uint64_t + */ +#define PRDF_GET_UINT64_FROM_UINT32(l_32, r_32) \ + ( (PRDF_GET_UINT64(l_32) << 32) | PRDF_GET_UINT64(r_32) ) + +// ----------- Hostboot macros begin ----------- +#ifdef __HOSTBOOT_MODULE + +/** + * @brief create ErrlEntry in Hostboot + */ +/* This macro does not use the below FSP input parms: + + - i_etype : errlEventType + - i_type : srciType + - i_srcAttr : srcAttr + - i_refCode : serviceCodes +*/ +#define PRDF_CREATE_ERRL(io_errl, i_sev, i_etype, i_type, \ + i_srcAttr, i_mid, i_refCode, i_reasonCode, \ + i_user1 , i_user2, i_user3 , i_user4) \ + io_errl = new ERRORLOG::ErrlEntry(ERRORLOG::i_sev, \ + i_mid, \ + i_reasonCode, \ + PRDF_GET_UINT64_FROM_UINT32( \ + i_user1, \ + i_user2), \ + PRDF_GET_UINT64_FROM_UINT32( \ + i_user3, \ + i_user4)) + +/** + * @brief Add user data to the log + */ +#define PRDF_ADD_FFDC(io_errl, i_buf, i_size, i_ver, i_subsec) \ + io_errl->addFFDC(PRDF_COMP_ID, i_buf, i_size, i_ver, i_subsec) + +/** + * @brief Commit the log + */ +// FIXME: hberr does not use i_actions for commit +#define PRDF_COMMIT_ERRL(io_errl, i_actions) \ + if(i_actions) {} \ + errlCommit(io_errl, PRDF_COMP_ID) + +/** + * @brief Collect component trace + */ +#define PRDF_COLLECT_TRACE(io_errl, i_max) \ + io_errl->collectTrace(PRDF_COMP_NAME, i_max) + +/** + * @brief Add a procedure ( software ) callout + */ +#define PRDF_ADD_PROCEDURE_CALLOUT(io_errl, i_priority, i_procedure) \ + io_errl->addProcedureCallout((const HWAS::epubProcedureID)i_procedure, \ + (const HWAS::callOutPriority)i_priority) + +/** + * @brief Adds a software section to the log + * mostly used as a stack call indicator + */ +// FIXME: hberrl hasn't added this in yet so make it a no-op for now +#define PRDF_ADD_SW_ERR(io_errl, i_rc, i_fileId, i_codeloc) + +/** + * @brief Set the platform Log Id + */ +// FIXME: hberrl doesn't have this setter method so make it a no-op for now +#define PRDF_SET_PLID(io_errl, i_plid) + +/** + * @brief Get the platform Log Id + */ +#define PRDF_GET_PLID(io_errl, o_plid) \ + o_plid = io_errl->plid() + +/** + * @brief Set 32 bit user defined return code + */ +// FIXME: hberrl doesn't have this setter method so make it a no-op for now +#define PRDF_SET_RC(io_errl, i_rc) + +/** + * @brief Get 32 bit user defined return code + */ +// FIXME: hberrl doesn't have this setter method so make it a no-op for now +#define PRDF_GET_RC(io_errl, o_rc) + +/** + * @brief Get reason code + */ +#define PRDF_GET_REASONCODE(io_errl, o_reasonCode) \ + o_reasonCode = io_errl->reasonCode() + +/** + * @brief get previously stored SRC + * A special index ( 0 ) is used to a + * ccess the primary src. + */ +// FIXME: hberrl doesn't have this setter method so make it a no-op for now +#define PRDF_GET_SRC(io_errl, o_src, i_idx) + +/** + * @brief Determine if the src is terminating + */ +// FIXME: hberrl doesn't have this setter method so make it a no-op for now +#define PRDF_GET_TERM_SRC(io_errl, o_termSRC) + +/** + * @brief write SRC termination flag + */ +// FIXME: hberrl doesn't have this setter method so make it a no-op for now +#define PRDF_SRC_WRITE_TERM_STATE_ON(io_errl, i_flags) + + +// ----------- Hostboot macros end ----------- + +// ----------- FSP macros begin ----------- +#else + +/** + * @brief create ErrlEntry in FSP + */ +#define PRDF_CREATE_ERRL(io_errl, i_sev, i_etype, i_type, \ + i_srcAttr, i_mid, i_refCode, i_reasonCode, \ + i_user1 , i_user2, i_user3 , i_user4) \ + io_errl = new ErrlEntry(PRDF_COMP_ID, \ + i_sev, \ + i_etype, \ + i_type, \ + i_srcAttr, \ + i_mid, \ + i_refCode, \ + i_reasonCode, \ + i_user1, \ + i_user2, \ + i_user3, \ + i_user4, \ + EPUB_FIRMWARE_SP) + +/** + * @brief Add user data to the log + */ +#define PRDF_ADD_FFDC(io_errl, i_buf, i_size, i_ver, i_subsec) \ + io_errl->addUsrDtls(i_buf, i_size, PRDF_COMP_ID, i_ver, i_subsec) + +/** + * @brief Commit the log + */ +#define PRDF_COMMIT_ERRL(io_errl, i_actions) \ + io_errl->commit(PRDF_COMP_ID, i_actions); \ + delete io_errl; io_errl=NULL; + +/** + * @brief Collect component trace + */ +#define PRDF_COLLECT_TRACE(io_errl, i_max) \ + io_errl->CollectTrace(PRDF_COMP_NAME, i_max) + +/** + * @brief Add a procedure ( software ) callout + */ +#define PRDF_ADD_PROCEDURE_CALLOUT(io_errl, i_priority, i_procedure) \ + io_errl->addProcedureCallout(i_priority, i_procedure) + +/** + * @brief Adds a software section to the log + * mostly used as a stack call indicator + */ +#define PRDF_ADD_SW_ERR(io_errl, i_rc, i_fileId, i_codeloc) \ + io_errl->addSwErr(PRDF_COMP_ID, i_rc, i_fileId, i_codeloc) + +/** + * @brief Set the platform Log Id + */ +#define PRDF_SET_PLID(io_errl, i_plid) \ + io_errl->plid(i_plid) + +/** + * @brief Get the platform Log Id + */ +#define PRDF_GET_PLID(io_errl, o_plid) \ + o_plid = io_errl->plid() + +/** + * @brief Set 32 bit user defined return code + */ +#define PRDF_SET_RC(io_errl, i_rc) \ + io_errl->setRC(i_rc) + +/** + * @brief Get 32 bit user defined return code + */ +#define PRDF_GET_RC(io_errl, o_rc) \ + o_rc = io_errl->getRC() + +/** + * @brief Get reason code + */ +#define PRDF_GET_REASONCODE(io_errl, o_reasonCode) \ + o_reasonCode = io_errl->getSRC() == NULL ? 0 : \ + io_errl->getSRC()->reasonCode() + +/** + * @brief get previously stored SRC + * A special index ( 0 ) is used to a + * ccess the primary src. + */ +#define PRDF_GET_SRC(io_errl, o_src, i_idx) \ + o_src = io_errl->getSRC(i_idx) + +/** + * @brief Determine if the src is terminating + */ +#define PRDF_GET_TERM_SRC(io_errl, o_termSRC) \ + o_termSRC = io_errl->getSRC()->isTerminateSRC() + +/** + * @brief write SRC termination flag + */ +#define PRDF_SRC_WRITE_TERM_STATE_ON(io_errl, i_flags) \ + io_errl->getSRC()->writeTermState_ON(i_flags) + + +// ----------- FSP macros end ----------- +#endif + + +/*--------------------------------------------------------------------*/ +/* HW Deconfig Errl macros common to both FSP and Hostboot */ +/*--------------------------------------------------------------------*/ + +// FIXME: defines for enums that are not available in hostboot +#ifdef __HOSTBOOT_MODULE + +// FIXME: these ERRL sevs are currently not supported in HB +#define ERRL_SEV_PREDICTIVE ERRL_SEV_UNRECOVERABLE +#define ERRL_SEV_DIAGNOSTIC_ERROR1 ERRL_SEV_UNRECOVERABLE +#define ERRL_SEV_RECOVERED ERRL_SEV_INFORMATIONAL + +#include <prdfEnums.H> + +#endif + +// ----------- Hostboot macros begin ----------- +#ifdef __HOSTBOOT_MODULE + +/** + * @brief function to create an error log. + */ +#define PRDF_HW_CREATE_ERRL(io_errl, \ + i_sev, \ + i_etype, \ + i_type, \ + i_srcAttr, \ + i_mid, \ + i_refCode, \ + i_reasonCode, \ + i_userData1, \ + i_userData2, \ + i_userData3, \ + i_userData4, \ + i_termFlag, \ + i_pldCheck) \ + PRDF_CREATE_ERRL(io_errl, i_sev, i_etype, i_type, \ + i_srcAttr, i_mid, i_refCode, i_reasonCode, \ + i_userData1, i_userData2, i_userData3, i_userData4) + +/** + * @brief Add a procedure callout to an existing error log + */ +#define PRDF_HW_ADD_PROC_CALLOUT(i_procedure, \ + i_priority, \ + io_errl, \ + i_severity) \ + PRDF_ADD_PROCEDURE_CALLOUT(io_errl, i_priority, i_procedure) + +/** + * @brief Error log interface to add a HW callout to an existing error log. + */ +#define PRDF_HW_ADD_CALLOUT(io_sysTerm, i_target, i_priority, \ + i_deconfigState, i_gardState, \ + io_errl, i_writeVpd, \ + i_gardErrType, i_severity, i_hcdb_update) \ + io_errl->addHwCallout(i_target, \ + (const HWAS::callOutPriority)i_priority, \ + (const HWAS::DeconfigEnum)i_deconfigState, \ + (const HWAS::GARD_ErrorType)i_gardErrType) + +/** + * @brief Error log interface to add a HW callout to an existing error log. + */ +// FIXME - will need to implement later +#define PRDF_HW_ADD_MEMMRU_CALLOUT(io_sysTerm, i_memMRU, i_priority, \ + i_deconfigState, i_gardState, \ + io_errl, i_writeVpd, \ + i_gardErrType, i_severity, i_hcdb_update) + +/** + * @brief Process's pending deconfig and GARD service actions + * and thencommits and deletes the error log. + */ +#define PRDF_HW_COMMIT_ERRL(io_sysTerm, io_errl, i_deferDeconfig, \ + i_action, i_continue) \ + io_sysTerm = false; \ + PRDF_COMMIT_ERRL(io_errl, i_action); + +/** + * @brief indicate whether an abort is active or not + */ +// FIXME - not available in Hostboot? +#define PRDF_ABORTING(o_abort) \ + o_abort = false; + +/** + * @brief Interface to request a Hardware Unit dump collection + */ +// FIXME - need to implement in Hostboot +#define PRDF_HWUDUMP(io_dumpErrl, i_errl, \ + i_content, i_dumpHuid) + +/** + * @brief Interface to deconfig target at Runtime (Not valid in Hostboot) + */ +#define PRDF_RUNTIME_DECONFIG(io_errl, i_pTarget) + +// ----------- Hostboot macros end ----------- + +// ----------- FSP macros begin ----------- +#else + +/** + * @brief function to create an error log. + */ +#define PRDF_HW_CREATE_ERRL(io_errl, \ + i_sev, \ + i_etype, \ + i_type, \ + i_srcAttr, \ + i_mid, \ + i_refCode, \ + i_reasonCode, \ + i_userData1, \ + i_userData2, \ + i_userData3, \ + i_userData4, \ + i_termFlag, \ + i_pldCheck) \ + HWSV::SvrError::Elog(io_errl, \ + (const uint8_t)i_mid, \ + i_reasonCode, \ + PRDF_COMP_ID, \ + i_userData1, \ + i_userData2, \ + i_userData3, \ + i_userData4, \ + (const HWSV::homTermEnum)i_termFlag, \ + i_pldCheck) + +/** + * @brief Add a procedure callout to an existing error log + */ +#define PRDF_HW_ADD_PROC_CALLOUT(i_procedure, \ + i_priority, \ + io_errl, \ + i_severity) \ + HWSV::SvrError::AddProcedureCallout((const epubProcedureID)i_procedure, \ + (const srciPriority)i_priority, \ + io_errl, \ + i_severity) + +/** + * @brief Error log interface to add a HW callout to an existing error log. + */ +#define PRDF_HW_ADD_CALLOUT(io_sysTerm, i_target, i_priority, \ + i_deconfigState, i_gardState, \ + io_errl, i_writeVpd, \ + i_gardErrType, i_severity, i_hcdb_update) \ + io_sysTerm = HWSV::SvrError::AddHwCallout((HWSV::HUID)PlatServices::getHuid(i_target), \ + (srciPriority)i_priority, \ + (const HWSV::homDeconfigEnum)i_deconfigState, \ + (const HWSV::homGardEnum)i_gardState, \ + io_errl, \ + i_gardErrType, \ + i_severity, \ + (homHCDBUpdate)i_hcdb_update) + +/** + * @brief Error log interface to add a HW callout to an existing error log. + */ +// FIXME - will need to implement later +#define PRDF_HW_ADD_MEMMRU_CALLOUT(io_sysTerm, i_memMRU, i_priority, \ + i_deconfigState, i_gardState, \ + io_errl, i_writeVpd, \ + i_gardErrType, i_severity, i_hcdb_update) + +/** + * @brief Process's pending deconfig and GARD service actions + * and thencommits and deletes the error log. + */ +#define PRDF_HW_COMMIT_ERRL(io_sysTerm, io_errl, i_deferDeconfig, \ + i_action, i_continue) \ + io_sysTerm = HWSV::SvrError::CommitErrl(PRDF_COMP_ID, \ + io_errl, \ + i_deferDeconfig, \ + i_action, \ + i_continue) + +/** + * @brief indicate whether an abort is active or not + */ +#define PRDF_ABORTING(o_abort) \ + o_abort = HWSV::theExecutionService::Instance().aborting() + +/** + * @brief Interface to request a Hardware Unit dump collection + */ +#define PRDF_HWUDUMP(io_dumpErrl, i_errl, \ + i_content, i_dumpHuid) \ + SrciSrc l_src(*(i_errl->getSRC(0))); \ + io_dumpErrl= dumpHWURequestApplet( i_content, \ + PRDF_COMP_ID, \ + i_errl->plid(),\ + l_src, \ + i_dumpHuid ); + +/** + * @brief Interface to deconfig target at Runtime + */ +#define PRDF_RUNTIME_DECONFIG( io_errl, i_target ) \ + io_errl = PlatServices::runtimeDeconfig( i_target ); + +// ----------- FSP macros end ----------- +#endif + +#endif diff --git a/src/usr/diag/prdf/common/plat/pegasus/CommonActions.rule b/src/usr/diag/prdf/common/plat/pegasus/CommonActions.rule new file mode 100755 index 000000000..44c8b559c --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/CommonActions.rule @@ -0,0 +1,106 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/CommonActions.rule $ +# +# 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 + +################################################################################ +# This file is intended to create a common set of actionclasses for all rule +# files. Simply add the following line at the top the actionclass section of +# each rule file. +# +# .include "CommonActions.rule" +# +# Note that no indentation can be used for the .include keyword. +################################################################################ + +################################################################################ +# Thresholds and Flags # +################################################################################ + +# Threshold syntax: +# threshold( field(<timebase>) [, mfg(<timebase>)|mfg_file(<mfg_theshold>)] ); +# +# Timebase syntax: +# <threshold_count> [/ [timbase_count] <sec|min|hour|day>] +# +# Note that <mfg_theshold> can be found in prdfMfgThresholds.lst +# FIXME: mfg_file() is currently not supported in Hostboot because there +# currently is no way to get the values from the FSP command line to +# Hostboot. +# +# Examples: +# threshold( field( 1 ) ); +# threshold( field(32 / day) ); +# threshold( field( 5 / 2 min) ); +# threshold( field(32 / 1 day), mfg(2 / hour) ); +# threshold( field( 2 / min), mfg(1 ) ); +# threshold( field(32 / day), mfg_file(P7CORE_L2_CACHE_CES) ); + +/** Threshold of 1 */ +actionclass threshold1 +{ + threshold( field(1) ); +}; + +/** Threshold of 32 per day */ +actionclass threshold32pday +{ + threshold( field(32 / day) ); +}; + +################################################################################ +# Simple Callouts # +################################################################################ + +/** Callout 2nd Level Support, priority medium */ +actionclass callout2ndLvlMed +{ + callout(procedure(NextLevelSupport_ENUM), MRU_MED); +}; + +################################################################################ +# Dump Types # +################################################################################ + +/** Dump SH */ +actionclass dumpSH +{ + dump(DUMP_CONTENT_SH); +}; + +################################################################################ +# Default callouts # +################################################################################ + +/** Default action for an unexpected unmasked bit */ +actionclass defaultMaskedError +{ + dumpSH; + callout2ndLvlMed; + threshold1; +}; + +/** Default TBD action */ +actionclass TBDDefaultCallout +{ + defaultMaskedError; +}; + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Ex.rule b/src/usr/diag/prdf/common/plat/pegasus/Ex.rule new file mode 100755 index 000000000..56fd722b1 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Ex.rule @@ -0,0 +1,1306 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Ex.rule $ +# +# 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 + +################################################################################ +# +# Scope: +# Registers and actions for the following chiplets: +# Note that only addresses for EX0 will be used. +# +# Chiplet Register Addresses Description +# ======= ======================= ============================================ +# EX0 0x10000000 - 0x10FFFFFF EX0 pervasive logic +# EX1 0x11000000 - 0x11FFFFFF EX1 pervasive logic +# EX2 0x12000000 - 0x12FFFFFF EX2 pervasive logic +# EX3 0x13000000 - 0x13FFFFFF EX3 pervasive logic +# EX4 0x14000000 - 0x14FFFFFF EX4 pervasive logic +# EX5 0x15000000 - 0x15FFFFFF EX5 pervasive logic +# EX6 0x16000000 - 0x16FFFFFF EX6 pervasive logic +# EX7 0x17000000 - 0x17FFFFFF EX7 pervasive logic +# EX8 0x18000000 - 0x18FFFFFF EX8 pervasive logic +# EX9 0x19000000 - 0x19FFFFFF EX9 pervasive logic +# EX10 0x1A000000 - 0x1AFFFFFF EX10 pervasive logic +# EX11 0x1B000000 - 0x1BFFFFFF EX11 pervasive logic +# EX12 0x1C000000 - 0x1CFFFFFF EX12 pervasive logic +# EX13 0x1D000000 - 0x1DFFFFFF EX13 pervasive logic +# EX14 0x1E000000 - 0x1EFFFFFF EX14 pervasive logic +# EX15 0x1F000000 - 0x1FFFFFFF EX15 pervasive logic +# +################################################################################ + +chip Ex +{ + name "Power8 EX Chiplet"; + targettype TYPE_EX; + sigoff 0x8000; +# FIXME May need to update dump type + dump DUMP_CONTENT_HW; + scomlen 64; + + ############################################################################# + # # + # ###### # + # # # ###### #### ### #### ##### ###### ##### #### # + # # # # # # # # # # # # # # + # ###### ##### # # #### # ##### # # #### # + # # # # # ### # # # # ##### # # + # # # # # # # # # # # # # # # # + # # # ###### #### ### #### # ###### # # #### # + # # + ############################################################################# + + ############################################################################ + # EX Chiplet Registers + ############################################################################ + + register EX_CHIPLET_CS_FIR + { + name "EX00.TP.ECO_DOM.XFIR"; + scomaddr 0x10040000; + capture group default; + }; + + register EX_CHIPLET_RE_FIR + { + name "EX00.TP.ECO_DOM.RFIR"; + scomaddr 0x10040001; + capture group default; + }; + + register EX_CHIPLET_FIR_MASK + { + name "EX00.TP.ECO_DOM.FIR_MASK"; + scomaddr 0x10040002; + capture type secondary; + capture group default; + }; + + # EX special attention registers - Used for FFDC only + # Currently, all analysis of these registers is done by ATTN. + + register EX_CHIPLET_SPA + { + name "EX00.TP.ECO_DOM.EPS.FIR.SPATTN"; + scomaddr 0x10040004; + capture group default; + }; + + ############################################################################ + # EX Chiplet LFIR + ############################################################################ + + register EX_LFIR + { + name "EX00.TP.ECO_DOM.LOCAL_FIR"; + scomaddr 0x1004000a; + reset (&, 0x1004000b); + mask (|, 0x1004000f); + capture group default; + }; + + register EX_LFIR_MASK + { + name "EX00.TP.ECO_DOM.EPS.FIR.LOCAL_FIR_MASK"; + scomaddr 0x1004000d; + capture type secondary; + capture group default; + }; + + register EX_LFIR_ACT0 + { + name "EX00.TP.ECO_DOM.EPS.FIR.LOCAL_FIR_ACTION0"; + scomaddr 0x10040010; + capture type secondary; + capture group default; + }; + + register EX_LFIR_ACT1 + { + name "EX00.TP.ECO_DOM.EPS.FIR.LOCAL_FIR_ACTION1"; + scomaddr 0x10040011; + capture type secondary; + capture group default; + }; + + ############################################################################ + # EX Chiplet COREFIR + ############################################################################ + + register COREFIR + { + name "EX00.EC.PC.PC_NE.FIR.CORE_FIR"; + scomaddr 0x10013100; + reset (&, 0x10013101); + mask (|, 0x10013108); + capture group default; + }; + + register COREFIR_MASK + { + name "EX00.EC.PC.PC_NE.FIR.CORE_FIRMASK"; + scomaddr 0x10013106; + capture type secondary; + capture group default; + }; + + register COREFIR_ACT0 + { + name "EX00.EC.PC.PC_NE.FIR.CORE_ACTION0"; + scomaddr 0x10013103; + capture type secondary; + capture group default; + }; + + register COREFIR_ACT1 + { + name "EX00.EC.PC.PC_NE.FIR.CORE_ACTION1"; + scomaddr 0x10013104; + capture type secondary; + capture group default; + }; + + ############################################################################ + # EX Chiplet L2FIR + ############################################################################ + + register L2FIR + { + name "EX00.L2.L2MISC.L2CERRS.FIR_REG"; + scomaddr 0x10012800; + reset (&, 0x10012801); + mask (|, 0x10012805); + capture group default; + }; + + register L2FIR_MASK + { + name "EX00.L2.L2MISC.L2CERRS.FIR_MASK_REG"; + scomaddr 0x10012803; + capture type secondary; + capture group default; + }; + + register L2FIR_ACT0 + { + name "EX00.L2.L2MISC.L2CERRS.FIR_ACTION0_REG"; + scomaddr 0x10012806; + capture type secondary; + capture group default; + }; + + register L2FIR_ACT1 + { + name "EX00.L2.L2MISC.L2CERRS.FIR_ACTION1_REG"; + scomaddr 0x10012807; + capture type secondary; + capture group default; + }; + + ############################################################################ + # EX Chiplet L3FIR + ############################################################################ + + register L3FIR + { + name "EX00.L3.L3_MISC.L3CERRS.FIR_REG"; + scomaddr 0x10010800; + reset (&, 0x10010801); + mask (|, 0x10010805); + capture group default; + }; + + register L3FIR_MASK + { + name "EX00.L3.L3_MISC.L3CERRS.FIR_MASK_REG"; + scomaddr 0x10010803; + capture type secondary; + capture group default; + }; + + register L3FIR_ACT0 + { + name "EX00.L3.L3_MISC.L3CERRS.FIR_ACTION0_REG"; + scomaddr 0x10010806; + capture type secondary; + capture group default; + }; + + register L3FIR_ACT1 + { + name "EX00.L3.L3_MISC.L3CERRS.FIR_ACTION1_REG"; + scomaddr 0x10010807; + capture type secondary; + capture group default; + }; + + ############################################################################ + # EX Chiplet NCUFIR + ############################################################################ + + register NCUFIR + { + name "EX00.NC.NCMISC.NCSCOMS.FIR_REG"; + scomaddr 0x10010c00; + reset (&, 0x10010c01); + mask (|, 0x10010c05); + capture group default; + }; + + register NCUFIR_MASK + { + name "EX00.NC.NCMISC.NCSCOMS.FIR_MASK_REG"; + scomaddr 0x10010c03; + capture type secondary; + capture group default; + }; + + register NCUFIR_ACT0 + { + name "EX00.NC.NCMISC.NCSCOMS.FIR_ACTION0_REG"; + scomaddr 0x10010c06; + capture type secondary; + capture group default; + }; + + register NCUFIR_ACT1 + { + name "EX00.NC.NCMISC.NCSCOMS.FIR_ACTION1_REG"; + scomaddr 0x10010c07; + capture type secondary; + capture group default; + }; + + ############################################################################ + # EX Chiplet SPATTNs + ############################################################################ + + # EX special attention registers - Used for FFDC only + # Currently, all analysis of these registers is done by ATTN. + + register SPATTN_0 + { + name "EX00.EC.PC.PC_NE.TCTL0.SPATTN"; + scomaddr 0x10013007; + capture group default; + }; + + register SPATTN_1 + { + name "EX00.EC.PC.PC_NE.TCTL1.SPATTN"; + scomaddr 0x10013017; + capture group default; + }; + + register SPATTN_2 + { + name "EX00.EC.PC.PC_NE.TCTL2.SPATTN"; + scomaddr 0x10013027; + capture group default; + }; + register SPATTN_3 + { + name "EX00.EC.PC.PC_NE.TCTL3.SPATTN"; + scomaddr 0x10013037; + capture group default; + }; + + register SPATTN_4 + { + name "EX00.EC.PC.PC_NE.TCTL4.SPATTN"; + scomaddr 0x10013047; + capture group default; + }; + + register SPATTN_5 + { + name "EX00.EC.PC.PC_NE.TCTL5.SPATTN"; + scomaddr 0x10013057; + capture group default; + }; + + register SPATTN_6 + { + name "EX00.EC.PC.PC_NE.TCTL6.SPATTN"; + scomaddr 0x10013067; + capture group default; + }; + + register SPATTN_7 + { + name "EX00.EC.PC.PC_NE.TCTL7.SPATTN"; + scomaddr 0x10013077; + capture group default; + }; + +}; + + ############################################################################## + # # + # #### # # + # # # # # # ##### ### # # # ## ##### ### ### # # ### # + # # # # # # # # # # # # # # # # # ## # # # + # #### # # # #### ### # ####### # # # # # # # # ### # + # # # # # # # # # # # # # # # # # # ## # # + # # # ### #### ##### ### # # # ## # ### ### # # ### # + # # + ############################################################################## + +################################################################################ +# EX Chiplet Registers +################################################################################ + +rule ExChipetFir +{ + CHECK_STOP: + (EX_CHIPLET_CS_FIR & `1F00000000000000`) & ~EX_CHIPLET_FIR_MASK; + RECOVERABLE: + ((EX_CHIPLET_RE_FIR >> 2) & `1F00000000000000`) & ~EX_CHIPLET_FIR_MASK; +}; + +group gExChipetFir attntype CHECK_STOP, RECOVERABLE filter singlebit +{ + /** EX_CHIPLET_FIR[3] + * Attention from LFIR + */ + (ExChipetFir, bit(3))? analyze(gExLFir); + + /** EX_CHIPLET_FIR[4] + * Attention from COREFIR + */ + (ExChipetFir, bit(4)) ? analyze(gCoreFir); + + /** EX_CHIPLET_FIR[5] + * Attention from L2FIR + */ + (ExChipetFir, bit(5)) ? analyze(gL2Fir); + + /** EX_CHIPLET_FIR[6] + * Attention from L3FIR + */ + (ExChipetFir, bit(6)) ? analyze(gL3Fir); + + /** EX_CHIPLET_FIR[7] + * Attention from NCUFIR + */ + (ExChipetFir, bit(7)) ? analyze(gNcuFir); +}; + +################################################################################ +# EX Chiplet LFIR +################################################################################ + +rule ExLFir +{ + CHECK_STOP: EX_LFIR & ~EX_LFIR_MASK & ~EX_LFIR_ACT0 & ~EX_LFIR_ACT1; + RECOVERABLE: EX_LFIR & ~EX_LFIR_MASK & ~EX_LFIR_ACT0 & EX_LFIR_ACT1; +}; + +group gExLFir filter singlebit +{ + /** EX_LFIR[0] + * CFIR internal parity error + */ + (ExLFir, bit(0)) ? TBDDefaultCallout; + + /** EX_LFIR[1] + * Local errors from GPIO (PCB error) + */ + (ExLFir, bit(1)) ? TBDDefaultCallout; + + /** EX_LFIR[2] + * Local errors from CC (PCB error) + */ + (ExLFir, bit(2)) ? TBDDefaultCallout; + + /** EX_LFIR[3] + * Local errors from CC (OPCG, parity, scan collision, ...) + */ + (ExLFir, bit(3)) ? TBDDefaultCallout; + + /** EX_LFIR[4] + * Local errors from PSC (PCB error) + */ + (ExLFir, bit(4)) ? TBDDefaultCallout; + + /** EX_LFIR[5] + * Local errors from PSC (parity error) + */ + (ExLFir, bit(5)) ? TBDDefaultCallout; + + /** EX_LFIR[6] + * Local errors from Thermal (parity error) + */ + (ExLFir, bit(6)) ? TBDDefaultCallout; + + /** EX_LFIR[7] + * Local errors from Thermal (PCB error) + */ + (ExLFir, bit(7)) ? TBDDefaultCallout; + + /** EX_LFIR[8|9] + * Local errors from Thermal (Trip error) + */ + (ExLFir, bit(8|9)) ? TBDDefaultCallout; + + /** EX_LFIR[10|11] + * Local errors from Trace Array ( error) + */ + (ExLFir, bit(10|11)) ? TBDDefaultCallout; +}; + +################################################################################ +# EX Chiplet COREFIR +################################################################################ + +rule CoreFir +{ + CHECK_STOP: COREFIR & ~COREFIR_MASK & ~COREFIR_ACT0 & ~COREFIR_ACT1; + RECOVERABLE: COREFIR & ~COREFIR_MASK & ~COREFIR_ACT0 & COREFIR_ACT1; +}; + +group gCoreFir filter singlebit +{ + /** COREFIR[0] + * IFU_SRAM_PARITY_ERR: SRAM recoverable error (ICACHE parity error, etc.) + */ + (CoreFir, bit(0)) ? TBDDefaultCallout; + + /** COREFIR[1] + * IF_SETDELETE_ERR: set deleted + */ + (CoreFir, bit(1)) ? TBDDefaultCallout; + + /** COREFIR[2] + * IF_RFILE_REC_ERR: RegFile recoverable error + */ + (CoreFir, bit(2)) ? TBDDefaultCallout; + + /** COREFIR[3] + * IF_RFILE_CHKSTOP_ERR: RegFile core check stop + */ + (CoreFir, bit(3)) ? TBDDefaultCallout; + + /** COREFIR[4] + * IF_LOG_REC_ERR: logic recoverable error + */ + (CoreFir, bit(4)) ? TBDDefaultCallout; + + /** COREFIR[5] + * IF_LOG_CHKSTOP_ERR: logic core check stop + */ + (CoreFir, bit(5)) ? TBDDefaultCallout; + + /** COREFIR[6] + * IF_NOT_MT_REC_ERR: recoverable if not in MT window + */ + (CoreFir, bit(6)) ? TBDDefaultCallout; + + /** COREFIR[7] + * IF_CHKSTOP_ERR: system check stop + */ + (CoreFir, bit(7)) ? TBDDefaultCallout; + + /** COREFIR[8] + * RECOV_FIR_CHKSTOP_ERR: recovery core check stop + */ + (CoreFir, bit(8)) ? TBDDefaultCallout; + + /** COREFIR[9] + * SD_RFILE_REC_ERR: RegFile recoverable error + */ + (CoreFir, bit(9)) ? TBDDefaultCallout; + + /** COREFIR[10] + * SD_RFILE_CHKSTOP_ERR: RegFile core check stop (mapper error) + */ + (CoreFir, bit(10)) ? TBDDefaultCallout; + + /** COREFIR[11] + * SD_LOG_REC_ERR: logic recoverable error + */ + (CoreFir, bit(11)) ? TBDDefaultCallout; + + /** COREFIR[12] + * SD_LOG_CHKSTOP_ERR: logic core check stop + */ + (CoreFir, bit(12)) ? TBDDefaultCallout; + + /** COREFIR[13] + * SD_NOT_MT_REC_ERR: recoverable if not in MT window + */ + (CoreFir, bit(13)) ? TBDDefaultCallout; + + /** COREFIR[14] + * SD_MCHK_AND_ME_EQ_0: MCHK received while ME=0 non recoverable + */ + (CoreFir, bit(14)) ? TBDDefaultCallout; + + /** COREFIR[15] + * SD_PC_L2_UE_ERR: UE from L2 + */ + (CoreFir, bit(15)) ? TBDDefaultCallout; + + /** COREFIR[16] + * ISU_L2_UE_OVER_TH_ERR: Number of UEs from L2 above threshold + */ + (CoreFir, bit(16)) ? TBDDefaultCallout; + + /** COREFIR[17] + * SD_PC_CI_UE: UE on CI load + */ + (CoreFir, bit(17)) ? TBDDefaultCallout; + + /** COREFIR[19] + * FX_GPR_REC_ERR: GPR recoverable error + */ + (CoreFir, bit(19)) ? TBDDefaultCallout; + + /** COREFIR[21] + * FX_LOG_CHKSTOP_ERR: logic core check stop + */ + (CoreFir, bit(21)) ? TBDDefaultCallout; + + /** COREFIR[22] + * FX_NOT_MT_REC_ERR: recoverable if not in MT window + */ + (CoreFir, bit(22)) ? TBDDefaultCallout; + + /** COREFIR[23] + * VS_VRF_REC_ERR: VRF recoverable error + */ + (CoreFir, bit(23)) ? TBDDefaultCallout; + + /** COREFIR[24] + * VS_LOG_REC_ERR: logic recoverable error + */ + (CoreFir, bit(24)) ? TBDDefaultCallout; + + /** COREFIR[25] + * VS_LOG_CHKSTOP_ERR: logic core check stop + */ + (CoreFir, bit(25)) ? TBDDefaultCallout; + + /** COREFIR[26] + * RECOV_IN_MAINT_ERR: 26 = recov_in_maint + */ + (CoreFir, bit(26)) ? TBDDefaultCallout; + + /** COREFIR[27] + * DU_LOG_REC_ERR: logic recoverable error + */ + (CoreFir, bit(27)) ? TBDDefaultCallout; + + /** COREFIR[28] + * DU_LOG_CHKSTOP_ERR: logic core check stop + */ + (CoreFir, bit(28)) ? TBDDefaultCallout; + + /** COREFIR[29] + * LSU_SRAM_PARITY_ERR: SRAM recoverable error (DCACHE parity error, etc.) + */ + (CoreFir, bit(29)) ? TBDDefaultCallout; + + /** COREFIR[30] + * LS_SETDELETE_ERR: set deleted + */ + (CoreFir, bit(30)) ? TBDDefaultCallout; + + /** COREFIR[31] + * LS_RFILE_REC_ERR: RegFile recoverable error + */ + (CoreFir, bit(31)) ? TBDDefaultCallout; + + /** COREFIR[32] + * LS_RFILE_CHKSTOP_ERR: RegFile core check stop + */ + (CoreFir, bit(32)) ? TBDDefaultCallout; + + /** COREFIR[33] + * LS_TLB_MULTIHIT_ERR: special recovery error TLB multi hit error occurred + */ + (CoreFir, bit(33)) ? TBDDefaultCallout; + + /** COREFIR[34] + * LS_SLB_MULTIHIT_ERR: special recovery error SLBFEE multi hit error occurred + */ + (CoreFir, bit(34)) ? TBDDefaultCallout; + + /** COREFIR[35] + * LS_DERAT_MULTIHIT_ERR: special recovery error ERAT multi hit error occurred + */ + (CoreFir, bit(35)) ? TBDDefaultCallout; + + /** COREFIR[36] + * FORWARD_PROGRESS_ERR: forward progress error + */ + (CoreFir, bit(36)) ? TBDDefaultCallout; + + /** COREFIR[37] + * LS_LOG_REC_ERR: logic recoverable error + */ + (CoreFir, bit(37)) ? TBDDefaultCallout; + + /** COREFIR[38] + * LS_LOG_CHKSTOP_ERR: logic core check stop + */ + (CoreFir, bit(38)) ? TBDDefaultCallout; + + /** COREFIR[39] + * LS_NOT_MT_REC_ERR: recoverable if not in MT window + */ + (CoreFir, bit(39)) ? TBDDefaultCallout; + + /** COREFIR[40] + * LS_NOT_CI_REC_ERR: recoverable if not in CI window + */ + (CoreFir, bit(40)) ? TBDDefaultCallout; + + /** COREFIR[41] + * LS_CHKSTOP_ERR: system check stop + */ + (CoreFir, bit(41)) ? TBDDefaultCallout; + + /** COREFIR[42] + * LS_GPR_RCV_CHKSTOP_ERR: UE from GPR/VRF recovery process + */ + (CoreFir, bit(42)) ? TBDDefaultCallout; + + /** COREFIR[43] + * THREAD_HANG_REC_ERR: thread hang recoverable error + */ + (CoreFir, bit(43)) ? TBDDefaultCallout; + + /** COREFIR[44] + * FIR_LOG_RECOV_ERR: logic recoverable error + */ + (CoreFir, bit(44)) ? TBDDefaultCallout; + + /** COREFIR[45] + * PC_LOG_CHKSTOP_ERR: PC logic core check stop + */ + (CoreFir, bit(45)) ? TBDDefaultCallout; + + /** COREFIR[47] + * TFC_FIR_TFMR_P_ERR: TFMR Parity Error (timing facility may be corrupt) + */ + (CoreFir, bit(47)) ? TBDDefaultCallout; + + /** COREFIR[48] + * SPRD_FIR_HYP_RES_P_ERR: Hypervisor Resource error - core check stop + */ + (CoreFir, bit(48)) ? TBDDefaultCallout; + + /** COREFIR[49] + * TFC_FIR_P_ERR: TFAC parity error + */ + (CoreFir, bit(49)) ? TBDDefaultCallout; + + /** COREFIR[50] + * TFC_FIR_CONTROL_ERR: TFAC control error + */ + (CoreFir, bit(50)) ? TBDDefaultCallout; + + /** COREFIR[51] + * PC_FIRM_AND_SEL_ERR: TFAC firmware error and select error + */ + (CoreFir, bit(51)) ? TBDDefaultCallout; + + /** COREFIR[52] + * CORE_HUNG: Hang recovery failed (core check stop) + */ + (CoreFir, bit(52)) ? TBDDefaultCallout; + + /** COREFIR[53] + * CORE_HANG_DETECT: Internal hang detected (core hang) + */ + (CoreFir, bit(53)) ? TBDDefaultCallout; + + /** COREFIR[54] + * AMBI_HANG_DETECT: Hang detected unknown source + */ + (CoreFir, bit(54)) ? TBDDefaultCallout; + + /** COREFIR[55] + * NEST_HANG_DETECT: External Hang detected + */ + (CoreFir, bit(55)) ? TBDDefaultCallout; + + /** COREFIR[59] + * PC_SOM_ERR: SCOM satellite error detected + */ + (CoreFir, bit(59)) ? TBDDefaultCallout; + + /** COREFIR[60] + * DBG_FIR_CHECKSTOP_ON_TRIGGER: debug Trigger Error inject + */ + (CoreFir, bit(60)) ? TBDDefaultCallout; + + /** COREFIR[61] + * SP_INJ_REC_ERR: SCOM or Firmware recoverable Error Inject + */ + (CoreFir, bit(61)) ? TBDDefaultCallout; + + /** COREFIR[62] + * SP_INJ_XSTOP_ERR: Firmware Xstop Error Inject + */ + (CoreFir, bit(62)) ? TBDDefaultCallout; + + /** COREFIR[63] + * SPRD_PHYP_ERR_INJ: Phyp Xstop via SPRC / SPRD + */ + (CoreFir, bit(63)) ? TBDDefaultCallout; +}; + +################################################################################ +# EX Chiplet L2FIR +################################################################################ + +rule L2Fir +{ + CHECK_STOP: L2FIR & ~L2FIR_MASK & ~L2FIR_ACT0 & ~L2FIR_ACT1; + RECOVERABLE: L2FIR & ~L2FIR_MASK & ~L2FIR_ACT0 & L2FIR_ACT1; +}; + +group gL2Fir filter singlebit +{ + /** L2FIR[0] + * CACHE_RD_CE + */ + (L2Fir, bit(0)) ? TBDDefaultCallout; + + /** L2FIR[1] + * CACHE_RD_UE + */ + (L2Fir, bit(1)) ? TBDDefaultCallout; + + /** L2FIR[2] + * CACHE_RD_SUE + */ + (L2Fir, bit(2)) ? TBDDefaultCallout; + + /** L2FIR[3] + * HW_DIR_INTIATED_LINE_DELETE_OCCURRED + */ + (L2Fir, bit(3)) ? TBDDefaultCallout; + + /** L2FIR[4] + * CACHE_UE_SUE_DETECTED_ON_MODIFIED_LINE_BY_CO + */ + (L2Fir, bit(4)) ? TBDDefaultCallout; + + /** L2FIR[5] + * CACHE_UE_SUE_DETECTED_ON_NON_MODIFIED_LINE_BY_CO + */ + (L2Fir, bit(5)) ? TBDDefaultCallout; + + /** L2FIR[6] + * DIR_CE_DETECTED + */ + (L2Fir, bit(6)) ? TBDDefaultCallout; + + /** L2FIR[7] + * DIR_UE_DETECTED + */ + (L2Fir, bit(7)) ? TBDDefaultCallout; + + /** L2FIR[8] + * DIR_STUCK_BIT_CE + */ + (L2Fir, bit(8)) ? TBDDefaultCallout; + + /** L2FIR[9] + * DIR_SBCE_REPAIR_FAILED + */ + (L2Fir, bit(9)) ? TBDDefaultCallout; + + /** L2FIR[10] + * MULTIPLE_DIR_ERRORS_DETECTED + */ + (L2Fir, bit(10)) ? TBDDefaultCallout; + + /** L2FIR[11] + * LRU_READ_ERROR_DETECTED + */ + (L2Fir, bit(11)) ? TBDDefaultCallout; + + /** L2FIR[12] + * RC_POWERBUS_DATA_TIMEOUT + */ + (L2Fir, bit(12)) ? TBDDefaultCallout; + + /** L2FIR[13] + * NCU_POWERBUS_DATA_TIMEOUT + */ + (L2Fir, bit(13)) ? TBDDefaultCallout; + + /** L2FIR[14] + * HW_CONTROL_ERROR + */ + (L2Fir, bit(14)) ? TBDDefaultCallout; + + /** L2FIR[15] + * LRU_ALL_MEMBERS_IN_CGC_ARE_LINE_DELETED + */ + (L2Fir, bit(15)) ? TBDDefaultCallout; + + /** L2FIR[16] + * CACHE_INHIBITED_HIT_CACHEABLE_ERROR + */ + (L2Fir, bit(16)) ? TBDDefaultCallout; + + /** L2FIR[17] + * RC_LOAD_RECIVED_PB_CRESP_ADR_ERR + */ + (L2Fir, bit(17)) ? TBDDefaultCallout; + + /** L2FIR[18] + * RC_STORE_RECIVED_PB_CRESP_ADR_ERR + */ + (L2Fir, bit(18)) ? TBDDefaultCallout; + + /** L2FIR[19] + * RC_POWBUS_DATA_CE_ERR_FROM_F2CHK + */ + (L2Fir, bit(19)) ? TBDDefaultCallout; + + /** L2FIR[20] + * RC_POWBUS_DATA_UE_ERR_FROM_F2CHK + */ + (L2Fir, bit(20)) ? TBDDefaultCallout; + + /** L2FIR[21] + * RC_POWBUS_DATA_SUE_ERR_FROM_F2CHK + */ + (L2Fir, bit(21)) ? TBDDefaultCallout; + + /** L2FIR[22] + * CO_ICSW_UE_SUE_DATA_ERR_FROM_F2CHK + */ + (L2Fir, bit(22)) ? TBDDefaultCallout; + + /** L2FIR[23] + * RC_LOAD_RECIVED_PB_CRESP_ADR_ERR_FOR_HYP + */ + (L2Fir, bit(23)) ? TBDDefaultCallout; + + /** L2FIR[24] + * RCDAT_RD_PARITY_ERR + */ + (L2Fir, bit(24)) ? TBDDefaultCallout; + + /** L2FIR[25] + * CO_ICSW_RTY_BUSY_ABT_ERR + */ + (L2Fir, bit(25)) ? TBDDefaultCallout; + + /** L2FIR[26] + * HA_LOG_STOP_SW_ERR + */ + (L2Fir, bit(26)) ? TBDDefaultCallout; + + /** L2FIR[27] + * RC_LOAD_RECEIVED_PB_ACK_DEAD_FROM_FOREIGN0 + */ + (L2Fir, bit(27)) ? TBDDefaultCallout; + + /** L2FIR[28] + * RC_LOAD_RECEIVED_PB_ACK_DEAD_FROM_FOREIGN1 + */ + (L2Fir, bit(28)) ? TBDDefaultCallout; + + /** L2FIR[29] + * RC_STORE_RECEIVED_PB_ACK_DEAD_FROM_FOREIGN0 + */ + (L2Fir, bit(29)) ? TBDDefaultCallout; + + /** L2FIR[30] + * RC_STORE_RECEIVED_PB_ACK_DEAD_FROM_FOREIGN1 + */ + (L2Fir, bit(30)) ? TBDDefaultCallout; + + /** L2FIR[31] + * ILLEGAL_MPALOG_TPID_SW_ERR + */ + (L2Fir, bit(31)) ? TBDDefaultCallout; + + /** L2FIR[32] + * UNEXP_HA_ST_ERR + */ + (L2Fir, bit(32)) ? TBDDefaultCallout; + + /** L2FIR[33] + * HA_LINE_IN_CONS_CACHE_ERR + */ + (L2Fir, bit(33)) ? TBDDefaultCallout; + + /** L2FIR[34] + * HA_TABLE_IN_PROD_CACHE_ERR + */ + (L2Fir, bit(34)) ? TBDDefaultCallout; + + /** L2FIR[35] + * ILLEGAL_LOG_STOP_SW_ERR + */ + (L2Fir, bit(35)) ? TBDDefaultCallout; + + /** L2FIR[48] + * SCOM_ERR1: scom error + */ + (L2Fir, bit(48)) ? TBDDefaultCallout; + + /** L2FIR[49] + * SCOM_ERR2: scom error + */ + (L2Fir, bit(49)) ? TBDDefaultCallout; +}; + +################################################################################ +# EX Chiplet L3FIR +################################################################################ + +rule L3Fir +{ + CHECK_STOP: L3FIR & ~L3FIR_MASK & ~L3FIR_ACT0 & ~L3FIR_ACT1; + RECOVERABLE: L3FIR & ~L3FIR_MASK & ~L3FIR_ACT0 & L3FIR_ACT1; +}; + +group gL3Fir filter singlebit +{ + /** L3FIR[0] + * Reserved field (Access type is pb_cmd_err) + */ + (L3Fir, bit(0)) ? TBDDefaultCallout; + + /** L3FIR[1] + * Reserved field (Access type is pb_data_err) + */ + (L3Fir, bit(1)) ? TBDDefaultCallout; + + /** L3FIR[2] + * Reserved field (Access type is l3_spare_error1) + */ + (L3Fir, bit(2)) ? TBDDefaultCallout; + + /** L3FIR[3] + * Reserved field (Access type is l3_spare_error1) + */ + (L3Fir, bit(3)) ? TBDDefaultCallout; + + /** L3FIR[4] + * Reserved field (Access type is l3_cac_rd_ce_det_not_lindel_req) + */ + (L3Fir, bit(4)) ? TBDDefaultCallout; + + /** L3FIR[5] + * Reserved field (Access type is l3_cac_rd_ue_det) + */ + (L3Fir, bit(5)) ? TBDDefaultCallout; + + /** L3FIR[6] + * Reserved field (Access type is l3_cac_rd_sue_det) + */ + (L3Fir, bit(6)) ? TBDDefaultCallout; + + /** L3FIR[7] + * Reserved field (Access type is l3_cac_wr_data_ce_from_pb) + */ + (L3Fir, bit(7)) ? TBDDefaultCallout; + + /** L3FIR[8] + * Reserved field (Access type is l3_cac_wr_data_ue_from_pb) + */ + (L3Fir, bit(8)) ? TBDDefaultCallout; + + /** L3FIR[9] + * Reserved field (Access type is l3_cac_wr_data_sue_from_pb) + */ + (L3Fir, bit(9)) ? TBDDefaultCallout; + + /** L3FIR[10] + * Reserved field (Access type is l3_cac_wr_data_ce_from_l2) + */ + (L3Fir, bit(10)) ? TBDDefaultCallout; + + /** L3FIR[11] + * Reserved field (Access type is l3_cac_wr_data_ue_from_l2) + */ + (L3Fir, bit(11)) ? TBDDefaultCallout; + + /** L3FIR[12] + * Reserved field (Access type is l3_cac_wr_data_sue_from_l2) + */ + (L3Fir, bit(12)) ? TBDDefaultCallout; + + /** L3FIR[13] + * Reserved field (Access type is l3_dir_rd_ce_det) + */ + (L3Fir, bit(13)) ? TBDDefaultCallout; + + /** L3FIR[14] + * Reserved field (Access type is l3_dir_rd_ue_det) + */ + (L3Fir, bit(14)) ? TBDDefaultCallout; + + /** L3FIR[15] + * Reserved field (Access type is l3_dir_rd_phantom_error) + */ + (L3Fir, bit(15)) ? TBDDefaultCallout; + + /** L3FIR[16] + * Reserved field (Access type is l3_co_sn_cresp_addr_err) + */ + (L3Fir, bit(16)) ? TBDDefaultCallout; + + /** L3FIR[17] + * Reserved field (Access type is l3_pf_cresp_addr_err) + */ + (L3Fir, bit(17)) ? TBDDefaultCallout; + + /** L3FIR[18] + * Reserved field (Access type is l3_addr_hang_detected) + */ + (L3Fir, bit(18)) ? TBDDefaultCallout; + + /** L3FIR[19] + * Reserved field (Access type is l3_flink_0_load_ack_dead) + */ + (L3Fir, bit(19)) ? TBDDefaultCallout; + + /** L3FIR[20] + * Reserved field (Access type is l3_flink_0_store_ack_dead) + */ + (L3Fir, bit(20)) ? TBDDefaultCallout; + + /** L3FIR[21] + * Reserved field (Access type is l3_flink_1_load_ack_dead) + */ + (L3Fir, bit(21)) ? TBDDefaultCallout; + + /** L3FIR[22] + * Reserved field (Access type is l3_flink_1_store_ack_dead) + */ + (L3Fir, bit(22)) ? TBDDefaultCallout; + + /** L3FIR[23] + * Reserved field (Access type is l3_mach_hang_detected) + */ + (L3Fir, bit(23)) ? TBDDefaultCallout; + + /** L3FIR[24] + * Reserved field (Access type is l3_hw_control_err) + */ + (L3Fir, bit(24)) ? TBDDefaultCallout; + + /** L3FIR[25] + * Reserved field (Access type is l3_snoop_sw_err_detected) + */ + (L3Fir, bit(25)) ? TBDDefaultCallout; + + /** L3FIR[26] + * Reserved field (Access type is l3_line_del_ce_done) + */ + (L3Fir, bit(26)) ? TBDDefaultCallout; + + /** L3FIR[27] + * Reserved field (Access type is l3_dram_error) + */ + (L3Fir, bit(27)) ? TBDDefaultCallout; + + /** L3FIR[28] + * Reserved field (Access type is l3_lru_error) + */ + (L3Fir, bit(28)) ? TBDDefaultCallout; + + /** L3FIR[29] + * Reserved field (Access type is l3_all_members_deleted_error) + */ + (L3Fir, bit(29)) ? TBDDefaultCallout; + + /** L3FIR[30] + * Reserved field (Access type is l3_refresh_timer_error) + */ + (L3Fir, bit(30)) ? TBDDefaultCallout; + + /** L3FIR[31] + * Reserved field (Access type is l3_ha_consumer_sw_access_err) + */ + (L3Fir, bit(31)) ? TBDDefaultCallout; + + /** L3FIR[32] + * Reserved field (Access type is l3_ha_producer_sw_access_err) + */ + (L3Fir, bit(32)) ? TBDDefaultCallout; + + /** L3FIR[33] + * Reserved field (Access type is l3_ha_line_in_consumer_cac_err) + */ + (L3Fir, bit(33)) ? TBDDefaultCallout; + + /** L3FIR[34] + * Reserved field (Access type is l3_ha_table_in_producer_cac_err) + */ + (L3Fir, bit(34)) ? TBDDefaultCallout; + + /** L3FIR[35] + * Reserved field (Access type is l3_ha_log_overflow_err) + */ + (L3Fir, bit(35)) ? TBDDefaultCallout; + + /** L3FIR[36] + * Reserved field (Access type is scom_err) + */ + (L3Fir, bit(36)) ? TBDDefaultCallout; +}; + +################################################################################ +# EX Chiplet NCUFIR +################################################################################ + +rule NcuFir +{ + CHECK_STOP: NCUFIR & ~NCUFIR_MASK & ~NCUFIR_ACT0 & ~NCUFIR_ACT1; + RECOVERABLE: NCUFIR & ~NCUFIR_MASK & ~NCUFIR_ACT0 & NCUFIR_ACT1; +}; + +group gNcuFir filter singlebit +{ + /** NCUFIR[0] + * CONTROL_ERR: H/W control error. + */ + (NcuFir, bit(0)) ? TBDDefaultCallout; + + /** NCUFIR[1] + * TLBIE_SW_ERR: TLBIE received illegal AP/LP field from core. + */ + (NcuFir, bit(1)) ? TBDDefaultCallout; + + /** NCUFIR[2] + * ST_ADDR_ERR: Store address machine or TLBIE/sync machine received addr_err cresp. + */ + (NcuFir, bit(2)) ? TBDDefaultCallout; + + /** NCUFIR[3] + * LD_ADDR_ERR: Load address machine received addr_err cresp. + */ + (NcuFir, bit(3)) ? TBDDefaultCallout; + + /** NCUFIR[4] + * ST_FOREIGN0_ACK_DEAD: Store received ack_dead on foreign link0. + */ + (NcuFir, bit(4)) ? TBDDefaultCallout; + + /** NCUFIR[5] + * ST_FOREIGN1_ACK_DEAD: Store received ack_dead on foreign link1. + */ + (NcuFir, bit(5)) ? TBDDefaultCallout; + + /** NCUFIR[6] + * LD_FOREIGN0_ACK_DEAD: Load received ack_dead on foreign link0. + */ + (NcuFir, bit(6)) ? TBDDefaultCallout; + + /** NCUFIR[7] + * LD_FOREIGN1_ACK_DEAD: Load received ack_dead on foreign link1. + */ + (NcuFir, bit(7)) ? TBDDefaultCallout; + + /** NCUFIR[8] + * STQ_DATA_PARITY_ERR: Store data parity error from regfile detected. + */ + (NcuFir, bit(8)) ? TBDDefaultCallout; + + /** NCUFIR[9] + * STORE_TIMEOUT: Store timed out on PB. + */ + (NcuFir, bit(9)) ? TBDDefaultCallout; + + /** NCUFIR[10] + * TLBIE_MASTER_TIMEOUT: TLBIE master timed out on PB. + */ + (NcuFir, bit(10)) ? TBDDefaultCallout; + + /** NCUFIR[11] + * TLBIE_SNOOP_TIMEOUT: TLBIE snooper timed out waiting for core. + */ + (NcuFir, bit(11)) ? TBDDefaultCallout; + + /** NCUFIR[12] + * HTM_IMA_TIMEOUT: HTM/IMA address machine timed out on PB. + */ + (NcuFir, bit(12)) ? TBDDefaultCallout; + + /** NCUFIR[13] + * IMA_CRESP_ADDR_ERR: IMA received addr_err cresp. + */ + (NcuFir, bit(13)) ? TBDDefaultCallout; + + /** NCUFIR[14] + * IMA_FOREIGN0_ACK_DEAD: IMA received ack_dead on foreign link0. + */ + (NcuFir, bit(14)) ? TBDDefaultCallout; + + /** NCUFIR[15] + * IMA_FOREIGN1_ACK_DEAD: IMA received ack_dead on foreign link1. + */ + (NcuFir, bit(15)) ? TBDDefaultCallout; + + /** NCUFIR[16] + * HTM_GOT_ACK_DEAD: HTM received ack_dead on any foreign link. + */ + (NcuFir, bit(16)) ? TBDDefaultCallout; + + /** NCUFIR[17] + * PMISC_CRESP_ADDR_ERR: PMISC received address error cresp. + */ + (NcuFir, bit(17)) ? TBDDefaultCallout; + + /** NCUFIR[18] + * TLBIE_CONTROL_ERR: TLBIE control error. + */ + (NcuFir, bit(28)) ? TBDDefaultCallout; + + /** NCUFIR[24] + * SCOM_ERR1: scom erro + */ + (NcuFir, bit(24)) ? TBDDefaultCallout; + + /** NCUFIR[25] + * SCOM_ERR2: scom error + */ + (NcuFir, bit(25)) ? TBDDefaultCallout; +}; + + ############################################################################## + # # + # # ### # + # # # ## ##### ### ### # # # # # # ### ### ### ### # + # # # # # # # # # ## # # # # # # # # # # + # ####### # # # # # # # # # # ##### ### ### ## ### # + # # # # # # # # # # ## # # # # # # # # # # + # # # ## # ### ### # # ### ### # # ### ### ### ### # + # # + ############################################################################## + +# Include the common action set. +.include "CommonActions.rule" + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Mba.rule b/src/usr/diag/prdf/common/plat/pegasus/Mba.rule new file mode 100755 index 000000000..8798e5c8a --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Mba.rule @@ -0,0 +1,716 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Mba.rule $ +# +# 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 + +################################################################################ +# +# Scope: +# Registers and actions for the following chiplets: +# +# Chiplet Register Addresses Description +# ======= ======================= ============================================ +# MEM 0x03010400 - 0x0301043F MBA 01 +# MEM 0x03010600 - 0x0301063F MBA 01 MCBIST +# MEM 0x03010C00 - 0x03010C3F MBA 23 +# MEM 0x03010E00 - 0x03010E3F MBA 23 MCBIST +# +################################################################################ + +chip Mba +{ + name "Centaur MBA Chiplet"; + targettype TYPE_MBA; + sigoff 0x8000; +# FIXME May need to update dump type + dump DUMP_CONTENT_HWSUPERNOVA; + scomlen 64; + + ############################################################################# + # # + # ###### # + # # # ###### #### ### #### ##### ###### ##### #### # + # # # # # # # # # # # # # # + # ###### ##### # # #### # ##### # # #### # + # # # # # ### # # # # ##### # # + # # # # # # # # # # # # # # # # + # # # ###### #### ### #### # ###### # # #### # + # # + ############################################################################# + + ############################################################################ + # MEM Chiplet MBAFIR + ############################################################################ + + register MBAFIR + { + name "MBU.MBA01.MBA_MCBIST.SCOMFIR.MBAFIRQ"; + scomaddr 0x03010600; + reset (&, 0x03010601); + mask (|, 0x03010605); + capture group default; + }; + + register MBAFIR_MASK + { + name "MBU.MBA01.MBA_MCBIST.SCOMFIR.MBAFIRMASK"; + scomaddr 0x03010603; + capture type secondary; + capture group default; + }; + + register MBAFIR_ACT0 + { + name "MBU.MBA01.MBA_MCBIST.SCOMFIR.MBAFIRACT0"; + scomaddr 0x03010606; + capture type secondary; + capture group default; + }; + + register MBAFIR_ACT1 + { + name "MBU.MBA01.MBA_MCBIST.SCOMFIR.MBAFIRACT1"; + scomaddr 0x03010607; + capture type secondary; + capture group default; + }; + + ############################################################################ + # MEM Chiplet MBASECUREFIR + ############################################################################ + + register MBASECUREFIR + { + name "MBU.MBA01.MBA_SRQ.MBASIRQ"; + scomaddr 0x0301041b; + reset (&, 0x0301041c); + # This is a special register in which we are not able to mask. All bits + # in this register should be set to checkstop so we will not need to + # mask anyway. + capture group default; + }; + + register MBASECUREFIR_MASK + { + name "MBU.MBA01.MBA_SRQ.MBASIRMASK"; + scomaddr 0x0301041e; + capture type secondary; + capture group default; + }; + + register MBASECUREFIR_ACT0 + { + name "MBU.MBA01.MBA_SRQ.MBASIRACT0"; + scomaddr 0x03010421; + capture type secondary; + capture group default; + }; + + register MBASECUREFIR_ACT1 + { + name "MBU.MBA01.MBA_SRQ.MBASIRACT1"; + scomaddr 0x03010422; + capture type secondary; + capture group default; + }; + + ############################################################################ + # MEM Chiplet DDRPHYFIR + ############################################################################ + + register MBADDRPHYFIR + { + name "DPHY01.PHY01_DDRPHY_FIR_REG"; + scomaddr 0x800200900301143F; + reset (&, 0x800200910301143F); + mask (|, 0x800200950301143F); + capture group default; + }; + + register MBADDRPHYFIR_MASK + { + name "DPHY01.PHY01_DDRPHY_FIR_MASK_REG"; + scomaddr 0x800200930301143F; + capture type secondary; + capture group default; + }; + + register MBADDRPHYFIR_ACT0 + { + name "DPHY01.PHY01_DDRPHY_FIR_ACTION0_REG"; + scomaddr 0x800200960301143F; + capture type secondary; + capture group default; + }; + + register MBADDRPHYFIR_ACT1 + { + name "DPHY01.PHY01_DDRPHY_FIR_ACTION1_REG"; + scomaddr 0x800200970301143F; + capture type secondary; + capture group default; + }; + + ############################################################################ + # MEM Chiplet MBACALFIR + ############################################################################ + + register MBACALFIR + { + name "MBU.MBA01.MBA_SRQ.MBACALFIRQ"; + scomaddr 0x03010400; + reset (&, 0x03010401); + mask (|, 0x03010405); + capture group default; + }; + + register MBACALFIR_MASK + { + name "MBU.MBA01.MBA_SRQ.MBACALFIR_MASK"; + scomaddr 0x03010403; + capture type secondary; + capture group default; + }; + + register MBACALFIR_ACT0 + { + name "MBU.MBA01.MBA_SRQ.MBACALFIR_ACTION0"; + scomaddr 0x03010406; + capture type secondary; + capture group default; + }; + + register MBACALFIR_ACT1 + { + name "MBU.MBA01.MBA_SRQ.MBACALFIR_ACTION1"; + scomaddr 0x03010407; + capture type secondary; + capture group default; + }; + + ############################################################################ + # MEM Chiplet MBASPA + ############################################################################ + + register MBASPA + { + name "MBU.MBA01.MBA_MCBIST.SCOMFIR.MBSPAQ"; + scomaddr 0x03010611; + reset (&, 0x03010612); + #FIXME : There is no OR register for mask. Is it right to use mask register value + mask (|, 0x03010614); + capture group default; + }; + + register MBASPA_MASK + { + name "MBU.MBA01.MBA_MCBIST.SCOMFIR.MBSPAMSKQ"; + scomaddr 0x03010614; + capture type secondary; + capture group default; + }; +}; + + ############################################################################## + # # + # #### # # + # # # # # # ##### ### # # # ## ##### ### ### # # ### # + # # # # # # # # # # # # # # # # # ## # # # + # #### # # # #### ### # ####### # # # # # # # # ### # + # # # # # # # # # # # # # # # # # # ## # # + # # # ### #### ##### ### # # # ## # ### ### # # ### # + # # + ############################################################################## + +# This group is a layer of indirection. Normally, each rule file will have a +# single global or chiplet FIR which will have group that defines which lower +# level FIRs to analyze. Unfortunately, the MBA target contains only a subset of +# the FIRs in the Centaur's MEM chiplet. So the MEM chiplet FIR's group +# definition must remain in Membuf.rule. This group will serve as a psuedo +# chiplet FIR. This group could contain the bit definitions for all of the MBA +# registers, however, we could not utilize the filter for each register. +# Instead, the bit definitions will simply analyze the respective FIR groups. +# The FIRs in this group will be analyzed in order so if a FIR should be +# analyzed before another then simply change the order of the FIRs in this +# group. + +# NOTE: The rule definition for this group must be different than that of the +# individual FIR groups. Otherwise, it causes hashing collisions in the +# signatures. In this case, we will add the SPECIAL attention line even +# though none of these registers will trigger a special attention. This +# should change the hash enough to make a unique signature. + +rule tmpMbaFir +{ + CHECK_STOP: MBAFIR & ~MBAFIR_MASK & ~MBAFIR_ACT0 & ~MBAFIR_ACT1; + RECOVERABLE: MBAFIR & ~MBAFIR_MASK & ~MBAFIR_ACT0 & MBAFIR_ACT1; + SPECIAL: MBAFIR; # See note above. +}; + +rule tmpMbaSecureFir +{ + CHECK_STOP: + MBASECUREFIR & ~MBASECUREFIR_MASK & ~MBASECUREFIR_ACT0 & ~MBASECUREFIR_ACT1; + # NOTE: This secure FIR will only report checkstop attentions. + SPECIAL: + MBASECUREFIR; # See note above. +}; + +rule tmpMbaCalFir +{ + CHECK_STOP: MBACALFIR & ~MBACALFIR_MASK & ~MBACALFIR_ACT0 & ~MBACALFIR_ACT1; + RECOVERABLE: MBACALFIR & ~MBACALFIR_MASK & ~MBACALFIR_ACT0 & MBACALFIR_ACT1; + SPECIAL: MBACALFIR; # See note above. +}; + +rule tmpMbaDdrPhyFir +{ + CHECK_STOP: + MBADDRPHYFIR & ~MBADDRPHYFIR_MASK & ~MBADDRPHYFIR_ACT0 & ~MBADDRPHYFIR_ACT1; + RECOVERABLE: + MBADDRPHYFIR & ~MBADDRPHYFIR_MASK & ~MBADDRPHYFIR_ACT0 & MBADDRPHYFIR_ACT1; + SPECIAL: + MBADDRPHYFIR; # See note above. +}; + +group gMBA attntype CHECK_STOP, RECOVERABLE filter singlebit +{ + (tmpMbaFir, bit( 0| 1| 2| 3| 4| 5| 6| 7| 8| 9| + 10|11|12|13|14|15|16|17|18|19| + 20|21|22|23|24|25|26|27|28|29| + 30|31|32|33|34|35|36|37|38|39| + 40|41|42|43|44|45|46|47|48|49| + 50|51|52|53|54|55|56|57|58|59| + 60|61|62|63 )) ? analyze(gMbaFir); + + (tmpMbaSecureFir, bit( 0| 1| 2| 3| 4| 5| 6| 7| 8| 9| + 10|11|12|13|14|15|16|17|18|19| + 20|21|22|23|24|25|26|27|28|29| + 30|31|32|33|34|35|36|37|38|39| + 40|41|42|43|44|45|46|47|48|49| + 50|51|52|53|54|55|56|57|58|59| + 60|61|62|63 )) ? analyze(gMbaSecureFir); + + (tmpMbaDdrPhyFir, bit( 0| 1| 2| 3| 4| 5| 6| 7| 8| 9| + 10|11|12|13|14|15|16|17|18|19| + 20|21|22|23|24|25|26|27|28|29| + 30|31|32|33|34|35|36|37|38|39| + 40|41|42|43|44|45|46|47|48|49| + 50|51|52|53|54|55|56|57|58|59| + 60|61|62|63 )) ? analyze(gMbaDdrPhyFir); + + (tmpMbaCalFir, bit( 0| 1| 2| 3| 4| 5| 6| 7| 8| 9| + 10|11|12|13|14|15|16|17|18|19| + 20|21|22|23|24|25|26|27|28|29| + 30|31|32|33|34|35|36|37|38|39| + 40|41|42|43|44|45|46|47|48|49| + 50|51|52|53|54|55|56|57|58|59| + 60|61|62|63 )) ? analyze(gMbaCalFir); +}; + +################################################################################ +# MEM Chiplet MBAFIR +################################################################################ + +rule MbaFir +{ + CHECK_STOP: MBAFIR & ~MBAFIR_MASK & ~MBAFIR_ACT0 & ~MBAFIR_ACT1; + RECOVERABLE: MBAFIR & ~MBAFIR_MASK & ~MBAFIR_ACT0 & MBAFIR_ACT1; +}; + +group gMbaFir filter singlebit +{ + /** MBAFIR[0] + * MBAFIRQ_INVALID_MAINT_CMD + */ + (MbaFir, bit(0)) ? TBDDefaultCallout; + + /** MBAFIR[1] + * MBAFIRQ_INVALID_MAINT_ADDRESS + */ + (MbaFir, bit(1)) ? TBDDefaultCallout; + + /** MBAFIR[2] + * MBAFIRQ_MULTI_ADDRESS_MAINT_TIMEOU + */ + (MbaFir, bit(2)) ? TBDDefaultCallout; + + /** MBAFIR[3] + * MBAFIRQ_INTERNAL_FSM_ERROR + */ + (MbaFir, bit(3)) ? TBDDefaultCallout; + + /** MBAFIR[4] + * MBAFIRQ_MCBIST_ERROR + */ + (MbaFir, bit(4)) ? TBDDefaultCallout; + + /** MBAFIR[5] + * MBAFIRQ_SCOM_CMD_REG_PE + */ + (MbaFir, bit(5)) ? TBDDefaultCallout; + + /** MBAFIR[6] + * MBAFIRQ_CHANNEL_CHKSTP_ERR + */ + (MbaFir, bit(6)) ? TBDDefaultCallout; + + /** MBAFIR[7] + * MBAFIRQ_WRD_CAW2_DATA_CE_UE_ERR + */ + (MbaFir, bit(7)) ? TBDDefaultCallout; + + /** MBAFIR[15] + * MBAFIRQ_INTERNAL_SCOM_ERROR + */ + (MbaFir, bit(15)) ? TBDDefaultCallout; + + /** MBAFIR[16] + * MBAFIRQ_INTERNAL_SCOM_ERROR_CLONE + */ + (MbaFir, bit(16)) ? TBDDefaultCallout; +}; + +################################################################################ +# MEM Chiplet MBASECUREFIR +################################################################################ + +rule MbaSecureFir +{ + CHECK_STOP: + MBASECUREFIR & ~MBASECUREFIR_MASK & ~MBASECUREFIR_ACT0 & ~MBASECUREFIR_ACT1; + # NOTE: This secure FIR will only report checkstop attentions. +}; + +group gMbaSecureFir filter singlebit +{ + /** MBASECUREFIR[0] + * MBASIRQ_INVALID_MBA_CAL0Q_ACCESS + */ + (MbaSecureFir, bit(0)) ? TBDDefaultCallout; + + /** MBASECUREFIR[1] + * MBASIRQ_INVALID_MBA_CAL1Q_ACCESS + */ + (MbaSecureFir, bit(1)) ? TBDDefaultCallout; + + /** MBASECUREFIR[2] + * MBASIRQ_INVALID_MBA_CAL2Q_ACCESS + */ + (MbaSecureFir, bit(2)) ? TBDDefaultCallout; + + /** MBASECUREFIR[3] + * MBASIRQ_INVALID_MBA_CAL3Q_ACCESS + */ + (MbaSecureFir, bit(3)) ? TBDDefaultCallout; + + /** MBASECUREFIR[4] + * MBASIRQ_INVALID_DDR_CONFIG_REG_ACCESS + */ + (MbaSecureFir, bit(4)) ? TBDDefaultCallout; + + /** MBASECUREFIR[5] + * MBASIRQ_INVALID_SIR_MASK_OR_ACTION_REGISTER_ACCESS + */ + (MbaSecureFir, bit(5)) ? TBDDefaultCallout; +}; + +################################################################################ +# MEM Chiplet DDRPHYFIR +################################################################################ + +rule MbaDdrPhyFir +{ + CHECK_STOP: + MBADDRPHYFIR & ~MBADDRPHYFIR_MASK & ~MBADDRPHYFIR_ACT0 & ~MBADDRPHYFIR_ACT1; + RECOVERABLE: + MBADDRPHYFIR & ~MBADDRPHYFIR_MASK & ~MBADDRPHYFIR_ACT0 & MBADDRPHYFIR_ACT1; +}; + +group gMbaDdrPhyFir filter singlebit +{ + /** MBADDRPHYFIR[48] + * PHY01_DDRPHY_FIR_REG_DDR0_FSM_CKSTP + */ + (MbaDdrPhyFir, bit(48)) ? TBDDefaultCallout; + + /** MBADDRPHYFIR[49] + * PHY01_DDRPHY_FIR_REG_DDR0_PARITY_CKSTP + */ + (MbaDdrPhyFir, bit(49)) ? TBDDefaultCallout; + + /** MBADDRPHYFIR[50] + * PHY01_DDRPHY_FIR_REG_DDR0_CALIBRATION_ERROR + */ + (MbaDdrPhyFir, bit(50)) ? TBDDefaultCallout; + + /** MBADDRPHYFIR[51] + * PHY01_DDRPHY_FIR_REG_DDR0_FSM_ERR + */ + (MbaDdrPhyFir, bit(51)) ? TBDDefaultCallout; + + /** MBADDRPHYFIR[52] + * PHY01_DDRPHY_FIR_REG_DDR0_PARITY_ERR + */ + (MbaDdrPhyFir, bit(52)) ? TBDDefaultCallout; + + /** MBADDRPHYFIR[53] + * PHY01_DDRPHY_FIR_REG_DDR01_FIR_PARITY_ERR + */ + (MbaDdrPhyFir, bit(53)) ? TBDDefaultCallout; + + /** MBADDRPHYFIR[56] + * PHY01_DDRPHY_FIR_REG_DDR1_FSM_CKSTP + */ + (MbaDdrPhyFir, bit(56)) ? TBDDefaultCallout; + + /** MBADDRPHYFIR[57] + * PHY01_DDRPHY_FIR_REG_DDR1_PARITY_CKSTP + */ + (MbaDdrPhyFir, bit(57)) ? TBDDefaultCallout; + + /** MBADDRPHYFIR[58] + * PHY01_DDRPHY_FIR_REG_DDR1_CALIBRATION_ERROR + */ + (MbaDdrPhyFir, bit(58)) ? TBDDefaultCallout; + + /** MBADDRPHYFIR[59] + * PHY01_DDRPHY_FIR_REG_DDR1_FSM_ERR + */ + (MbaDdrPhyFir, bit(59)) ? TBDDefaultCallout; + + /** MBADDRPHYFIR[60] + * PHY01_DDRPHY_FIR_REG_DDR1_PARITY_ERR + */ + (MbaDdrPhyFir, bit(60)) ? TBDDefaultCallout; +}; + +################################################################################ +# MEM Chiplet MBACALFIR +################################################################################ + +rule MbaCalFir +{ + CHECK_STOP: MBACALFIR & ~MBACALFIR_MASK & ~MBACALFIR_ACT0 & ~MBACALFIR_ACT1; + RECOVERABLE: MBACALFIR & ~MBACALFIR_MASK & ~MBACALFIR_ACT0 & MBACALFIR_ACT1; +}; + +group gMbaCalFir filter singlebit +{ + /** MBACALFIR[0] + * MBACALFIRQ_MBA_RECOVERABLE_ERROR + */ + (MbaCalFir, bit(0)) ? TBDDefaultCallout; + + /** MBACALFIR[1] + * MBACALFIRQ_MBA_NONRECOVERABLE_ERROR + */ + (MbaCalFir, bit(1)) ? TBDDefaultCallout; + + /** MBACALFIR[2] + * MBACALFIRQ_REFRESH_OVERRUN + */ + (MbaCalFir, bit(2)) ? TBDDefaultCallout; + + /** MBACALFIR[3] + * MBACALFIRQ_WAT_ERROR + */ + (MbaCalFir, bit(3)) ? TBDDefaultCallout; + + /** MBACALFIR[4] + * MBACALFIRQ_RCD_PARITY_ERROR_0 + */ + (MbaCalFir, bit(4)) ? TBDDefaultCallout; + + /** MBACALFIR[5] + * MBACALFIRQ_DDR0_CAL_TIMEOUT_ERR + */ + (MbaCalFir, bit(5)) ? TBDDefaultCallout; + + /** MBACALFIR[6] + * MBACALFIRQ_DDR1_CAL_TIMEOUT_ERR + */ + (MbaCalFir, bit(6)) ? TBDDefaultCallout; + + /** MBACALFIR[7] + * MBACALFIRQ_RCD_PARITY_ERROR_1 + */ + (MbaCalFir, bit(7)) ? TBDDefaultCallout; + + /** MBACALFIR[8] + * MBACALFIRQ_MBX_TO_MBA_PAR_ERROR + */ + (MbaCalFir, bit(8)) ? TBDDefaultCallout; + + /** MBACALFIR[9] + * MBACALFIRQ_MBA_WRD_UE + */ + (MbaCalFir, bit(9)) ? TBDDefaultCallout; + + /** MBACALFIR[10] + * MBACALFIRQ_MBA_WRD_CE + */ + (MbaCalFir, bit(10)) ? TBDDefaultCallout; + + /** MBACALFIR[11] + * MBACALFIRQ_MBA_MAINT_UE + */ + (MbaCalFir, bit(11)) ? TBDDefaultCallout; + + /** MBACALFIR[12] + * MBACALFIRQ_MBA_MAINT_CE + */ + (MbaCalFir, bit(12)) ? TBDDefaultCallout; + + /** MBACALFIR[13] + * MBACALFIRQ_DDR_CAL_RESET_TIMEOUT + */ + (MbaCalFir, bit(13)) ? TBDDefaultCallout; + + /** MBACALFIR[14] + * MBACALFIRQ_WRQ_DATA_CE + */ + (MbaCalFir, bit(14)) ? TBDDefaultCallout; + + /** MBACALFIR[15] + * MBACALFIRQ_WRQ_DATA_UE + */ + (MbaCalFir, bit(15)) ? TBDDefaultCallout; + + /** MBACALFIR[16] + * MBACALFIRQ_WRQ_DATA_SUE + */ + (MbaCalFir, bit(16)) ? TBDDefaultCallout; + + /** MBACALFIR[17] + * MBACALFIRQ_WRQ_RRQ_HANG_ERR + */ + (MbaCalFir, bit(17)) ? TBDDefaultCallout; + + /** MBACALFIR[18] + * MBACALFIRQ_SM_1HOT_ERR + */ + (MbaCalFir, bit(18)) ? TBDDefaultCallout; + + /** MBACALFIR[19] + * MBACALFIRQ_WRD_SCOM_ERROR + */ + (MbaCalFir, bit(19)) ? TBDDefaultCallout; + + /** MBACALFIR[20] + * MBACALFIRQ_INTERNAL_SCOM_ERROR + */ + (MbaCalFir, bit(20)) ? TBDDefaultCallout; + + /** MBACALFIR[21] + * MBACALFIRQ_INTERNAL_SCOM_ERROR_COPY + */ + (MbaCalFir, bit(21)) ? TBDDefaultCallout; +}; + +############################################################################### +# MEM Chiplet MBASPA +################################################################################ + +rule MbaSpa +{ + SPECIAL: MBASPA & ~MBASPA_MASK; +}; + +group gMbaSpa attntype SPECIAL filter singlebit +{ + /** MBASPA[0] + * MBSPAQ_COMMAND_COMPLETE_WO_ENA_ERR_ATTN + */ + (MbaSpa, bit(0)) ? analyzeMaintCmdComplete; + + /** MBASPA[1] + * MBSPAQ_HARD_CE_ETE_ATTN + */ + (MbaSpa, bit(1)) ? TBDDefaultCallout; + + /** MBASPA[2] + * MBSPAQ_SOFT_CE_ETE_ATTN + */ + (MbaSpa, bit(2)) ? TBDDefaultCallout; + + /** MBASPA[3] + * MBSPAQ_INTERMITTENT_ETE_ATTN + */ + (MbaSpa, bit(3)) ? TBDDefaultCallout; + + /** MBASPA[4] + * MBSPAQ_RCE_ETE_ATTN + */ + (MbaSpa, bit(4)) ? TBDDefaultCallout; + + /** MBASPA[5] + * MBSPAQ_EMERGENCY_THROTTLE_ATTN + */ + (MbaSpa, bit(5)) ? TBDDefaultCallout; + + /** MBASPA[6] + * MBSPAQ_FIRMWARE_ATTN0 + */ + (MbaSpa, bit(6)) ? TBDDefaultCallout; + + /** MBASPA[7] + * MBSPAQ_FIRMWARE_ATTN1 + */ + (MbaSpa, bit(7)) ? TBDDefaultCallout; + + /** MBASPA[8] + * MBSPAQ_WAT_DEBUG_ATTN + */ + (MbaSpa, bit(8)) ? TBDDefaultCallout; + + /** MBASPA[9] + * MBSPAQ_SPARE_ATTN1 + */ + (MbaSpa, bit(9)) ? TBDDefaultCallout; + + /** MBASPA[10] + * MBSPAQ_MCBIST_DONE + */ + (MbaSpa, bit(10)) ? TBDDefaultCallout; +}; + + ############################################################################## + # # + # # ### # + # # # ## ##### ### ### # # # # # # ### ### ### ### # + # # # # # # # # # ## # # # # # # # # # # + # ####### # # # # # # # # # # ##### ### ### ## ### # + # # # # # # # # # # ## # # # # # # # # # # + # # # ## # ### ### # # ### ### # # ### ### ### ### # + # # + ############################################################################## + +# Include the common action set. +.include "CommonActions.rule"; + +################################################################################ +# Higher level actions +################################################################################ + +/** Analyze maintenance command complete */ +actionclass analyzeMaintCmdComplete { funccall("MaintCmdComplete"); }; + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Mcs.rule b/src/usr/diag/prdf/common/plat/pegasus/Mcs.rule new file mode 100755 index 000000000..df57dc90e --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Mcs.rule @@ -0,0 +1,329 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Mcs.rule $ +# +# 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 + +################################################################################ +# +# Scope: +# Registers and actions for the following chiplets: +# Note that only addresses for MC0/MCS0 will be used. +# +# Chiplet Register Addresses Description +# ======= ======================= ============================================ +# MCS 0x02011800 - 0x0201187F MC0/MCS0 +# MCS 0x02011880 - 0x020118FF MC0/MCS1 +# MCS 0x02011900 - 0x0201197F MC1/MCS0 +# MCS 0x02011980 - 0x020119FF MC1/MCS1 +# MCS 0x02011A00 - 0x02011A3E DMI0 - DMI3 +# MCS 0x02011C00 - 0x02011C7F MC2/MCS0 +# MCS 0x02011C80 - 0x02011CFF MC2/MCS1 +# MCS 0x02011D00 - 0x02011D7F MC3/MCS0 +# MCS 0x02011D80 - 0x02011DFF MC3/MCS1 +# MCS 0x02011E00 - 0x02011E3E DMI4 - DMI7 +# +################################################################################ + +chip Mcs +{ + name "Power8 MCS Chiplet"; + targettype TYPE_MCS; + sigoff 0x8000; +# FIXME May need to update dump type + dump DUMP_CONTENT_HW; + scomlen 64; + + ############################################################################# + # # + # ###### # + # # # ###### #### ### #### ##### ###### ##### #### # + # # # # # # # # # # # # # # + # ###### ##### # # #### # ##### # # #### # + # # # # # ### # # # # ##### # # + # # # # # # # # # # # # # # # # + # # # ###### #### ### #### # ###### # # #### # + # # + ############################################################################# + + ############################################################################ + # PB Chiplet MCIFIR + ############################################################################ + + register MCIFIR + { + name "MC0.MCS0.RIGHT.MCI.SCOMFIR.MCIFIRQ"; + scomaddr 0x02011840; + reset (&, 0x02011841); + mask (|, 0x02011845); + capture group default; + }; + + register MCIFIR_AND + { + name "MC0.MCS0.RIGHT.MCI.SCOMFIR.MCIFIRQ AND"; + scomaddr 0x02011841; + capture group never; + }; + + register MCIFIR_MASK + { + name "MC0.MCS0.RIGHT.MCI.SCOMFIR.MCIFIRMASK"; + scomaddr 0x02011843; + capture type secondary; + capture group default; + }; + + register MCIFIR_ACT0 + { + name "MC0.MCS0.RIGHT.MCI.SCOMFIR.MCIFIRACT0"; + scomaddr 0x02011846; + capture type secondary; + capture group default; + }; + + register MCIFIR_ACT1 + { + name "MC0.MCS0.RIGHT.MCI.SCOMFIR.MCIFIRACT1"; + scomaddr 0x02011847; + capture type secondary; + capture group default; + }; +}; + + ############################################################################## + # # + # #### # # + # # # # # # ##### ### # # # ## ##### ### ### # # ### # + # # # # # # # # # # # # # # # # # ## # # # + # #### # # # #### ### # ####### # # # # # # # # ### # + # # # # # # # # # # # # # # # # # # ## # # + # # # ### #### ##### ### # # # ## # ### ### # # ### # + # # + ############################################################################## + +################################################################################ +# PB Chiplet MCIFIR +################################################################################ + +rule MciFir +{ + CHECK_STOP: MCIFIR & ~MCIFIR_MASK & ~MCIFIR_ACT0 & ~MCIFIR_ACT1; + RECOVERABLE: MCIFIR & ~MCIFIR_MASK & ~MCIFIR_ACT0 & MCIFIR_ACT1; + SPECIAL: MCIFIR & ~MCIFIR_MASK & MCIFIR_ACT0 & ~MCIFIR_ACT1; +}; + +group gMciFir attntype CHECK_STOP, RECOVERABLE, SPECIAL filter singlebit +{ + /** MCIFIR[0] + * MCIFIRQ_REPLAY_TIMEOUT + */ + (MciFir, bit(0)) ? TBDDefaultCallout; + + /** MCIFIR[1] + * MCIFIRQ_CHANNEL_FAIL + */ + (MciFir, bit(1)) ? TBDDefaultCallout; + + /** MCIFIR[2] + * MCIFIRQ_CRC_ERROR + */ + (MciFir, bit(2)) ? TBDDefaultCallout; + + /** MCIFIR[3] + * MCIFIRQ_FRAME_NOACK + */ + (MciFir, bit(3)) ? TBDDefaultCallout; + + /** MCIFIR[4] + * MCIFIRQ_SEQID_OUT_OF_ORDER + */ + (MciFir, bit(4)) ? TBDDefaultCallout; + + /** MCIFIR[5] + * MCIFIRQ_REPLAY_BUFFER_ECC_CE + */ + (MciFir, bit(5)) ? TBDDefaultCallout; + + /** MCIFIR[6] + * MCIFIRQ_REPLAY_BUFFER_ECC_UE + */ + (MciFir, bit(6)) ? TBDDefaultCallout; + + /** MCIFIR[7] + * MCIFIRQ_MCI_CHINIT_STATE_MACHINE_TIMEOUT + */ + (MciFir, bit(7)) ? TBDDefaultCallout; + + /** MCIFIR[8] + * MCIFIRQ_MCI_INTERNAL_CONTROL_PARITY_ERROR + */ + (MciFir, bit(8)) ? TBDDefaultCallout; + + /** MCIFIR[9] + * MCIFIRQ_MCI_DATA_FLOW_PARITY_ERROR + */ + (MciFir, bit(9)) ? TBDDefaultCallout; + + /** MCIFIR[10] + * MCIFIRQ_CRC_PERFORMANCE_DEGRADATION + */ + (MciFir, bit(10)) ? TBDDefaultCallout; + + /** MCIFIR[11] + * MCIFIRQ_CHANNEL_INTERLOCK_FAIL + */ + (MciFir, bit(11)) ? TBDDefaultCallout; + + /** MCIFIR[12] + * MCIFIRQ_CENTAUR_CHECKSTOP + */ + (MciFir, bit(12)) ? TBDDefaultCallout; + + /** MCIFIR[13] + * MCIFIRQ_CENTAUR_TRACESTOP + */ + (MciFir, bit(13)) ? TBDDefaultCallout; + + /** MCIFIR[14] + * MCIFIRQ_FPGA_INTERRUPT + */ + (MciFir, bit(14)) ? TBDDefaultCallout; + + /** MCIFIR[15] + * MCIFIRQ_CENTAUR_RECOVERABLE_ERROR + */ + (MciFir, bit(15)) ? TBDDefaultCallout; + + /** MCIFIR[16] + * MCIFIRQ_CENTAUR_SPECIAL_ATTENTION + */ + (MciFir, bit(16)) ? TBDDefaultCallout; + + /** MCIFIR[17] + * MCIFIRQ_CENTAUR_MAINTENANCE_COMPLETE + */ + (MciFir, bit(17)) ? TBDDefaultCallout; + + /** MCIFIR[18] + * MCIFIRQ_CENTAUR_INBAND_PIB_ERROR + */ + (MciFir, bit(18)) ? TBDDefaultCallout; + + /** MCIFIR[24] + * MCIFIRQ_MCS_RECOVERABLE_ERROR + */ + (MciFir, bit(24)) ? TBDDefaultCallout; + + /** MCIFIR[25] + * MCIFIRQ_MCS_INTERNAL_NONRECOVERABLE_ERROR + */ + (MciFir, bit(25)) ? TBDDefaultCallout; + + /** MCIFIR[26] + * MCIFIRQ_POWERBUS_PROTOCOL_ERROR + */ + (MciFir, bit(26)) ? TBDDefaultCallout; + + /** MCIFIR[27] + * MCIFIRQ_MCS_COMMAND_LIST_TIMEOUT_DUE_TO_POWERBUS + */ + (MciFir, bit(27)) ? TBDDefaultCallout; + + /** MCIFIR[28] + * MCIFIRQ_MCS_COMMAND_LIST_TIMEOUT_DUE_TO_EDI_CHANNEL + */ + (MciFir, bit(28)) ? TBDDefaultCallout; + + /** MCIFIR[29] + * MCIFIRQ_INBAND_BAR_HIT_WITH_INCORRECT_TTYPE + */ + (MciFir, bit(29)) ? TBDDefaultCallout; + + /** MCIFIR[30] + * MCIFIRQ_MULTIPLE_BAR_HIT + */ + (MciFir, bit(30)) ? TBDDefaultCallout; + + /** MCIFIR[31] + * MCIFIRQ_CHANNEL_FAIL_SIGNAL_ACTIVE + */ + (MciFir, bit(31)) ? TBDDefaultCallout; + + /** MCIFIR[32] + * MCIFIRQ_MIRROR_ACTION_OCCURRED + */ + (MciFir, bit(32)) ? TBDDefaultCallout; + + /** MCIFIR[33] + * MCIFIRQ_NONFOREIGN_ACCESS_TO_FOREIGN_BAR + */ + (MciFir, bit(33)) ? TBDDefaultCallout; + + /** MCIFIR[34] + * MCIFIRQ_CENTAUR_SYNC_COMMAND_DETECTED + */ + (MciFir, bit(34)) ? TBDDefaultCallout; + + /** MCIFIR[35] + * MCIFIRQ_POWERBUS_WRITE_DATA_BUFFER_CE + */ + (MciFir, bit(35)) ? TBDDefaultCallout; + + /** MCIFIR[36] + * MCIFIRQ_POWERBUS_WRITE_DATA_BUFFER_UE + */ + (MciFir, bit(36)) ? TBDDefaultCallout; + + /** MCIFIR[37] + * MCIFIRQ_POWERBUS_WRITE_DATA_BUFFER_SUE + */ + (MciFir, bit(37)) ? TBDDefaultCallout; + + /** MCIFIR[38] + * MCIFIRQ_HA_ILLEGAL_CONSUMER_ACCESS_ERROR + */ + (MciFir, bit(38)) ? TBDDefaultCallout; + + /** MCIFIR[48] + * MCIFIRQ_INTERNAL_SCOM_ERROR + */ + (MciFir, bit(48)) ? TBDDefaultCallout; + + /** MCIFIR[49] + * MCIFIRQ_INTERNAL_SCOM_ERROR_CLONE + */ + (MciFir, bit(49)) ? TBDDefaultCallout; +}; + + ############################################################################## + # # + # # ### # + # # # ## ##### ### ### # # # # # # ### ### ### ### # + # # # # # # # # # ## # # # # # # # # # # + # ####### # # # # # # # # # # ##### ### ### ## ### # + # # # # # # # # # # ## # # # # # # # # # # + # # # ## # ### ### # # ### ### # # ### ### ### ### # + # # + ############################################################################## + +# Include the common action set. +.include "CommonActions.rule" + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Membuf.rule b/src/usr/diag/prdf/common/plat/pegasus/Membuf.rule new file mode 100755 index 000000000..619b53c6a --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Membuf.rule @@ -0,0 +1,163 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Membuf.rule $ +# +# 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 + +################################################################################ +# +# Scope: +# Registers and actions for the following chiplets: +# +# Chiplet Register Adddresses Description +# ======= ======================= ============================================ +# TP 0x01000000 - 0x01FFFFFF TP pervasive logic +# NEST 0x02000000 - 0x02FFFFFF NEST pervasive logic +# MEM 0x03000000 - 0x03FFFFFF MEM pervasive logic, note that this does +# include the SCOM addresses characterized by +# the MBA target. See Mba.rule for those +# address ranges. +# +################################################################################ + +chip Membuf +{ + name "Centaur Chip"; + targettype TYPE_MEMBUF; + sigoff 0x8000; +# FIXME May need to update dump type + dump DUMP_CONTENT_HWSUPERNOVA; + scomlen 64; + + ############################################################################# + # # + # ###### # + # # # ###### #### ### #### ##### ###### ##### #### # + # # # # # # # # # # # # # # + # ###### ##### # # #### # ##### # # #### # + # # # # # ### # # # # ##### # # + # # # # # # # # # # # # # # # # + # # # ###### #### ### #### # ###### # # #### # + # # + ############################################################################# + + ############################################################################ + # Global Broadcast Registers + ############################################################################ + + register GLOBAL_CS_FIR + { + name "Global Checkstop Attention FIR"; + scomaddr 0x570F001C; + capture group default; + }; + + register GLOBAL_RE_FIR + { + name "Global Recoverable Attention FIR"; + scomaddr 0x570F001B; + capture group default; + }; + + register GLOBAL_SPA + { + name "Global Special Attention FIR"; + scomaddr 0x570F001A; + capture group default; + }; + +# Import all of the chiplet registers +.include "Membuf_regs_TP.rule" +.include "Membuf_regs_NEST.rule" +.include "Membuf_regs_MEM.rule" + +}; + + ############################################################################## + # # + # #### # # + # # # # # # ##### ### # # # ## ##### ### ### # # ### # + # # # # # # # # # # # # # # # # # ## # # # + # #### # # # #### ### # ####### # # # # # # # # ### # + # # # # # # # # # # # # # # # # # # ## # # + # # # ### #### ##### ### # # # ## # ### ### # # ### # + # # + ############################################################################## + +################################################################################ +# Global Broadcast Registers +################################################################################ + +rule GlobalFir +{ + CHECK_STOP: GLOBAL_CS_FIR; + RECOVERABLE: GLOBAL_RE_FIR; +}; + +group gGlobalFir attntype CHECK_STOP, RECOVERABLE filter singlebit +{ + /** GLOBAL_FIR[1] + * Attention from TP chiplet + */ + (GlobalFir, bit(1)) ? analyze(gTpChipletFir); + + /** GLOBAL_FIR[2] + * Attention from NEST chiplet + */ + (GlobalFir, bit(2)) ? analyze(gNestChipletFir); + + /** GLOBAL_FIR[3] + * Attention from MEM chiplet + */ + (GlobalFir, bit(3)) ? analyze(gMemChipletFir); +}; + +rule GlobalSpa +{ + SPECIAL: GLOBAL_SPA; +}; + +group gGlobalSpa attntype SPECIAL filter singlebit +{ + /** GLOBAL_SPA[3] + * Attention from MEM chiplet + */ + (GlobalSpa, bit(3)) ? analyze(gMemChipletSpa); +}; + +# Import all of the chiplet rules and actions +.include "Membuf_acts_TP.rule" +.include "Membuf_acts_NEST.rule" +.include "Membuf_acts_MEM.rule" + + ############################################################################## + # # + # # ### # + # # # ## ##### ### ### # # # # # # ### ### ### ### # + # # # # # # # # # ## # # # # # # # # # # + # ####### # # # # # # # # # # ##### ### ### ## ### # + # # # # # # # # # # ## # # # # # # # # # # + # # # ## # ### ### # # ### ### # # ### ### ### ### # + # # + ############################################################################## + +# Include the common action set. +.include "CommonActions.rule" + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Membuf_acts_MEM.rule b/src/usr/diag/prdf/common/plat/pegasus/Membuf_acts_MEM.rule new file mode 100755 index 000000000..af8e5fbb5 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Membuf_acts_MEM.rule @@ -0,0 +1,229 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Membuf_acts_MEM.rule $ +# +# 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 + +################################################################################ +# MEM Chiplet Registers +################################################################################ + +rule MemChipletFir +{ + CHECK_STOP: + (MEM_CHIPLET_CS_FIR & `17f6000000000000`) & ~MEM_CHIPLET_FIR_MASK; + RECOVERABLE: + ((MEM_CHIPLET_RE_FIR >> 2) & `17f6000000000000`) & ~MEM_CHIPLET_FIR_MASK; +}; + +group gMemChipletFir filter singlebit +{ + /** MEM_CHIPLET_FIR[3] + * Attention from LFIR + */ + (MemChipletFir, bit(3)) ? analyze(gMemLFir); + + /** MEM_CHIPLET_FIR[5] + * Attention from MBAFIR (MBA 01) + */ + (MemChipletFir, bit(5)) ? analyzeMba0; + + /** MEM_CHIPLET_FIR[6] + * Attention from MBAFIR (MBA 23) + */ + (MemChipletFir, bit(6)) ? analyzeMba1; + + /** MEM_CHIPLET_FIR[7] + * Attention from MBACALFIR (MBA 01) + */ + (MemChipletFir, bit(7)) ? analyzeMba0; + + /** MEM_CHIPLET_FIR[8] + * Attention from MBACALFIR (MBA 23) + */ + (MemChipletFir, bit(8)) ? analyzeMba1; + + /** MEM_CHIPLET_FIR[9] + * Attention from DDRPHYFIR (MBA 01) + */ + (MemChipletFir, bit(9)) ? analyzeMba0; + + /** MEM_CHIPLET_FIR[10] + * Attention from DDRPHYFIR (MBA 23) + */ + (MemChipletFir, bit(10)) ? analyzeMba1; + + /** MEM_CHIPLET_FIR[11] + * Attention from MEMFBISTFIR + */ + (MemChipletFir, bit(11)) ? analyze(gMemFbistFir); + + /** MEM_CHIPLET_FIR[12] + * Attention from MBASECUREFIR (MBA 01) + */ + (MemChipletFir, bit(12)) ? analyzeMba0; + + /** MEM_CHIPLET_FIR[13] + * Attention from MBASECUREFIR (MBA 23) + */ + (MemChipletFir, bit(13)) ? analyzeMba1; +}; + +rule MemChipletSpa +{ + SPECIAL: MEM_CHIPLET_SPA & ~MEM_CHIPLET_SPA_MASK; +}; + +group gMemChipletSpa filter singlebit +{ + /** MEM_CHIPLET_SPA[0] + * Attention from Mba 01 + */ + (MemChipletSpa, bit(0)) ? analyzeMba0; + + /** MEM_CHIPLET_SPA[1] + * Attention from Mba 1 + */ + (MemChipletSpa, bit(1)) ? analyzeMba1; +}; + +################################################################################ +# MEM Chiplet LFIR +################################################################################ + +rule MemLFir +{ + CHECK_STOP: MEM_LFIR & ~MEM_LFIR_MASK & ~MEM_LFIR_ACT0 & ~MEM_LFIR_ACT1; + RECOVERABLE: MEM_LFIR & ~MEM_LFIR_MASK & ~MEM_LFIR_ACT0 & MEM_LFIR_ACT1; +}; + +group gMemLFir filter singlebit +{ + /** MEM_LFIR[0] + * CFIR internal parity error + */ + (MemLFir, bit(0)) ? TBDDefaultCallout; + + /** MEM_LFIR[1] + * Local errors from GPIO (PCB error) + */ + (MemLFir, bit(1)) ? TBDDefaultCallout; + + /** MEM_LFIR[2] + * Local errors from CC (PCB error) + */ + (MemLFir, bit(2)) ? TBDDefaultCallout; + + /** MEM_LFIR[3] + * Local errors from CC (OPCG, parity, scan collision, ...) + */ + (MemLFir, bit(3)) ? TBDDefaultCallout; + + /** MEM_LFIR[4] + * Local errors from PSC (PCB error) + */ + (MemLFir, bit(4)) ? TBDDefaultCallout; + + /** MEM_LFIR[5] + * Local errors from PSC (parity error) + */ + (MemLFir, bit(5)) ? TBDDefaultCallout; + + /** MEM_LFIR[6] + * Local errors from Thermal (parity error) + */ + (MemLFir, bit(6)) ? TBDDefaultCallout; + + /** MEM_LFIR[7] + * Local errors from Thermal (PCB error) + */ + (MemLFir, bit(7)) ? TBDDefaultCallout; + + /** MEM_LFIR[8|9] + * Local errors from Thermal (Trip error) + */ + (MemLFir, bit(8|9)) ? TBDDefaultCallout; + + /** MEM_LFIR[10|11] + * Local errors from Trace Array ( error) + */ + (MemLFir, bit(10|11)) ? TBDDefaultCallout; +}; + +################################################################################ +# MEM Chiplet MEMFBISTFIR +################################################################################ + +rule MemFbistFir +{ + CHECK_STOP: + MEMFBISTFIR & ~MEMFBISTFIR_MASK & ~MEMFBISTFIR_ACT0 & ~MEMFBISTFIR_ACT1; + RECOVERABLE: + MEMFBISTFIR & ~MEMFBISTFIR_MASK & ~MEMFBISTFIR_ACT0 & MEMFBISTFIR_ACT1; +}; + +group gMemFbistFir filter singlebit +{ + /** MBAFBISTFIR[0] + * FBM_FIR_REG_FBM_SCOM_UE + */ + (MemFbistFir, bit(0)) ? TBDDefaultCallout; + + /** MBAFBISTFIR[1] + * FBM_FIR_REG_FBM_CMD_CHK_1HOT + */ + (MemFbistFir, bit(1)) ? TBDDefaultCallout; + + /** MBAFBISTFIR[2] + * FBM_FIR_REG_FBM_DS_DATA_DROP + */ + (MemFbistFir, bit(2)) ? TBDDefaultCallout; + + /** MBAFBISTFIR[3] + * FBM_FIR_REG_FBM_DGEN_1HOT + */ + (MemFbistFir, bit(3)) ? TBDDefaultCallout; + + /** MBAFBISTFIR[4] + * FBM_FIR_REG_FBM_DGEN_RD_DATA_DROP + */ + (MemFbistFir, bit(4)) ? TBDDefaultCallout; + + /** MBAFBISTFIR[15] + * FBM_FIR_REG_INTERNAL_SCOM_ERROR + */ + (MemFbistFir, bit(15)) ? TBDDefaultCallout; + + /** MBAFBISTFIR[16] + * FBM_FIR_REG_INTERNAL_SCOM_ERROR_CLONE + */ + (MemFbistFir, bit(16)) ? TBDDefaultCallout; +}; + +################################################################################ +# Actions specific to MEM chiplet +################################################################################ + +/** Analyze connected MBA0 */ +actionclass analyzeMba0 { analyze(connected(TYPE_MBA, 0)); }; + +/** Analyze connected MBA1 */ +actionclass analyzeMba1 { analyze(connected(TYPE_MBA, 1)); }; + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Membuf_acts_NEST.rule b/src/usr/diag/prdf/common/plat/pegasus/Membuf_acts_NEST.rule new file mode 100755 index 000000000..98d08b766 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Membuf_acts_NEST.rule @@ -0,0 +1,1172 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Membuf_acts_NEST.rule $ +# +# 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 + +################################################################################ +# NEST Chiplet Registers +################################################################################ + +rule NestChipletFir +{ + CHECK_STOP: + (NEST_CHIPLET_CS_FIR & `17fe000000000000`) & ~NEST_CHIPLET_FIR_MASK; + RECOVERABLE: + ((NEST_CHIPLET_RE_FIR >> 2) & `17fe000000000000`) & ~NEST_CHIPLET_FIR_MASK; +}; + +group gNestChipletFir filter singlebit +{ + /** NEST_CHIPLET_FIR[3] + * Attention from LFIR + */ + (NestChipletFir, bit(3)) ? analyze(gNestLFir); + + /** NEST_CHIPLET_FIR[5] + * Attention from DMIFIR + */ + (NestChipletFir, bit(5)) ? analyze(gDmiFir); + + /** NEST_CHIPLET_FIR[6] + * Attention from MBIFIR + */ + (NestChipletFir, bit(6)) ? analyze(gMbiFir); + + /** NEST_CHIPLET_FIR[7] + * Attention from MBSFIR + */ + (NestChipletFir, bit(7)) ? analyze(gMbsFir); + + /** NEST_CHIPLET_FIR[8|9] + * Attention from MBSECCFIRs + */ + (NestChipletFir, bit(8|9)) ? analyze(gMbsEccFir); + + /** NEST_CHIPLET_FIR[10|11] + * Attention from MCBISTFIRs + */ + (NestChipletFir, bit(10|11)) ? analyze(gMcbistFir); + + /** NEST_CHIPLET_FIR[12] + * Attention from NESTFBISTFIR + */ + (NestChipletFir, bit(12))? analyze(gNestFbistFir); + + /** NEST_CHIPLET_FIR[13] + * Attention from SENSORCACHEFIR + */ + (NestChipletFir, bit(13)) ? analyze(gSensorCacheFir); + + /** NEST_CHIPLET_FIR[14] + * Attention from MBS secure FIR + */ + (NestChipletFir, bit(14))? analyze(gMbsSecureFir); +}; + +################################################################################ +# NEST Chiplet LFIR +################################################################################ + +rule NestLFir +{ + CHECK_STOP: NEST_LFIR & ~NEST_LFIR_MASK & ~NEST_LFIR_ACT0 & ~NEST_LFIR_ACT1; + RECOVERABLE: NEST_LFIR & ~NEST_LFIR_MASK & ~NEST_LFIR_ACT0 & NEST_LFIR_ACT1; +}; + +group gNestLFir filter singlebit +{ + /** NEST_LFIR[0] + * CFIR internal parity error + */ + (NestLFir, bit(0)) ? TBDDefaultCallout; + + /** NEST_LFIR[1] + * Local errors from GPIO (PCB error) + */ + (NestLFir, bit(1)) ? TBDDefaultCallout; + + /** NEST_LFIR[2] + * Local errors from CC (PCB error) + */ + (NestLFir, bit(2)) ? TBDDefaultCallout; + + /** NEST_LFIR[3] + * Local errors from CC (OPCG, parity, scan collision, ...) + */ + (NestLFir, bit(3)) ? TBDDefaultCallout; + + /** NEST_LFIR[4] + * Local errors from PSC (PCB error) + */ + (NestLFir, bit(4)) ? TBDDefaultCallout; + + /** NEST_LFIR[5] + * Local errors from PSC (parity error) + */ + (NestLFir, bit(5)) ? TBDDefaultCallout; + + /** NEST_LFIR[6] + * Local errors from Thermal (parity error) + */ + (NestLFir, bit(6)) ? TBDDefaultCallout; + + /** NEST_LFIR[7] + * Local errors from Thermal (PCB error) + */ + (NestLFir, bit(7)) ? TBDDefaultCallout; + + /** NEST_LFIR[8|9] + * Local errors from Thermal (Trip error) + */ + (NestLFir, bit(8|9)) ? TBDDefaultCallout; + + /** NEST_LFIR[10|11] + * Local errors from Trace Array ( error) + */ + (NestLFir, bit(10|11)) ? TBDDefaultCallout; +}; + +################################################################################ +# NEST Chiplet DMIFIR +################################################################################ + +rule DmiFir +{ + CHECK_STOP: DMIFIR & ~DMIFIR_MASK & ~DMIFIR_ACT0 & ~DMIFIR_ACT1; + RECOVERABLE: DMIFIR & ~DMIFIR_MASK & ~DMIFIR_ACT0 & DMIFIR_ACT1; +}; + +group gDmiFir filter singlebit +{ + /** DMIFIR[0] + * FIR_RX_INVALID_STATE_OR_PARITY_ERROR + */ + (DmiFir, bit(0)) ? TBDDefaultCallout; + + /** DMIFIR[1] + * FIR_TX_INVALID_STATE_OR_PARITY_ERROR + */ + (DmiFir, bit(1)) ? TBDDefaultCallout; + + /** DMIFIR[2] + * FIR_GCR_HANG_ERROR + */ + (DmiFir, bit(2)) ? TBDDefaultCallout; + + /** DMIFIR[8] + * FIR_RX_BUS0_TRAINING_ERROR + */ + (DmiFir, bit(8)) ? TBDDefaultCallout; + + /** DMIFIR[9] + * FIR_RX_BUS0_SPARE_DEPLOYED + */ + (DmiFir, bit(9)) ? TBDDefaultCallout; + + /** DMIFIR[10] + * FIR_RX_BUS0_MAX_SPARES_EXCEEDED + */ + (DmiFir, bit(10)) ? TBDDefaultCallout; + + /** DMIFIR[11] + * FIR_RX_BUS0_RECAL_OR_DYN_REPAIR_ERROR + */ + (DmiFir, bit(11)) ? TBDDefaultCallout; + + /** DMIFIR[12] + * FIR_RX_BUS0_TOO_MANY_BUS_ERRORS + */ + (DmiFir, bit(12)) ? TBDDefaultCallout; + + /** DMIFIR[16] + * FIR_RX_BUS1_TRAINING_ERROR + */ + (DmiFir, bit(16)) ? TBDDefaultCallout; + + /** DMIFIR[17] + * FIR_RX_BUS1_SPARE_DEPLOYED + */ + (DmiFir, bit(17)) ? TBDDefaultCallout; + + /** DMIFIR[18] + * FIR_RX_BUS1_MAX_SPARES_EXCEEDED + */ + (DmiFir, bit(18)) ? TBDDefaultCallout; + + /** DMIFIR[19] + * FIR_RX_BUS1_RECAL_OR_DYN_REPAIR_ERROR + */ + (DmiFir, bit(19)) ? TBDDefaultCallout; + + /** DMIFIR[20] + * FIR_RX_BUS1_TOO_MANY_BUS_ERRORS + */ + (DmiFir, bit(20)) ? TBDDefaultCallout; + + /** DMIFIR[24] + * FIR_RX_BUS2_TRAINING_ERROR + */ + (DmiFir, bit(24)) ? TBDDefaultCallout; + + /** DMIFIR[25] + * FIR_RX_BUS2_SPARE_DEPLOYED + */ + (DmiFir, bit(25)) ? TBDDefaultCallout; + + /** DMIFIR[26] + * FIR_RX_BUS2_MAX_SPARES_EXCEEDED + */ + (DmiFir, bit(26)) ? TBDDefaultCallout; + + /** DMIFIR[27] + * FIR_RX_BUS2_RECAL_OR_DYN_REPAIR_ERROR + */ + (DmiFir, bit(27)) ? TBDDefaultCallout; + + /** DMIFIR[28] + * FIR_RX_BUS2_TOO_MANY_BUS_ERRORS + */ + (DmiFir, bit(28)) ? TBDDefaultCallout; + + /** DMIFIR[32] + * FIR_RX_BUS3_TRAINING_ERROR + */ + (DmiFir, bit(32)) ? TBDDefaultCallout; + + /** DMIFIR[33] + * FIR_RX_BUS3_SPARE_DEPLOYED + */ + (DmiFir, bit(33)) ? TBDDefaultCallout; + + /** DMIFIR[34] + * FIR_RX_BUS3_MAX_SPARES_EXCEEDED + */ + (DmiFir, bit(34)) ? TBDDefaultCallout; + + /** DMIFIR[35] + * FIR_RX_BUS3_RECAL_OR_DYN_REPAIR_ERROR + */ + (DmiFir, bit(35)) ? TBDDefaultCallout; + + /** DMIFIR[36] + * FIR_RX_BUS3_TOO_MANY_BUS_ERRORS + */ + (DmiFir, bit(36)) ? TBDDefaultCallout; + + /** DMIFIR[40] + * FIR_RX_BUS4_TRAINING_ERROR + */ + (DmiFir, bit(40)) ? TBDDefaultCallout; + + /** DMIFIR[41] + * FIR_RX_BUS4_SPARE_DEPLOYED + */ + (DmiFir, bit(41)) ? TBDDefaultCallout; + + /** DMIFIR[42] + * FIR_RX_BUS4_MAX_SPARES_EXCEEDED + */ + (DmiFir, bit(42)) ? TBDDefaultCallout; + + /** DMIFIR[43] + * FIR_RX_BUS4_RECAL_OR_DYN_REPAIR_ERROR + */ + (DmiFir, bit(43)) ? TBDDefaultCallout; + + /** DMIFIR[44] + * FIR_RX_BUS4_TOO_MANY_BUS_ERRORS + */ + (DmiFir, bit(44)) ? TBDDefaultCallout; + + /** DMIFIR[48] + * FIR_SCOMFIR_ERROR + */ + (DmiFir, bit(48)) ? TBDDefaultCallout; + + /** DMIFIR[49] + * FIR_SCOMFIR_ERROR_CLONE + */ + (DmiFir, bit(49)) ? TBDDefaultCallout; +}; + +################################################################################ +# NEST Chiplet DMIFIR +################################################################################ + +rule SensorCacheFir +{ + CHECK_STOP: SENSORCACHEFIR & ~SENSORCACHEFIR_MASK & ~SENSORCACHEFIR_ACT0 & ~SENSORCACHEFIR_ACT1; + RECOVERABLE: SENSORCACHEFIR & ~SENSORCACHEFIR_MASK & ~SENSORCACHEFIR_ACT0 & SENSORCACHEFIR_ACT1; +}; + +group gSensorCacheFir filter singlebit +{ + /** SENSORCACHEFIR[0] + * SCAC_LFIR_I2CMINVADDR + */ + (SensorCacheFir, bit(0)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[1] + * SCAC_LFIR_I2CMINVWRITE + */ + (SensorCacheFir, bit(1)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[2] + * SCAC_LFIR_I2CMINVREAD + */ + (SensorCacheFir, bit(2)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[3] + * SCAC_LFIR_I2CMAPAR + */ + (SensorCacheFir, bit(3)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[4] + * SCAC_LFIR_I2CMPAR + */ + (SensorCacheFir, bit(4)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[5] + * SCAC_LFIR_I2CMLBPAR + */ + (SensorCacheFir, bit(5)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[10] + * SCAC_LFIR_I2CMINVCMD + */ + (SensorCacheFir, bit(10)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[11] + * SCAC_LFIR_I2CMPERR + */ + (SensorCacheFir, bit(11)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[12] + * SCAC_LFIR_I2CMOVERRUN + */ + (SensorCacheFir, bit(12)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[13] + * SCAC_LFIR_I2CMACCESS + */ + (SensorCacheFir, bit(13)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[14] + * SCAC_LFIR_I2CMARB + */ + (SensorCacheFir, bit(14)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[15] + * SCAC_LFIR_I2CMNACK + */ + (SensorCacheFir, bit(15)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[16] + * SCAC_LFIR_I2CMSTOP + */ + (SensorCacheFir, bit(16)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[17] + * SCAC_LFIR_LOCALPIB1 + */ + (SensorCacheFir, bit(17)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[18] + * SCAC_LFIR_LOCALPIB2 + */ + (SensorCacheFir, bit(18)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[19] + * SCAC_LFIR_LOCALPIB3 + */ + (SensorCacheFir, bit(19)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[20] + * SCAC_LFIR_LOCALPIB4 + */ + (SensorCacheFir, bit(20)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[21] + * SCAC_LFIR_LOCALPIB5 + */ + (SensorCacheFir, bit(21)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[22] + * SCAC_LFIR_LOCALPIB6 + */ + (SensorCacheFir, bit(22)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[23] + * SCAC_LFIR_LOCALPIB7 + */ + (SensorCacheFir, bit(23)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[24] + * SCAC_LFIR_STALLERROR + */ + (SensorCacheFir, bit(24)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[25] + * SCAC_LFIR_REGPARERR + */ + (SensorCacheFir, bit(25)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[26] + * SCAC_LFIR_REGPARERRX + */ + (SensorCacheFir, bit(26)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[32] + * SCAC_LFIR_SMERR + */ + (SensorCacheFir, bit(32)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[33] + * SCAC_LFIR_REGACCERR + */ + (SensorCacheFir, bit(33)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[34] + * SCAC_LFIR_RESETERR + */ + (SensorCacheFir, bit(34)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[35] + * SCAC_LFIR_INTERNAL_SCOM_ERROR + */ + (SensorCacheFir, bit(35)) ? TBDDefaultCallout; + + /** SENSORCACHEFIR[36] + * SCAC_LFIR_INTERNAL_SCOM_ERROR_CLONE + */ + (SensorCacheFir, bit(36)) ? TBDDefaultCallout; +}; + +################################################################################ +# NEST Chiplet MBIFIR +################################################################################ + +rule MbiFir +{ + CHECK_STOP: MBIFIR & ~MBIFIR_MASK & ~MBIFIR_ACT0 & ~MBIFIR_ACT1; + RECOVERABLE: MBIFIR & ~MBIFIR_MASK & ~MBIFIR_ACT0 & MBIFIR_ACT1; +}; + +group gMbiFir filter singlebit +{ + /** MbiFir[0] + * MBIFIRQ_REPLAY_TIMEOUT + */ + (MbiFir, bit(0)) ? TBDDefaultCallout; + + /** MbiFir[1] + * MBIFIRQ_CHANNEL_FAIL + */ + (MbiFir, bit(1)) ? TBDDefaultCallout; + + /** MbiFir[2] + * MBIFIRQ_CRC_ERROR + */ + (MbiFir, bit(2)) ? TBDDefaultCallout; + + /** MbiFir[3] + * MBIFIRQ_FRAME_NOACK + */ + (MbiFir, bit(3)) ? TBDDefaultCallout; + + /** MbiFir[4] + * MBIFIRQ_SEQID_OUT_OF_ORDER + */ + (MbiFir, bit(4)) ? TBDDefaultCallout; + + /** MbiFir[5] + * MBIFIRQ_REPLAY_BUFFER_ECC_CE + */ + (MbiFir, bit(5)) ? TBDDefaultCallout; + + /** MbiFir[6] + * MBIFIRQ_REPLAY_BUFFER_ECC_UE + */ + (MbiFir, bit(6)) ? TBDDefaultCallout; + + /** MbiFir[7] + * MBIFIRQ_MBI_STATE_MACHINE_TIMEOUT + */ + (MbiFir, bit(7)) ? TBDDefaultCallout; + + /** MbiFir[8] + * MBIFIRQ_MBI_INTERNAL_CONTROL_PARITY_ERROR + */ + (MbiFir, bit(8)) ? TBDDefaultCallout; + + /** MbiFir[9] + * MBIFIRQ_MBI_DATA_FLOW_PARITY_ERROR + */ + (MbiFir, bit(9)) ? TBDDefaultCallout; + + /** MbiFir[10] + * MBIFIRQ_CRC_PERFORMANCE_DEGRADATION + */ + (MbiFir, bit(10)) ? TBDDefaultCallout; + + /** MbiFir[11] + * MBIFIRQ_HOST_MC_GLOBAL_CHECKSTOP + */ + (MbiFir, bit(11)) ? TBDDefaultCallout; + + /** MbiFir[12] + * MBIFIRQ_HOST_MC_TRACESTOP + */ + (MbiFir, bit(12)) ? TBDDefaultCallout; + + /** MbiFir[13] + * MBIFIRQ_CHANNEL_INTERLOCK_FAIL + */ + (MbiFir, bit(13)) ? TBDDefaultCallout; + + /** MbiFir[14] + * MBIFIRQ_HOST_MC_LOCAL_CHECKSTOP + */ + (MbiFir, bit(14)) ? TBDDefaultCallout; + + /** MbiFir[15] + * MBIFIRQ_FRTL_CONTER_OVERFLOW + */ + (MbiFir, bit(15)) ? TBDDefaultCallout; + + /** MbiFir[16] + * MBIFIRQ_SCOM_REGISTER_PARITY_ERROR + */ + (MbiFir, bit(16)) ? TBDDefaultCallout; + + /** MbiFir[17] + * MBIFIRQ_IO_FAULT: IO to MBI + */ + (MbiFir, bit(17)) ? TBDDefaultCallout; + + /** MbiFir[18] + * MBIFIRQ_MULTIPLE_REPLAY + */ + (MbiFir, bit(18)) ? TBDDefaultCallout; + + /** MbiFir[19] + * MBIFIRQ_MBICFG_PARITY_SCOM_ERROR + */ + (MbiFir, bit(19)) ? TBDDefaultCallout; + + /** MbiFir[20] + * MBIFIRQ_BUFFER_OVERRUN_ERROR + */ + (MbiFir, bit(20)) ? TBDDefaultCallout; + + /** MbiFir[25] + * MBIFIRQ_INTERNAL_SCOM_ERROR_CLONE + */ + (MbiFir, bit(25)) ? TBDDefaultCallout; + + /** MbiFir[26] + * MBIFIRQ_INTERNAL_SCOM_ERROR_CLONE_COPY + */ + (MbiFir, bit(26)) ? TBDDefaultCallout; +}; + +################################################################################ +# NEST Chiplet MBSFIR +################################################################################ + +rule MbsFir +{ + CHECK_STOP: MBSFIR & ~MBSFIR_MASK & ~MBSFIR_ACT0 & ~MBSFIR_ACT1; + RECOVERABLE: MBSFIR & ~MBSFIR_MASK & ~MBSFIR_ACT0 & MBSFIR_ACT1; +}; + +group gMbsFir filter singlebit +{ + /** MBSFIR[0] + * MBS_FIR_REG_HOST_PROTOCOL_ERROR + */ + (MbsFir, bit(0)) ? TBDDefaultCallout; + + /** MBSFIR[1] + * MBS_FIR_REG_INT_PROTOCOL_ERROR + */ + (MbsFir, bit(1)) ? TBDDefaultCallout; + + /** MBSFIR[2] + * MBS_FIR_REG_INVALID_ADDRESS_ERROR + */ + (MbsFir, bit(2)) ? TBDDefaultCallout; + + /** MBSFIR[3] + * MBS_FIR_REG_EXTERNAL_TIMEOUT + */ + (MbsFir, bit(3)) ? TBDDefaultCallout; + + /** MBSFIR[4] + * MBS_FIR_REG_INTERNAL_TIMEOUT + */ + (MbsFir, bit(4)) ? TBDDefaultCallout; + + /** MBSFIR[5] + * MBS_FIR_REG_INT_BUFFER_CE + */ + (MbsFir, bit(5)) ? TBDDefaultCallout; + + /** MBSFIR[6] + * MBS_FIR_REG_INT_BUFFER_UE + */ + (MbsFir, bit(6)) ? TBDDefaultCallout; + + /** MBSFIR[7] + * MBS_FIR_REG_INT_BUFFER_SUE + */ + (MbsFir, bit(7)) ? TBDDefaultCallout; + + /** MBSFIR[8] + * MBS_FIR_REG_INT_PARITY_ERROR + */ + (MbsFir, bit(8)) ? TBDDefaultCallout; + + /** MBSFIR[9] + * MBS_FIR_REG_CACHE_SRW_CE + */ + (MbsFir, bit(9)) ? TBDDefaultCallout; + + /** MBSFIR[10] + * MBS_FIR_REG_CACHE_SRW_UE + */ + (MbsFir, bit(10)) ? TBDDefaultCallout; + + /** MBSFIR[11] + * MBS_FIR_REG_CACHE_SRW_SUE + */ + (MbsFir, bit(11)) ? TBDDefaultCallout; + + /** MBSFIR[12] + * MBS_FIR_REG_CACHE_CO_CE + */ + (MbsFir, bit(12)) ? TBDDefaultCallout; + + /** MBSFIR[13] + * MBS_FIR_REG_CACHE_CO_UE + */ + (MbsFir, bit(13)) ? TBDDefaultCallout; + + /** MBSFIR[14] + * MBS_FIR_REG_CACHE_CO_SUE + */ + (MbsFir, bit(14)) ? TBDDefaultCallout; + + /** MBSFIR[15] + * MBS_FIR_REG_DIR_CE + */ + (MbsFir, bit(15)) ? TBDDefaultCallout; + + /** MBSFIR[16] + * MBS_FIR_REG_DIR_UE + */ + (MbsFir, bit(16)) ? TBDDefaultCallout; + + /** MBSFIR[17] + * MBS_FIR_REG_DIR_MEMBER_DELETED + */ + (MbsFir, bit(17)) ? TBDDefaultCallout; + + /** MBSFIR[18] + * MBS_FIR_REG_DIR_ALL_MEMBERS_DELETED + */ + (MbsFir, bit(18)) ? TBDDefaultCallout; + + /** MBSFIR[19] + * MBS_FIR_REG_LRU_ERROR + */ + (MbsFir, bit(19)) ? TBDDefaultCallout; + + /** MBSFIR[20] + * MBS_FIR_REG_EDRAM_ERROR + */ + (MbsFir, bit(20)) ? TBDDefaultCallout; + + /** MBSFIR[21] + * MBS_FIR_REG_EMERGENCY_THROTTLE_SET + */ + (MbsFir, bit(21)) ? TBDDefaultCallout; + + /** MBSFIR[22] + * MBS_FIR_REG_HOST_INBAND_READ_ERROR + */ + (MbsFir, bit(22)) ? TBDDefaultCallout; + + /** MBSFIR[23] + * MBS_FIR_REG_HOST_INBAND_WRITE_ERROR + */ + (MbsFir, bit(23)) ? TBDDefaultCallout; + + /** MBSFIR[24] + * MBS_FIR_REG_OCC_INBAND_READ_ERROR + */ + (MbsFir, bit(24)) ? TBDDefaultCallout; + + /** MBSFIR[25] + * MBS_FIR_REG_OCC_INBAND_WRITE_ERROR + */ + (MbsFir, bit(25)) ? TBDDefaultCallout; + + /** MBSFIR[26] + * MBS_FIR_REG_SRB_BUFFER_CE + */ + (MbsFir, bit(26)) ? TBDDefaultCallout; + + /** MBSFIR[27] + * MBS_FIR_REG_SRB_BUFFER_UE + */ + (MbsFir, bit(27)) ? TBDDefaultCallout; + + /** MBSFIR[28] + * MBS_FIR_REG_SRB_BUFFER_SUE + */ + (MbsFir, bit(28)) ? TBDDefaultCallout; + + /** MBSFIR[29] + * MBS_FIR_REG_INTERNAL_SCOM_ERROR + */ + (MbsFir, bit(29)) ? TBDDefaultCallout; + + /** MBSFIR[30] + * MBS_FIR_REG_INTERNAL_SCOM_ERROR_COPY + */ + (MbsFir, bit(30)) ? TBDDefaultCallout; +}; + +################################################################################ +# NEST Chiplet MBSECC01FIR and MBSECC23FIR +################################################################################ + +rule MbsEcc01Fir +{ + CHECK_STOP: + MBSECC01FIR & ~MBSECC01FIR_MASK & ~MBSECC01FIR_ACT0 & ~MBSECC01FIR_ACT1; + RECOVERABLE: + MBSECC01FIR & ~MBSECC01FIR_MASK & ~MBSECC01FIR_ACT0 & MBSECC01FIR_ACT1; +}; + +rule MbsEcc23Fir +{ + CHECK_STOP: + MBSECC23FIR & ~MBSECC23FIR_MASK & ~MBSECC23FIR_ACT0 & ~MBSECC23FIR_ACT1; + RECOVERABLE: + MBSECC23FIR & ~MBSECC23FIR_MASK & ~MBSECC23FIR_ACT0 & MBSECC23FIR_ACT1; +}; + +group gMbsEccFir filter singlebit +{ + /** MBSECCFIR01[0:7] + * MBECCFIR_MEMORY_MPE_RANK_0_7 + */ + (MbsEcc01Fir, bit(0|1|2|3|4|5|6|7)) ? TBDDefaultCallout; + + /** MBSECCFIR23[0:7] + * MBECCFIR_MEMORY_MPE_RANK_0_7 + */ + (MbsEcc23Fir, bit(0|1|2|3|4|5|6|7)) ? TBDDefaultCallout; + + /** MBSECCFIR01[16] + * MBECCFIR_MEMORY_NCE + */ + (MbsEcc01Fir, bit(16)) ? TBDDefaultCallout; + + /** MBSECCFIR23[16] + * MBECCFIR_MEMORY_NCE + */ + (MbsEcc23Fir, bit(16)) ? TBDDefaultCallout; + + /** MBSECCFIR01[17] + * MBECCFIR_MEMORY_RCE + */ + (MbsEcc01Fir, bit(17)) ? TBDDefaultCallout; + + /** MBSECCFIR23[17] + * MBECCFIR_MEMORY_RCE + */ + (MbsEcc23Fir, bit(17)) ? TBDDefaultCallout; + + /** MBSECCFIR01[18] + * MBECCFIR_MEMORY_SUE + */ + (MbsEcc01Fir, bit(18)) ? TBDDefaultCallout; + + /** MBSECCFIR23[18] + * MBECCFIR_MEMORY_SUE + */ + (MbsEcc23Fir, bit(18)) ? TBDDefaultCallout; + + /** MBSECCFIR01[19] + * MBECCFIR_MEMORY_UE + */ + (MbsEcc01Fir, bit(19)) ? TBDDefaultCallout; + + /** MBSECCFIR23[19] + * MBECCFIR_MEMORY_UE + */ + (MbsEcc23Fir, bit(19)) ? TBDDefaultCallout; + + /** MBSECCFIR01[20:27] + * MBECCFIR_MAINT_MPE_RANK_0_7 + */ + (MbsEcc01Fir, bit(20|21|22|23|24|25|26|27)) ? TBDDefaultCallout; + + /** MBSECCFIR23[20:27] + * MBECCFIR_MAINT_MPE_RANK_0_7 + */ + (MbsEcc23Fir, bit(20|21|22|23|24|25|26|27)) ? TBDDefaultCallout; + + /** MBSECCFIR01[36] + * MBECCFIR_MAINTENANCE_NCE + */ + (MbsEcc01Fir, bit(36)) ? TBDDefaultCallout; + + /** MBSECCFIR23[36] + * MBECCFIR_MAINTENANCE_NCE + */ + (MbsEcc23Fir, bit(36)) ? TBDDefaultCallout; + + /** MBSECCFIR01[37] + * MBECCFIR_MAINTENANCE_SCE + */ + (MbsEcc01Fir, bit(37)) ? TBDDefaultCallout; + + /** MBSECCFIR23[37] + * MBECCFIR_MAINTENANCE_SCE + */ + (MbsEcc23Fir, bit(37)) ? TBDDefaultCallout; + + /** MBSECCFIR01[38] + * MBECCFIR_MAINTENANCE_MCE + */ + (MbsEcc01Fir, bit(38)) ? TBDDefaultCallout; + + /** MBSECCFIR23[38] + * MBECCFIR_MAINTENANCE_MCE + */ + (MbsEcc23Fir, bit(38)) ? TBDDefaultCallout; + + /** MBSECCFIR01[39] + * MBECCFIR_MAINTENANCE_RCE + */ + (MbsEcc01Fir, bit(39)) ? TBDDefaultCallout; + + /** MBSECCFIR23[39] + * MBECCFIR_MAINTENANCE_RCE + */ + (MbsEcc23Fir, bit(39)) ? TBDDefaultCallout; + + /** MBSECCFIR01[40] + * MBECCFIR_MAINTENANCE_SUE + */ + (MbsEcc01Fir, bit(40)) ? TBDDefaultCallout; + + /** MBSECCFIR23[40] + * MBECCFIR_MAINTENANCE_SUE + */ + (MbsEcc23Fir, bit(40)) ? TBDDefaultCallout; + + /** MBSECCFIR01[41] + * MBECCFIR_MAINTENANCE_UE + */ + (MbsEcc01Fir, bit(41)) ? TBDDefaultCallout; + + /** MBSECCFIR23[41] + * MBECCFIR_MAINTENANCE_UE + */ + (MbsEcc23Fir, bit(41)) ? TBDDefaultCallout; + + /** MBSECCFIR01[42] + * MBECCFIR_MPE_DURING_USE_MAINTENANCE_MARK_MODE + */ + (MbsEcc01Fir, bit(42)) ? TBDDefaultCallout; + + /** MBSECCFIR23[42] + * MBECCFIR_MPE_DURING_USE_MAINTENANCE_MARK_MODE + */ + (MbsEcc23Fir, bit(42)) ? TBDDefaultCallout; + + /** MBSECCFIR01[43] + * MBECCFIR_PREFETCH_MEMORY_UE + */ + (MbsEcc01Fir, bit(43)) ? TBDDefaultCallout; + + /** MBSECCFIR23[43] + * MBECCFIR_PREFETCH_MEMORY_UE + */ + (MbsEcc23Fir, bit(43)) ? TBDDefaultCallout; + + /** MBSECCFIR01[44] + * MBECCFIR_MEMORY_RCD_PARITY_ERROR + */ + (MbsEcc01Fir, bit(44)) ? TBDDefaultCallout; + + /** MBSECCFIR23[44] + * MBECCFIR_MEMORY_RCD_PARITY_ERROR + */ + (MbsEcc23Fir, bit(44)) ? TBDDefaultCallout; + + /** MBSECCFIR01[45] + * MBECCFIR_MAINTENANCE_RCD_PARITY_ERROR + */ + (MbsEcc01Fir, bit(45)) ? TBDDefaultCallout; + + /** MBSECCFIR23[45] + * MBECCFIR_MAINTENANCE_RCD_PARITY_ERROR + */ + (MbsEcc23Fir, bit(45)) ? TBDDefaultCallout; + + /** MBSECCFIR01[46] + * MBECCFIR_RECOVERABLE_CONFIGURATION_REGISTER_PARITY_ERROR + */ + (MbsEcc01Fir, bit(46)) ? TBDDefaultCallout; + + /** MBSECCFIR23[46] + * MBECCFIR_RECOVERABLE_CONFIGURATION_REGISTER_PARITY_ERROR + */ + (MbsEcc23Fir, bit(46)) ? TBDDefaultCallout; + + /** MBSECCFIR01[47] + * MBECCFIR_UNRECOVERABLE_CONFIGURATION_REGISTER_PARITY_ERROR + */ + (MbsEcc01Fir, bit(47)) ? TBDDefaultCallout; + + /** MBSECCFIR23[47] + * MBECCFIR_UNRECOVERABLE_CONFIGURATION_REGISTER_PARITY_ERROR + */ + (MbsEcc23Fir, bit(47)) ? TBDDefaultCallout; + + /** MBSECCFIR01[48] + * MBECCFIR_MASKABLE_CONFIGURATION_REGISTER_PARITY_ERROR + */ + (MbsEcc01Fir, bit(48)) ? TBDDefaultCallout; + + /** MBSECCFIR23[48] + * MBECCFIR_MASKABLE_CONFIGURATION_REGISTER_PARITY_ERROR + */ + (MbsEcc23Fir, bit(48)) ? TBDDefaultCallout; + + /** MBSECCFIR01[49] + * MBECCFIR_ECC_DATAPATH_PARITY_ERROR + */ + (MbsEcc01Fir, bit(49)) ? TBDDefaultCallout; + + /** MBSECCFIR23[49] + * MBECCFIR_ECC_DATAPATH_PARITY_ERROR + */ + (MbsEcc23Fir, bit(49)) ? TBDDefaultCallout; + + /** MBSECCFIR01[50] + * MBECCFIR_INTERNAL_SCOM_ERROR + */ + (MbsEcc01Fir, bit(50)) ? TBDDefaultCallout; + + /** MBSECCFIR23[50] + * MBECCFIR_INTERNAL_SCOM_ERROR + */ + (MbsEcc23Fir, bit(50)) ? TBDDefaultCallout; + + /** MBSECCFIR01[51] + * MBECCFIR_INTERNAL_SCOM_ERROR_COPY + */ + (MbsEcc01Fir, bit(51)) ? TBDDefaultCallout; + + /** MBSECCFIR23[51] + * MBECCFIR_INTERNAL_SCOM_ERROR_COPY + */ + (MbsEcc23Fir, bit(51)) ? TBDDefaultCallout; +}; + +################################################################################ +# NEST Chiplet MCBIST01FIR and MCBIST23FIR +################################################################################ + +rule Mcbist01Fir +{ + CHECK_STOP: + MCBIST01FIR & ~MCBIST01FIR_MASK & ~MCBIST01FIR_ACT0 & ~MCBIST01FIR_ACT1; + RECOVERABLE: + MCBIST01FIR & ~MCBIST01FIR_MASK & ~MCBIST01FIR_ACT0 & MCBIST01FIR_ACT1; +}; + +rule Mcbist23Fir +{ + CHECK_STOP: + MCBIST23FIR & ~MCBIST23FIR_MASK & ~MCBIST23FIR_ACT0 & ~MCBIST23FIR_ACT1; + RECOVERABLE: + MCBIST23FIR & ~MCBIST23FIR_MASK & ~MCBIST23FIR_ACT0 & MCBIST23FIR_ACT1; +}; + +group gMcbistFir filter singlebit +{ + /** MCBISTFIR01[0] + * MBSFIRQ_SCOM_PAR_ERRORS + */ + (Mcbist01Fir, bit(0)) ? TBDDefaultCallout; + + /** MCBISTFIR23[0] + * MBSFIRQ_SCOM_PAR_ERRORS + */ + (Mcbist23Fir, bit(0)) ? TBDDefaultCallout; + + /** MCBISTFIR01[1] + * MBSFIRQ_MBX_PAR_ERRORS + */ + (Mcbist01Fir, bit(1)) ? TBDDefaultCallout; + + /** MCBISTFIR23[1] + * MBSFIRQ_MBX_PAR_ERRORS + */ + (Mcbist23Fir, bit(1)) ? TBDDefaultCallout; + + /** MCBISTFIR01[15] + * MBSFIRQ_INTERNAL_SCOM_ERROR + */ + (Mcbist01Fir, bit(15)) ? TBDDefaultCallout; + + /** MCBISTFIR23[15] + * MBSFIRQ_INTERNAL_SCOM_ERROR + */ + (Mcbist23Fir, bit(15)) ? TBDDefaultCallout; + + /** MCBISTFIR01[16] + * MBSFIRQ_INTERNAL_SCOM_ERROR_CLONE + */ + (Mcbist01Fir, bit(16)) ? TBDDefaultCallout; + + /** MCBISTFIR23[16] + * MBSFIRQ_INTERNAL_SCOM_ERROR_CLONE + */ + (Mcbist23Fir, bit(16)) ? TBDDefaultCallout; +}; + +################################################################################ +# NEST Chiplet NESTFBISTFIR +################################################################################ + +rule NestFbistFir +{ + CHECK_STOP: + NESTFBISTFIR & ~NESTFBISTFIR_MASK & ~NESTFBISTFIR_ACT0 & ~NESTFBISTFIR_ACT1; + RECOVERABLE: + NESTFBISTFIR & ~NESTFBISTFIR_MASK & ~NESTFBISTFIR_ACT0 & NESTFBISTFIR_ACT1; +}; + +group gNestFbistFir filter singlebit +{ + /** NESTFBISTFIR[0] + * FBN_FIR_REG_FBN_SCOM_UE + */ + (NestFbistFir, bit(0)) ? TBDDefaultCallout; + + /** NESTFBISTFIR[1] + * FBN_FIR_REG_FBN_USCHK_1HOT + */ + (NestFbistFir, bit(1)) ? TBDDefaultCallout; + + /** NESTFBISTFIR[2] + * FBN_FIR_REG_FBN_USCHK_DATA_DROP + */ + (NestFbistFir, bit(2)) ? TBDDefaultCallout; + + /** NESTFBISTFIR[3] + * FBN_FIR_REG_FBN_DGEN_1HOT + */ + (NestFbistFir, bit(3)) ? TBDDefaultCallout; + + /** NESTFBISTFIR[4] + * FBN_FIR_REG_FBN_CMD_1HOT + */ + (NestFbistFir, bit(4)) ? TBDDefaultCallout; + + /** NESTFBISTFIR[5] + * FBN_FIR_REG_FBN_CMD_EARLY_RESPONSE + */ + (NestFbistFir, bit(5)) ? TBDDefaultCallout; + + /** NESTFBISTFIR[6] + * FBN_FIR_REG_FBN_FBIST_FAIL + */ + (NestFbistFir, bit(6)) ? TBDDefaultCallout; + + /** NESTFBISTFIR[7] + * FBN_FIR_REG_FBN_US_CRC_ERR + */ + (NestFbistFir, bit(7)) ? TBDDefaultCallout; + + /** NESTFBISTFIR[15] + * FBN_FIR_REG_INTERNAL_SCOM_ERROR + */ + (NestFbistFir, bit(15)) ? TBDDefaultCallout; + + /** NESTFBISTFIR[16] + * FBN_FIR_REG_INTERNAL_SCOM_ERROR_CLONE + */ + (NestFbistFir, bit(16)) ? TBDDefaultCallout; +}; + +################################################################################ +# NEST Chiplet MBSSECUREFIR +################################################################################ + +rule MbsSecureFir +{ + CHECK_STOP: + MBSSECUREFIR & ~MBSSECUREFIR_MASK & ~MBSSECUREFIR_ACT0 & ~MBSSECUREFIR_ACT1; + # NOTE: This secure FIR will only report checkstop attentions. +}; + +group gMbsSecureFir filter singlebit +{ + /** MBSSECUREFIR[0] + * MBSSIRQ_INVALID_MBSXCR_ACCESS + */ + (MbsSecureFir, bit(0)) ? TBDDefaultCallout; + + /** MBSSECUREFIR[1] + * MBSSIRQ_INVALID_MBAXCR01_ACCESS + */ + (MbsSecureFir, bit(1)) ? TBDDefaultCallout; + + /** MBSSECUREFIR[2] + * MBSSIRQ_INVALID_MBAXCR23_ACCESS + */ + (MbsSecureFir, bit(2)) ? TBDDefaultCallout; + + /** MBSSECUREFIR[3] + * MBSSIRQ_INVALID_MBAXCRMS_ACCRESS + */ + (MbsSecureFir, bit(3)) ? TBDDefaultCallout; + + /** MBSSECUREFIR[5] + * MBSSIRQ_INVALID_SIR_MASK_OR_ACTION_REGISTER_ACCESS + */ + (MbsSecureFir, bit(5)) ? TBDDefaultCallout; +}; + +################################################################################ +# Actions specific to NEST chiplet +################################################################################ + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Membuf_acts_TP.rule b/src/usr/diag/prdf/common/plat/pegasus/Membuf_acts_TP.rule new file mode 100755 index 000000000..913476351 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Membuf_acts_TP.rule @@ -0,0 +1,127 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Membuf_acts_TP.rule $ +# +# 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 + +################################################################################ +# TP Chiplet Registers +################################################################################ + +rule TpChipletFir +{ + CHECK_STOP: + (TP_CHIPLET_CS_FIR & `1000000000000000`) & ~TP_CHIPLET_FIR_MASK; + RECOVERABLE: + ((TP_CHIPLET_RE_FIR >> 2) & `1000000000000000`) & ~TP_CHIPLET_FIR_MASK; +}; + +group gTpChipletFir filter singlebit +{ + /** TP_CHIPLET_FIR[3] + * Attention from LFIR + */ + (TpChipletFir, bit(3)) ? analyze(gTpLFir); +}; + +################################################################################ +# TP Chiplet LFIR +################################################################################ + +rule TpLFir +{ + CHECK_STOP: TP_LFIR & ~TP_LFIR_MASK & ~TP_LFIR_ACT0 & ~TP_LFIR_ACT1; + RECOVERABLE: TP_LFIR & ~TP_LFIR_MASK & ~TP_LFIR_ACT0 & TP_LFIR_ACT1; +}; + +group gTpLFir filter singlebit +{ + /** TP_LFIR[0] + * CFIR internal parity error + */ + (TpLFir, bit(0)) ? TBDDefaultCallout; + + /** TP_LFIR[1] + * Local errors from GPIO (PCB error) + */ + (TpLFir, bit(1)) ? TBDDefaultCallout; + + /** TP_LFIR[2] + * Local errors from CC (PCB error) + */ + (TpLFir, bit(2)) ? TBDDefaultCallout; + + /** TP_LFIR[3] + * Local errors from CC (OPCG, parity, scan collision, ...) + */ + (TpLFir, bit(3)) ? TBDDefaultCallout; + + /** TP_LFIR[4] + * Local errors from PSC (PCB error) + */ + (TpLFir, bit(4)) ? TBDDefaultCallout; + + /** TP_LFIR[5] + * Local errors from PSC (parity error) + */ + (TpLFir, bit(5)) ? TBDDefaultCallout; + + /** TP_LFIR[6] + * Local errors from Thermal (parity error) + */ + (TpLFir, bit(6)) ? TBDDefaultCallout; + + /** TP_LFIR[7] + * Local errors from Thermal (PCB error) + */ + (TpLFir, bit(7)) ? TBDDefaultCallout; + + /** TP_LFIR[8|9] + * Local errors from Thermal (Trip error) + */ + (TpLFir, bit(8|9)) ? TBDDefaultCallout; + + /** TP_LFIR[10|11] + * Local errors from Trace Array ( error) + */ + (TpLFir, bit(10|11)) ? TBDDefaultCallout; + + /** TP_LFIR[18] + * local errors from mem PLL + * + * These should never trigger directly themselves. + * Should be handled by global PRD PLL code. + */ + (TpLFir, bit(18)) ? threshold32pday; + + /** TP_LFIR[19] + * local errors from nest PLL + * + * These should never trigger directly themselves. + * Should be handled by global PRD PLL code. + */ + (TpLFir, bit(19)) ? threshold32pday; + +}; + +################################################################################ +# Actions specific to TP chiplet +################################################################################ + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Membuf_regs_MEM.rule b/src/usr/diag/prdf/common/plat/pegasus/Membuf_regs_MEM.rule new file mode 100755 index 000000000..7c661a47f --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Membuf_regs_MEM.rule @@ -0,0 +1,138 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Membuf_regs_MEM.rule $ +# +# 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 + + ############################################################################ + # MEM Chiplet Registers + ############################################################################ + + register MEM_CHIPLET_CS_FIR + { + name "TCM.XFIR"; + scomaddr 0x03040000; + capture group default; + }; + + register MEM_CHIPLET_RE_FIR + { + name "TCM.RFIR"; + scomaddr 0x03040001; + capture group default; + }; + + register MEM_CHIPLET_FIR_MASK + { + name "TCM.FIR_MASK"; + scomaddr 0x03040002; + capture type secondary; + capture group default; + }; + + register MEM_CHIPLET_SPA + { + name "TCM.EPS.FIR.SPATTN"; + scomaddr 0x03040004; + capture group default; + }; + + register MEM_CHIPLET_SPA_MASK + { + name "TCM.EPS.FIR.SPA_MASK"; + scomaddr 0x03040007; + capture type secondary; + capture group default; + }; + + ############################################################################ + # MEM Chiplet LFIR + ############################################################################ + + register MEM_LFIR + { + name "TCM.LOCAL_FIR"; + scomaddr 0x0304000a; + reset (&, 0x0304000b); + mask (|, 0x0304000f); + capture group default; + }; + + register MEM_LFIR_MASK + { + name "TCM.EPS.FIR.LOCAL_FIR_MASK"; + scomaddr 0x0304000d; + capture type secondary; + capture group default; + }; + + register MEM_LFIR_ACT0 + { + name "TCM.EPS.FIR.LOCAL_FIR_ACTION0"; + scomaddr 0x03040010; + capture type secondary; + capture group default; + }; + + register MEM_LFIR_ACT1 + { + name "TCM.EPS.FIR.LOCAL_FIR_ACTION1"; + scomaddr 0x03040011; + capture type secondary; + capture group default; + }; + + ############################################################################ + # MEM Chiplet MEMFBISTFIR + ############################################################################ + + register MEMFBISTFIR + { + name "FBIST.FBM.FBM_FIR_REG"; + scomaddr 0x03010480; + reset (&, 0x03010481); + mask (|, 0x03010485); + capture group default; + }; + + register MEMFBISTFIR_MASK + { + name "FBIST.FBM.FBM_FIR_MASK_REG"; + scomaddr 0x03010483; + capture type secondary; + capture group default; + }; + + register MEMFBISTFIR_ACT0 + { + name "FBIST.FBM.FBM_FIR_ACTION0_REG"; + scomaddr 0x03010486; + capture type secondary; + capture group default; + }; + + register MEMFBISTFIR_ACT1 + { + name "FBIST.FBM.FBM_FIR_ACTION1_REG"; + scomaddr 0x03010487; + capture type secondary; + capture group default; + }; + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Membuf_regs_NEST.rule b/src/usr/diag/prdf/common/plat/pegasus/Membuf_regs_NEST.rule new file mode 100755 index 000000000..eac38acff --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Membuf_regs_NEST.rule @@ -0,0 +1,458 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Membuf_regs_NEST.rule $ +# +# 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 + + ############################################################################ + # NEST Chiplet Registers + ############################################################################ + + register NEST_CHIPLET_CS_FIR + { + name "TCN.XFIR"; + scomaddr 0x02040000; + capture group default; + }; + + register NEST_CHIPLET_RE_FIR + { + name "TCN.RFIR"; + scomaddr 0x02040001; + capture group default; + }; + + register NEST_CHIPLET_FIR_MASK + { + name "TCN.FIR_MASK"; + scomaddr 0x02040002; + capture type secondary; + capture group default; + }; + + ############################################################################ + # NEST Chiplet LFIR + ############################################################################ + + register NEST_LFIR + { + name "TCN.LOCAL_FIR"; + scomaddr 0x0204000a; + reset (&, 0x0204000b); + mask (|, 0x0204000f); + capture group default; + }; + + register NEST_LFIR_MASK + { + name "TCN.EPS.FIR.LOCAL_FIR_MASK"; + scomaddr 0x0204000d; + capture type secondary; + capture group default; + }; + + register NEST_LFIR_ACT0 + { + name "TCN.EPS.FIR.LOCAL_FIR_ACTION0"; + scomaddr 0x02040010; + capture type secondary; + capture group default; + }; + + register NEST_LFIR_ACT1 + { + name "TCN.EPS.FIR.LOCAL_FIR_ACTION1"; + scomaddr 0x02040011; + capture type secondary; + capture group default; + }; + + ############################################################################ + # NEST Chiplet DMIFIR + ############################################################################ + + register DMIFIR + { + name "DMI.BUSCTL.SCOM.FIR_REG"; + scomaddr 0x02010400; + reset (&, 0x02010401); + mask (|, 0x02010405); + capture group default; + }; + + register DMIFIR_MASK + { + name "DMI.BUSCTL.SCOM.FIR_MASK_REG"; + scomaddr 0x02010403; + capture type secondary; + capture group default; + }; + + register DMIFIR_ACT0 + { + name "DMI.BUSCTL.SCOM.FIR_ACTION0_REG"; + scomaddr 0x02010406; + capture type secondary; + capture group default; + }; + + register DMIFIR_ACT1 + { + name "DMI.BUSCTL.SCOM.FIR_ACTION1_REG"; + scomaddr 0x02010407; + capture type secondary; + capture group default; + }; + + ############################################################################ + # NEST Chiplet MBIFIR + ############################################################################ + + register MBIFIR + { + name "MBU.MBI.MBI.SCOMFIR.MBIFIRQ"; + scomaddr 0x02010800; + reset (&, 0x02010801); + mask (|, 0x02010805); + capture group default; + }; + + register MBIFIR_MASK + { + name "MBU.MBI.MBI.SCOMFIR.MBIFIRMASK"; + scomaddr 0x02010803; + capture type secondary; + capture group default; + }; + + register MBIFIR_ACT0 + { + name "MBU.MBI.MBI.SCOMFIR.MBIFIRACT0"; + scomaddr 0x02010806; + capture type secondary; + capture group default; + }; + + register MBIFIR_ACT1 + { + name "MBU.MBI.MBI.SCOMFIR.MBIFIRACT1"; + scomaddr 0x02010807; + capture type secondary; + capture group default; + }; + + ############################################################################ + # NEST Chiplet MBSFIR + ############################################################################ + + register MBSFIR + { + name "MBU.MBS.MBS_FIR_REG"; + scomaddr 0x02011400; + reset (&, 02011401); + mask (|, 02011405); + capture group default; + }; + + register MBSFIR_MASK + { + name "MBU.MBS.MBS_FIR_MASK_REG"; + scomaddr 0x02011403; + capture type secondary; + capture group default; + }; + + register MBSFIR_ACT0 + { + name "MBU.MBS.MBS_FIR_ACTION0_REG"; + scomaddr 0x02011406; + capture type secondary; + capture group default; + }; + + register MBSFIR_ACT1 + { + name "MBU.MBS.MBS_FIR_ACTION1_REG"; + scomaddr 0x02011407; + capture type secondary; + capture group default; + }; + + ############################################################################ + # NEST Chiplet MBSECC01FIR + ############################################################################ + + register MBSECC01FIR + { + name "MBU.MBS.ECC01.MBECCFIR"; + scomaddr 0x02011440; + reset (&, 02011441); + mask (|, 02011445); + capture group default; + }; + + register MBSECC01FIR_MASK + { + name "MBU.MBS.ECC01.MBECCFIR_MASK"; + scomaddr 0x02011443; + capture type secondary; + capture group default; + }; + + register MBSECC01FIR_ACT0 + { + name "MBU.MBS.ECC01.MBECCFIR_ACTION0"; + scomaddr 0x02011446; + capture type secondary; + capture group default; + }; + + register MBSECC01FIR_ACT1 + { + name "MBU.MBS.ECC01.MBECCFIR_ACTION1"; + scomaddr 0x02011447; + capture type secondary; + capture group default; + }; + + ############################################################################ + # NEST Chiplet MBSECC23FIR + ############################################################################ + + register MBSECC23FIR + { + name "MBU.MBS.ECC23.MBECCFIR"; + scomaddr 0x02011480; + reset (&, 02011481); + mask (|, 02011485); + capture group default; + }; + + register MBSECC23FIR_MASK + { + name "MBU.MBS.ECC23.MBECCFIR_MASK"; + scomaddr 0x02011483; + capture type secondary; + capture group default; + }; + + register MBSECC23FIR_ACT0 + { + name "MBU.MBS.ECC23.MBECCFIR_ACTION0"; + scomaddr 0x02011486; + capture type secondary; + capture group default; + }; + + register MBSECC23FIR_ACT1 + { + name "MBU.MBS.ECC23.MBECCFIR_ACTION0"; + scomaddr 0x02011487; + capture type secondary; + capture group default; + }; + + ############################################################################ + # NEST Chiplet MCBIST01FIR + ############################################################################ + + register MCBIST01FIR + { + name "MBU.MBS.MCBISTS01.SCOMFIR.MBSFIRQ"; + scomaddr 0x02011600; + reset (&, 0x02011601); + mask (|, 0x02011605); + capture group default; + }; + + register MCBIST01FIR_MASK + { + name "MBU.MBS.MCBISTS01.SCOMFIR.MBSFIRMASK"; + scomaddr 0x02011603; + capture type secondary; + capture group default; + }; + + register MCBIST01FIR_ACT0 + { + name "MBU.MBS.MCBISTS01.SCOMFIR.MBSFIRACTION0"; + scomaddr 0x02011606; + capture type secondary; + capture group default; + }; + + register MCBIST01FIR_ACT1 + { + name "MBU.MBS.MCBISTS01.SCOMFIR.MBSFIRACTION1"; + scomaddr 0x02011607; + capture type secondary; + capture group default; + }; + + ############################################################################ + # NEST Chiplet MCBIST23FIR + ############################################################################ + + register MCBIST23FIR + { + name "MBU.MBS.MCBISTS23.SCOMFIR.MBSFIRQ"; + scomaddr 0x02011700; + reset (&, 0x02011701); + mask (|, 0x02011705); + capture group default; + }; + + register MCBIST23FIR_MASK + { + name "MBU.MBS.MCBISTS23.SCOMFIR.MBSFIRMASK"; + scomaddr 0x02011703; + capture type secondary; + capture group default; + }; + + register MCBIST23FIR_ACT0 + { + name "MBU.MBS.MCBISTS23.SCOMFIR.MBSFIRACTION0"; + scomaddr 0x02011706; + capture type secondary; + capture group default; + }; + + register MCBIST23FIR_ACT1 + { + name "MBU.MBS.MCBISTS23.SCOMFIR.MBSFIRACTION1"; + scomaddr 0x02011707; + capture type secondary; + capture group default; + }; + + ############################################################################ + # NEST Chiplet NESTFBISTFIR + ############################################################################ + + register NESTFBISTFIR + { + name "FBIST.FBN.FBN_FIR_REG"; + scomaddr 0x02010880; + reset (&, 0x02010881); + mask (|, 0x02010885); + capture group default; + }; + + register NESTFBISTFIR_MASK + { + name "FBIST.FBN.FBN_FIR_MASK_REG"; + scomaddr 0x02010883; + capture type secondary; + capture group default; + }; + + register NESTFBISTFIR_ACT0 + { + name "FBIST.FBN.FBN_FIR_ACTION0_REG"; + scomaddr 0x02010886; + capture type secondary; + capture group default; + }; + + register NESTFBISTFIR_ACT1 + { + name "FBIST.FBN.FBN_FIR_ACTION1_REG"; + scomaddr 0x02010887; + capture type secondary; + capture group default; + }; + + ############################################################################ + # NEST Chiplet SENSORCACHEFIR + ############################################################################ + + register SENSORCACHEFIR + { + name "SCAC.SCAC_LFIR"; + scomaddr 0x020115c0; + reset (&, 0x020115c1); + mask (|, 0x020115c5); + capture group default; + }; + + register SENSORCACHEFIR_MASK + { + name "SCAC.SCAC_FIRMASK"; + scomaddr 0x020115c3; + capture type secondary; + capture group default; + }; + + register SENSORCACHEFIR_ACT0 + { + name "SCAC.SCAC_FIRACTION0"; + scomaddr 0x020115c6; + capture type secondary; + capture group default; + }; + + register SENSORCACHEFIR_ACT1 + { + name "SCAC.SCAC_FIRACTION1"; + scomaddr 0x020115c7; + capture type secondary; + capture group default; + }; + + ############################################################################ + # NEST Chiplet MBSSECUREFIR + ############################################################################ + + register MBSSECUREFIR + { + name "MBU.MBS.ARB.RXLT.MBSSIRQ"; + scomaddr 0x0201141e; + reset (&, 0x0201141f); + # This is a special register in which we are not able to mask. All bits + # in this register should be set to checkstop so we will not need to + # mask anyway. + capture group default; + }; + + register MBSSECUREFIR_MASK + { + name "MBU.MBS.ARB.RXLT.MBSSIRMASK"; + scomaddr 0x02011421; + capture type secondary; + capture group default; + }; + + register MBSSECUREFIR_ACT0 + { + name "MBU.MBS.ARB.RXLT.MBSSIRACT0"; + scomaddr 0x02011424; + capture type secondary; + capture group default; + }; + + register MBSSECUREFIR_ACT1 + { + name "MBU.MBS.ARB.RXLT.MBSSIRACT1"; + scomaddr 0x02011425; + capture type secondary; + capture group default; + }; + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Membuf_regs_TP.rule b/src/usr/diag/prdf/common/plat/pegasus/Membuf_regs_TP.rule new file mode 100755 index 000000000..b7147c1c2 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Membuf_regs_TP.rule @@ -0,0 +1,108 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Membuf_regs_TP.rule $ +# +# 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 + + ############################################################################ + # TP Chiplet Registers + ############################################################################ + + register TP_CHIPLET_CS_FIR + { + name "TPTOP.TPC.XFIR"; + scomaddr 0x01040000; + capture group default; + }; + + register TP_CHIPLET_RE_FIR + { + name "TPTOP.TPC.RFIR"; + scomaddr 0x01040001; + capture group default; + }; + + register TP_CHIPLET_FIR_MASK + { + name "TPTOP.TPC.FIR_MASK"; + scomaddr 0x01040002; + capture type secondary; + capture group default; + }; + + ############################################################################ + # TP Chiplet LFIR + ############################################################################ + + register TP_LFIR + { + name "TPTOP.TPC.LOCAL_FIR"; + scomaddr 0x0104000a; + reset (&, 0x0104000b); + mask (|, 0x0104000f); + capture group default; + }; + + register TP_LFIR_AND + { + name "TPTOP.TPC.LOCAL_FIR_AND"; + scomaddr 0x0104000b; + capture type secondary; + capture group never; + }; + + register TP_LFIR_MASK + { + name "TPTOP.TPC.EPS.FIR.LOCAL_FIR_MASK"; + scomaddr 0x0104000d; + capture type secondary; + capture group default; + }; + + register TP_LFIR_MASK_AND + { + name "TPTOP.TPC.EPS.FIR.LOCAL_FIR_MASK_AND"; + scomaddr 0x0104000e; + capture group never; + }; + + register TP_LFIR_MASK_OR + { + name "TPTOP.TPC.EPS.FIR.LOCAL_FIR_MASK_OR"; + scomaddr 0x0104000f; + capture group never; + }; + + register TP_LFIR_ACT0 + { + name "TPTOP.TPC.EPS.FIR.LOCAL_FIR_ACTION0"; + scomaddr 0x01040010; + capture type secondary; + capture group default; + }; + + register TP_LFIR_ACT1 + { + name "TPTOP.TPC.EPS.FIR.LOCAL_FIR_ACTION1"; + scomaddr 0x01040011; + capture type secondary; + capture group default; + }; + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Proc.rule b/src/usr/diag/prdf/common/plat/pegasus/Proc.rule new file mode 100755 index 000000000..027ab4ce3 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Proc.rule @@ -0,0 +1,351 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Proc.rule $ +# +# 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 + +################################################################################ +# +# Scope: +# Registers and actions for the following chiplets: +# +# Chiplet Register Adddresses Description +# ======= ======================= ============================================ +# TP 0x01000000 - 0x01FFFFFF TP pervasive logic +# PB 0x02000000 - 0x02FFFFFF PB pervasive logic, note that this does +# include the SCOM addresses characterized by +# the MCS target. See Mcs.rule for those +# address ranges. +# XBUS 0x04000000 - 0x0400FFFF XBUS pervasive logic +# ABUS 0x08000000 - 0x0800FFFF ABUS pervasive logic +# PCIE 0x09000000 - 0x09FFFFFF PCIE pervasive logic +# +################################################################################ + +chip Proc +{ + name "Power8 Chip"; + targettype TYPE_PROC; + sigoff 0x8000; +# FIXME May need to update dump type + dump DUMP_CONTENT_HW; + scomlen 64; + + ############################################################################# + # # + # ###### # + # # # ###### #### ### #### ##### ###### ##### #### # + # # # # # # # # # # # # # # + # ###### ##### # # #### # ##### # # #### # + # # # # # ### # # # # ##### # # + # # # # # # # # # # # # # # # # + # # # ###### #### ### #### # ###### # # #### # + # # + ############################################################################# + + ############################################################################ + # Global Broadcast Registers + ############################################################################ + + register GLOBAL_CS_FIR + { + name "Global Checkstop Attention FIR"; + scomaddr 0x570F001C; + capture group default; + }; + + register GLOBAL_RE_FIR + { + name "Global Recoverable Attention FIR"; + scomaddr 0x570F001B; + capture group default; + }; + + register GLOBAL_SPA + { + name "Global Special Attention FIR"; + scomaddr 0x570F001A; + capture group default; + }; + + register GLOBALUNITXSTPFIR + { + name "Virtual Global Unit Checkstop FIR"; + scomaddr 0x51040001; + capture group default; + capture req funccall("CoreConfigured"); + }; + +# Import all of the chiplet registers +.include "Proc_regs_TP.rule" +.include "Proc_regs_PB.rule" +.include "Proc_regs_XBUS.rule" +.include "Proc_regs_ABUS.rule" +.include "Proc_regs_PCIE.rule" + + ############################################################################ + # Non-FIR Registers + ############################################################################ + + register TODWOF + { + name "Time of Day / WOF Counter"; + scomaddr 0x00040020; + capture group default; + }; + +}; + + ############################################################################## + # # + # #### # # + # # # # # # ##### ### # # # ## ##### ### ### # # ### # + # # # # # # # # # # # # # # # # # ## # # # + # #### # # # #### ### # ####### # # # # # # # # ### # + # # # # # # # # # # # # # # # # # # ## # # + # # # ### #### ##### ### # # # ## # ### ### # # ### # + # # + ############################################################################## + +################################################################################ +# Global Broadcast Registers +################################################################################ + +rule GlobalFir +{ + CHECK_STOP: GLOBAL_CS_FIR; + RECOVERABLE: GLOBAL_RE_FIR; +}; + +group gGlobalFir attntype CHECK_STOP, RECOVERABLE filter singlebit +{ + /** GLOBAL_FIR[1] + * Attention from TP chiplet + */ + (GlobalFir, bit(1)) ? analyze(gTpChipletFir); + + /** GLOBAL_FIR[2] + * Attention from PB chiplet + */ + (GlobalFir, bit(2)) ? analyze(gPbChipletFir); + + /** GLOBAL_FIR[4] + * Attention from XBUS chiplet + */ + (GlobalFir, bit(4)) ? analyze(gXbusChipletFir); + + /** GLOBAL_FIR[8] + * Attention from ABUS chiplet + */ + (GlobalFir, bit(8)) ? analyze(gAbusChipletFir); + + /** GLOBAL_FIR[9] + * Attention from PCIE + */ + (GlobalFir, bit(9)) ? analyze(gPcieChipletFir); + + /** GLOBAL_FIR[11] + * Attention from EX1 (Venice only) + */ + (GlobalFir, bit(11)) ? defaultMaskedError; + + /** GLOBAL_FIR[12] + * Attention from EX2 (Venice only) + */ + (GlobalFir, bit(12)) ? defaultMaskedError; + + /** GLOBAL_FIR[13] + * Attention from EX3 (Venice only) + */ + (GlobalFir, bit(13)) ? defaultMaskedError; + + /** GLOBAL_FIR[14] + * Attention from EX4 + */ + (GlobalFir, bit(14)) ? analyzeEx4; + + /** GLOBAL_FIR[15] + * Attention from EX5 + */ + (GlobalFir, bit(15)) ? analyzeEx5; + + /** GLOBAL_FIR[16] + * Attention from EX6 + */ + (GlobalFir, bit(16)) ? analyzeEx6; + + /** GLOBAL_FIR[19] + * Attention from EX9 (Venice only) + */ + (GlobalFir, bit(19)) ? defaultMaskedError; + + /** GLOBAL_FIR[20] + * Attention from EX10 (Venice only) + */ + (GlobalFir, bit(20)) ? defaultMaskedError; + + /** GLOBAL_FIR[21] + * Attention from EX11 (Venice only) + */ + (GlobalFir, bit(21)) ? defaultMaskedError; + + /** GLOBAL_FIR[22] + * Attention from EX12 + */ + (GlobalFir, bit(22)) ? analyzeEx12; + + /** GLOBAL_FIR[23] + * Attention from EX13 + */ + (GlobalFir, bit(23)) ? analyzeEx13; + + /** GLOBAL_FIR[24] + * Attention from EX14 + */ + (GlobalFir, bit(24)) ? analyzeEx14; +}; + +rule GlobalSpa +{ + SPECIAL: GLOBAL_SPA; +}; + +group gGlobalSpa attntype SPECIAL filter singlebit +{ + /** GLOBAL_SPA[1] + * Attention from TP chiplet + */ + (GlobalSpa, bit(1)) ? analyze(gTpChipletSpa); + + /** GLOBAL_SPA[2] + * Attention from PB chiplet + */ + (GlobalSpa, bit(2)) ? analyze(gPbChipletSpa); + + /** GLOBAL_SPA[9] + * Attention from PCIE + */ + (GlobalSpa, bit(9)) ? analyze(gPcieChipletSpa); + + /** GLOBAL_SPA[11] + * Attention from EX1 (Venice only) + */ + (GlobalSpa, bit(11)) ? defaultMaskedError; + + /** GLOBAL_SPA[12] + * Attention from EX2 (Venice only) + */ + (GlobalSpa, bit(12)) ? defaultMaskedError; + + /** GLOBAL_SPA[13] + * Attention from EX3 (Venice only) + */ + (GlobalSpa, bit(13)) ? defaultMaskedError; + + /** GLOBAL_SPA[14] + * Attention from EX4 + */ + (GlobalSpa, bit(14)) ? analyzeEx4; + + /** GLOBAL_SPA[15] + * Attention from EX5 + */ + (GlobalSpa, bit(15)) ? analyzeEx5; + + /** GLOBAL_SPA[16] + * Attention from EX6 + */ + (GlobalSpa, bit(16)) ? analyzeEx6; + + /** GLOBAL_SPA[19] + * Attention from EX9 (Venice only) + */ + (GlobalSpa, bit(19)) ? defaultMaskedError; + + /** GLOBAL_SPA[20] + * Attention from EX10 (Venice only) + */ + (GlobalSpa, bit(20)) ? defaultMaskedError; + + /** GLOBAL_SPA[21] + * Attention from EX11 (Venice only) + */ + (GlobalSpa, bit(21)) ? defaultMaskedError; + + /** GLOBAL_SPA[22] + * Attention from EX12 + */ + (GlobalSpa, bit(22)) ? analyzeEx12; + + /** GLOBAL_SPA[23] + * Attention from EX13 + */ + (GlobalSpa, bit(23)) ? analyzeEx13; + + /** GLOBAL_SPA[24] + * Attention from EX14 + */ + (GlobalSpa, bit(24)) ? analyzeEx14; +}; + +# Import all of the chiplet rules and actions +# NOTE: Some of PB local FIRs are handled through the TP chiplet FIRs +.include "Proc_acts_TP.rule" +.include "Proc_acts_PB.rule" +.include "Proc_acts_XBUS.rule" +.include "Proc_acts_ABUS.rule" +.include "Proc_acts_PCIE.rule" + + ############################################################################## + # # + # # ### # + # # # ## ##### ### ### # # # # # # ### ### ### ### # + # # # # # # # # # ## # # # # # # # # # # + # ####### # # # # # # # # # # ##### ### ### ## ### # + # # # # # # # # # # ## # # # # # # # # # # + # # # ## # ### ### # # ### ### # # ### ### ### ### # + # # + ############################################################################## + +# Include the common action set. +.include "CommonActions.rule" + +################################################################################ +# Analyze Connected Parts # +################################################################################ + +/** Analyze connected EX4 */ +actionclass analyzeEx4 { analyze(connected(TYPE_EX, 4)); }; + +/** Analyze connected EX5 */ +actionclass analyzeEx5 { analyze(connected(TYPE_EX, 5)); }; + +/** Analyze connected EX6 */ +actionclass analyzeEx6 { analyze(connected(TYPE_EX, 6)); }; + +/** Analyze connected EX12 */ +actionclass analyzeEx12 { analyze(connected(TYPE_EX, 12)); }; + +/** Analyze connected EX13 */ +actionclass analyzeEx13 { analyze(connected(TYPE_EX, 13)); }; + +/** Analyze connected EX14 */ +actionclass analyzeEx14 { analyze(connected(TYPE_EX, 14)); }; + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Proc_acts_ABUS.rule b/src/usr/diag/prdf/common/plat/pegasus/Proc_acts_ABUS.rule new file mode 100755 index 000000000..7598b37b7 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Proc_acts_ABUS.rule @@ -0,0 +1,344 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Proc_acts_ABUS.rule $ +# +# 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 + +################################################################################ +# ABUS Chiplet Registers +################################################################################ + +rule AbusChipletFir +{ + CHECK_STOP: + (ABUS_CHIPLET_CS_FIR & `1C00000000000000`) & ~ABUS_CHIPLET_FIR_MASK; + RECOVERABLE: + ((ABUS_CHIPLET_RE_FIR >> 2) & `1C00000000000000`) & ~ABUS_CHIPLET_FIR_MASK; +}; + +group gAbusChipletFir filter singlebit +{ + /** ABUS_CHIPLET_FIR[3] + * Attention from LFIR + */ + (AbusChipletFir, bit(3)) ? analyze(gAbusLFir); + + /** ABUS_CHIPLET_FIR[4] + * Attention from PBESFIR + */ + (AbusChipletFir, bit(4)) ? analyze(gPbesFir); + + /** ABUS_CHIPLET_FIR[5] + * Attention from IOAFIR + */ + (AbusChipletFir, bit(5)) ? analyze(gIoaFir); +}; + +################################################################################ +# ABUS Chiplet LFIR +################################################################################ + +rule AbusLFir +{ + CHECK_STOP: ABUS_LFIR & ~ABUS_LFIR_MASK & ~ABUS_LFIR_ACT0 & ~ABUS_LFIR_ACT1; + RECOVERABLE: ABUS_LFIR & ~ABUS_LFIR_MASK & ~ABUS_LFIR_ACT0 & ABUS_LFIR_ACT1; +}; + +group gAbusLFir filter singlebit +{ + /** ABUS_LFIR[0] + * CFIR internal parity error + */ + (AbusLFir, bit(0)) ? TBDDefaultCallout; + + /** ABUS_LFIR[1] + * Local errors from GPIO (PCB error) + */ + (AbusLFir, bit(1)) ? TBDDefaultCallout; + + /** ABUS_LFIR[2] + * Local errors from CC (PCB error) + */ + (AbusLFir, bit(2)) ? TBDDefaultCallout; + + /** ABUS_LFIR[3] + * Local errors from CC (OPCG, parity, scan collision, ...) + */ + (AbusLFir, bit(3)) ? TBDDefaultCallout; + + /** ABUS_LFIR[4] + * Local errors from PSC (PCB error) + */ + (AbusLFir, bit(4)) ? TBDDefaultCallout; + + /** ABUS_LFIR[5] + * Local errors from PSC (parity error) + */ + (AbusLFir, bit(5)) ? TBDDefaultCallout; + + /** ABUS_LFIR[6] + * Local errors from Thermal (parity error) + */ + (AbusLFir, bit(6)) ? TBDDefaultCallout; + + /** ABUS_LFIR[7] + * Local errors from Thermal (PCB error) + */ + (AbusLFir, bit(7)) ? TBDDefaultCallout; + + /** ABUS_LFIR[8|9] + * Local errors from Thermal (Trip error) + */ + (AbusLFir, bit(8|9)) ? TBDDefaultCallout; + + /** ABUS_LFIR[10|11] + * Local errors from Trace Array ( error) + */ + (AbusLFir, bit(10|11)) ? TBDDefaultCallout; +}; + +################################################################################ +# ABUS Chiplet PBESFIR +################################################################################ + +rule PbesFir +{ + CHECK_STOP: + PBESFIR & ~PBESFIR_MASK & ~PBESFIR_ACT0 & ~PBESFIR_ACT1; + RECOVERABLE: + PBESFIR & ~PBESFIR_MASK & ~PBESFIR_ACT0 & PBESFIR_ACT1; +}; + +group gPbesFir filter singlebit +{ + /** PBESFIR[0] + * A0LINK_FMR_ERROR: a0link_fmr_error + */ + (PbesFir, bit(0)) ? TBDDefaultCallout; + + /** PBESFIR[1] + * A1LINK_FMR_ERROR: a1link_fmr_error + */ + (PbesFir, bit(1)) ? TBDDefaultCallout; + + /** PBESFIR[2] + * A2LINK_FMR_ERROR: a2link_fmr_error + */ + (PbesFir, bit(2)) ? TBDDefaultCallout; + + /** PBESFIR[3] + * A0LINK_PSR_ERR: a0link_psr_err + */ + (PbesFir, bit(3)) ? TBDDefaultCallout; + + /** PBESFIR[4] + * A1LINK_PSR_ERR: a1link_psr_err + */ + (PbesFir, bit(4)) ? TBDDefaultCallout; + + /** PBESFIR[5] + * A2LINK_PSR_ERR: a2link_psr_err + */ + (PbesFir, bit(5)) ? TBDDefaultCallout; + + /** PBESFIR[6] + * A0LINK_PSR_COR_ERR + */ + (PbesFir, bit(6)) ? TBDDefaultCallout; + + /** PBESFIR[7] + * A0LINK_PSR_DERR_ERR + */ + (PbesFir, bit(7)) ? TBDDefaultCallout; + + /** PBESFIR[8] + * A0LINK_PSR_UNC_ERR + */ + (PbesFir, bit(8)) ? TBDDefaultCallout; + + /** PBESFIR[9] + * A1LINK_PSR_COR_ERR + */ + (PbesFir, bit(9)) ? TBDDefaultCallout; + + /** PBESFIR[10] + * A1LINK_PSR_DERR_ERR + */ + (PbesFir, bit(10)) ? TBDDefaultCallout; + + /** PBESFIR[11] + * A1LINK_PSR_UNC_ERR + */ + (PbesFir, bit(11)) ? TBDDefaultCallout; + + /** PBESFIR[12] + * A2LINK_PSR_COR_ERR + */ + (PbesFir, bit(12)) ? TBDDefaultCallout; + + /** PBESFIR[13] + * A2LINK_PSR_DERR_ERR + */ + (PbesFir, bit(13)) ? TBDDefaultCallout; + + /** PBESFIR[14] + * NK_PSR_UNC_ERR + */ + (PbesFir, bit(14)) ? TBDDefaultCallout; + + /** PBESFIR[15] + * A0LINK_FMR_COR_ERR_HI + */ + (PbesFir, bit(15)) ? TBDDefaultCallout; + + /** PBESFIR[16] + * A0LINK_FMR_COR_ERR_LO + */ + (PbesFir, bit(16)) ? TBDDefaultCallout; + + /** PBESFIR[17] + * A0LINK_FMR_SUE_ERR_HI + */ + (PbesFir, bit(17)) ? TBDDefaultCallout; + + /** PBESFIR[18] + * A0LINK_FMR_SUE_ERR_LO + */ + (PbesFir, bit(18)) ? TBDDefaultCallout; + + /** PBESFIR[19] + * A0LINK_FMR_UNC_ERR_HI + */ + (PbesFir, bit(19)) ? TBDDefaultCallout; + + /** PBESFIR[20] + * A0LINK_FMR_UNC_ERR_LO + */ + (PbesFir, bit(20)) ? TBDDefaultCallout; + + /** PBESFIR[21] + * A1LINK_FMR_COR_ERR_HI + */ + (PbesFir, bit(21)) ? TBDDefaultCallout; + + /** PBESFIR[22] + * A1LINK_FMR_COR_ERR_LO + */ + (PbesFir, bit(22)) ? TBDDefaultCallout; + + /** PBESFIR[23] + * A1LINK_FMR_SUE_ERR_HI + */ + (PbesFir, bit(23)) ? TBDDefaultCallout; + + /** PBESFIR[24] + * A1LINK_FMR_SUE_ERR_LO + */ + (PbesFir, bit(24)) ? TBDDefaultCallout; + + /** PBESFIR[25] + * A1LINK_FMR_UNC_ERR_HI + */ + (PbesFir, bit(25)) ? TBDDefaultCallout; + + /** PBESFIR[26] + * A1LINK_FMR_UNC_ERR_LO + */ + (PbesFir, bit(26)) ? TBDDefaultCallout; + + /** PBESFIR[27] + * A2LINK_FMR_COR_ERR_HI + */ + (PbesFir, bit(27)) ? TBDDefaultCallout; + + /** PBESFIR[28] + * A2LINK_FMR_COR_ERR_LO + */ + (PbesFir, bit(28)) ? TBDDefaultCallout; + + /** PBESFIR[29] + * A2LINK_FMR_SUE_ERR_HI + */ + (PbesFir, bit(29)) ? TBDDefaultCallout; + + /** PBESFIR[30] + * A2LINK_FMR_SUE_ERR_LO + */ + (PbesFir, bit(30)) ? TBDDefaultCallout; + + /** PBESFIR[31] + * A2LINK_FMR_UNC_ERR_HI + */ + (PbesFir, bit(31)) ? TBDDefaultCallout; + + /** PBESFIR[32] + * A2LINK_FMR_UNC_ERR_LO + */ + (PbesFir, bit(32)) ? TBDDefaultCallout; + + /** PBESFIR[33] + * A0_OBS_CR_OVERFLOW_FIR_ERR + */ + (PbesFir, bit(33)) ? TBDDefaultCallout; + + /** PBESFIR[34] + * A1_OBS_CR_OVERFLOW_FIR_ERR + */ + (PbesFir, bit(34)) ? TBDDefaultCallout; + + /** PBESFIR[35] + * A2_OBS_CR_OVERFLOW_FIR_ERR + */ + (PbesFir, bit(35)) ? TBDDefaultCallout; + + /** PBESFIR[36] + * FIR_SCOM_ERR_DUP + */ + (PbesFir, bit(36)) ? TBDDefaultCallout; + + /** PBESFIR[37] + * FIR_SCOM_ERR + */ + (PbesFir, bit(37)) ? TBDDefaultCallout; +}; + +################################################################################ +# ABUS Chiplet IOAFIR +################################################################################ + +rule IoaFir +{ + CHECK_STOP: IOAFIR & ~IOAFIR_MASK & ~IOAFIR_ACT0 & ~IOAFIR_ACT1; + RECOVERABLE: IOAFIR & ~IOAFIR_MASK & ~IOAFIR_ACT0 & IOAFIR_ACT1; +}; + +group gIoaFir filter singlebit +{ +#FIXME:A temp fix to generate error signature by setting bit 0 + /** IOAFIR[0] + * ERROR + */ + (IoaFir, bit(0)) ? TBDDefaultCallout; +}; + +################################################################################ +# Actions specific to ABUS chiplet +################################################################################ + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Proc_acts_PB.rule b/src/usr/diag/prdf/common/plat/pegasus/Proc_acts_PB.rule new file mode 100755 index 000000000..cdcb22d1e --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Proc_acts_PB.rule @@ -0,0 +1,2454 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Proc_acts_PB.rule $ +# +# 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 + +################################################################################ +# PB Chiplet Registers +################################################################################ + +rule PbChipletFir +{ + CHECK_STOP: + (PB_CHIPLET_CS_FIR & `1FDFF80000000000`) & ~PB_CHIPLET_FIR_MASK; + RECOVERABLE: + ((PB_CHIPLET_RE_FIR >> 2 ) & `1FDFF80000000000`) & ~PB_CHIPLET_FIR_MASK; +}; + +group gPbChipletFir filter singlebit +{ + /** PB_CHIPLET_FIR[3] + * Attention from LFIR + */ + (PbChipletFir, bit(3)) ? analyze(gPbLFir); + + /** PB_CHIPLET_FIR[4] + * Attention from NXDMAENGFIR + */ + (PbChipletFir, bit(4)) ? analyze(gNxDmaEngFir); + + /** PB_CHIPLET_FIR[5] + * Attention from NXCQFIR + */ + (PbChipletFir, bit(5)) ? analyze(gNxCqFir); + + /** PB_CHIPLET_FIR[6] + * Attention from MCDFIR + */ + (PbChipletFir, bit(6)) ? analyze(gMcdFir); + + /** PB_CHIPLET_FIR[7|9] + * Attention from PBWESTFIR or PBEASTFIR + */ + (PbChipletFir, bit(7|9)) ? analyze(gPbWestEastFir); + + /** PB_CHIPLET_FIR[8] + * Attention from PBCENTFIR + */ + (PbChipletFir, bit(8)) ? analyze(gPbCentFir); + + /** PB_CHIPLET_FIR[11] + * Attention from PSIFIR + */ + (PbChipletFir, bit(11)) ? analyze(gPsiFir); + + /** PB_CHIPLET_FIR[12] + * Attention from ICPFIR + */ + (PbChipletFir, bit(12)) ? analyze(gIcpFir); + + /** PB_CHIPLET_FIR[13] + * Attention from PBAFIR + */ + (PbChipletFir, bit(13)) ? analyze(gPbaFir); + + /** PB_CHIPLET_FIR[14] + * Attention from EHHCAFIR + */ + (PbChipletFir, bit(14)) ? analyze(gEhHcaFir); + + /** PB_CHIPLET_FIR[15] + * Attention from NXASFIR + */ + (PbChipletFir, bit(15)) ? analyze(gNxAsFir); + + /** PB_CHIPLET_FIR[16] + * Attention from ENHCAFIR + */ + (PbChipletFir, bit(16)) ? analyze(gEnHcaFir); + + /** PB_CHIPLET_FIR[17|18|19] + * Attention from PCINESTFIRs + */ + (PbChipletFir, bit(17|18|19)) ? analyze(gPciNestFir); + + /** PB_CHIPLET_FIR[20] + * Attention from NXCXAFIR + */ + (PbChipletFir, bit(20)) ? analyze(gNxCxaFir); +}; + +rule PbChipletSpa +{ + SPECIAL: PB_CHIPLET_SPA & ~PB_CHIPLET_SPA_MASK; +}; + +group gPbChipletSpa filter singlebit +{ + /** PB_CHIPLET_SPA[0] + * Attention from PBCENTFIR + */ + (PbChipletSpa, bit(0)) ? analyze(gPbCentFir); +}; + +################################################################################ +# PB Chiplet LFIR +################################################################################ + +rule PbLFir +{ + CHECK_STOP: PB_LFIR & ~PB_LFIR_MASK & ~PB_LFIR_ACT0 & ~PB_LFIR_ACT1; + RECOVERABLE: PB_LFIR & ~PB_LFIR_MASK & ~PB_LFIR_ACT0 & PB_LFIR_ACT1; +}; + +group gPbLFir filter singlebit +{ + /** PB_LFIR[0] + * CFIR internal parity error + */ + (PbLFir, bit(0)) ? TBDDefaultCallout; + + /** PB_LFIR[1] + * Local errors from GPIO (PCB error) + */ + (PbLFir, bit(1)) ? TBDDefaultCallout; + + /** PB_LFIR[2] + * Local errors from CC (PCB error) + */ + (PbLFir, bit(2)) ? TBDDefaultCallout; + + /** PB_LFIR[3] + * Local errors from CC (OPCG, parity, scan collision, ...) + */ + (PbLFir, bit(3)) ? TBDDefaultCallout; + + /** PB_LFIR[4] + * Local errors from PSC (PCB error) + */ + (PbLFir, bit(4)) ? TBDDefaultCallout; + + /** PB_LFIR[5] + * Local errors from PSC (parity error) + */ + (PbLFir, bit(5)) ? TBDDefaultCallout; + + /** PB_LFIR[6] + * Local errors from Thermal (parity error) + */ + (PbLFir, bit(6)) ? TBDDefaultCallout; + + /** PB_LFIR[7] + * Local errors from Thermal (PCB error) + */ + (PbLFir, bit(7)) ? TBDDefaultCallout; + + /** PB_LFIR[8|9] + * Local errors from Thermal (Trip error) + */ + (PbLFir, bit(8|9)) ? TBDDefaultCallout; + + /** PB_LFIR[10|11] + * Local errors from Trace Array ( error) + */ + (PbLFir, bit(10|11)) ? TBDDefaultCallout; +}; + +################################################################################ +# PB Chiplet NXDMAENGFIR +################################################################################ + +rule NxDmaEngFir +{ + CHECK_STOP: + NXDMAENGFIR & ~NXDMAENGFIR_MASK & ~NXDMAENGFIR_ACT0 & ~NXDMAENGFIR_ACT1; + RECOVERABLE: + NXDMAENGFIR & ~NXDMAENGFIR_MASK & ~NXDMAENGFIR_ACT0 & NXDMAENGFIR_ACT1; +}; + +group gNxDmaEngFir filter singlebit +{ +# FIXME - Get confirmation from HW team to see how this FIR is wired. +# Also, a temp fix to generate error signature by setting bit 0 + /** NXDMAENGFIR[0] + * ERROR + */ + (NxDmaEngFir, bit(0)) ? TBDDefaultCallout; +}; + +################################################################################ +# PB Chiplet NXCQFIR +################################################################################ + +rule NxCqFir +{ + CHECK_STOP: NXCQFIR & ~NXCQFIR_MASK & ~NXCQFIR_ACT0 & ~NXCQFIR_ACT1; + RECOVERABLE: NXCQFIR & ~NXCQFIR_MASK & ~NXCQFIR_ACT0 & NXCQFIR_ACT1; +}; + +group gNxCqFir filter singlebit +{ +# FIXME - Get confirmation from HW team to see how this FIR is wired. +# Also, a temp fix to generate error signature by setting bit 0 + /** NXCQFIR[0] + * ERROR + */ + (NxCqFir, bit(0)) ? TBDDefaultCallout; +}; + +################################################################################ +# PB Chiplet NXASFIR +################################################################################ + +rule NxAsFir +{ + CHECK_STOP: NXASFIR & ~NXASFIR_MASK & ~NXASFIR_ACT0 & ~NXASFIR_ACT1; + RECOVERABLE: NXASFIR & ~NXASFIR_MASK & ~NXASFIR_ACT0 & NXASFIR_ACT1; +}; + +group gNxAsFir filter singlebit +{ + /** NXASFIR[0] + * SND_ARY_UE + */ + (NxAsFir, bit(0)) ? TBDDefaultCallout; + + /** NXASFIR[1] + * MMIO_DAT_UE + */ + (NxAsFir, bit(1)) ? TBDDefaultCallout; + + /** NXASFIR[2] + * COPREQ_DAT_UE + */ + (NxAsFir, bit(2)) ? TBDDefaultCallout; + + /** NXASFIR[3] + * PBCQ_Q_INFO_PE + */ + (NxAsFir, bit(3)) ? TBDDefaultCallout; + + /** NXASFIR[4] + * RCMD0_ADDR_PE + */ + (NxAsFir, bit(4)) ? TBDDefaultCallout; + + /** NXASFIR[5] + * RCMD0_TTAG_PE + */ + (NxAsFir, bit(5)) ? TBDDefaultCallout; + + /** NXASFIR[6] + * RCMD1_ADDR_PE + */ + (NxAsFir, bit(6)) ? TBDDefaultCallout; + + /** NXASFIR[7] + * RCMD1_TTAG_PE + */ + (NxAsFir, bit(7)) ? TBDDefaultCallout; + + /** NXASFIR[8] + * MAL_FMD_MMIO_ST + */ + (NxAsFir, bit(8)) ? TBDDefaultCallout; + + /** NXASFIR[9] + * DATA_HANG + */ + (NxAsFir, bit(9)) ? TBDDefaultCallout; + + /** NXASFIR[10] + * CANNOT_RTY_ERR + */ + (NxAsFir, bit(10)) ? TBDDefaultCallout; + + /** NXASFIR[11] + * CMPL_CNT_ERR + */ + (NxAsFir, bit(11)) ? TBDDefaultCallout; + + /** NXASFIR[12] + * MULT_CAM_HIT_ERR + */ + (NxAsFir, bit(12)) ? TBDDefaultCallout; + + /** NXASFIR[13] + * FUTURE_ERR_1 + */ + (NxAsFir, bit(13)) ? TBDDefaultCallout; + + /** NXASFIR[14] + * FL_FIFO_OVFLW + */ + (NxAsFir, bit(14)) ? TBDDefaultCallout; + + /** NXASFIR[15] + * CMD_TO_INVALID_RW + */ + (NxAsFir, bit(15)) ? TBDDefaultCallout; + + /** NXASFIR[16] + * DMA_WL_UE + */ + (NxAsFir, bit(16)) ? TBDDefaultCallout; + + /** NXASFIR[17] + * CREDWT_RTY_ERR + */ + (NxAsFir, bit(17)) ? TBDDefaultCallout; + + /** NXASFIR[18] + * NOTIFY_RTY_ERR + */ + (NxAsFir, bit(18)) ? TBDDefaultCallout; + + /** NXASFIR[19] + * RCV_TAB_UE + */ + (NxAsFir, bit(19)) ? TBDDefaultCallout; + + /** NXASFIR[20] + * FIFO_ADR_TAB_UE + */ + (NxAsFir, bit(20)) ? TBDDefaultCallout; + + /** NXASFIR[21] + * MMIO_CR_DARY_UE + */ + (NxAsFir, bit(21)) ? TBDDefaultCallout; + + /** NXASFIR[22] + * NOTIF_ARY_UE + */ + (NxAsFir, bit(22)) ? TBDDefaultCallout; + + /** NXASFIR[23] + * INTR_ARY_UE + */ + (NxAsFir, bit(23)) ? TBDDefaultCallout; + + /** NXASFIR[24] + * CR0_ATAG_PE + */ + (NxAsFir, bit(24)) ? TBDDefaultCallout; + + /** NXASFIR[25] + * CR0_TTAG_PE + */ + (NxAsFir, bit(25)) ? TBDDefaultCallout; + + /** NXASFIR[26] + * CR1_ATAG_PE + */ + (NxAsFir, bit(26)) ? TBDDefaultCallout; + + /** NXASFIR[27] + * CR1_TTAG_PE + */ + (NxAsFir, bit(27)) ? TBDDefaultCallout; + + /** NXASFIR[28] + * CW_ADR_ERR + */ + (NxAsFir, bit(28)) ? TBDDefaultCallout; + + /** NXASFIR[29] + * INTR_RTY_CNT_EXP + */ + (NxAsFir, bit(29)) ? TBDDefaultCallout; + + /** NXASFIR[30] + * EG_OVFLW + */ + (NxAsFir, bit(30)) ? TBDDefaultCallout; + + /** NXASFIR[31] + * MULT_PM_HIT + */ + (NxAsFir, bit(31)) ? TBDDefaultCallout; + + /** NXASFIR[32] + * EG_SCOM_ERR + */ + (NxAsFir, bit(32)) ? TBDDefaultCallout; + + /** NXASFIR[33] + * UNUSUAL_EG_SCENARIO + */ + (NxAsFir, bit(33)) ? TBDDefaultCallout; + + /** NXASFIR[34] + * DSLC_INTF_PE + */ + (NxAsFir, bit(34)) ? TBDDefaultCallout; + + /** NXASFIR[35] + * AS_IN_CE + */ + (NxAsFir, bit(35)) ? TBDDefaultCallout; + + /** NXASFIR[36] + * AS_IN_UNSUP_CFG + */ + (NxAsFir, bit(36)) ? TBDDefaultCallout; + + /** NXASFIR[37] + * COPREQ_CRESP_ERR + */ + (NxAsFir, bit(37)) ? TBDDefaultCallout; + + /** NXASFIR[38] + * CREDWT_CRESP_ERR + */ + (NxAsFir, bit(38)) ? TBDDefaultCallout; + + /** NXASFIR[39] + * AS_IN_SP_FIR + */ + (NxAsFir, bit(39)) ? TBDDefaultCallout; + + /** NXASFIR[40] + * AS_EG_CE + */ + (NxAsFir, bit(40)) ? TBDDefaultCallout; + + /** NXASFIR[41] + * SCOM_ERR + */ + (NxAsFir, bit(41)) ? TBDDefaultCallout; + + /** NXASFIR[42] + * SCOM_ERR_DUP + */ + (NxAsFir, bit(42)) ? TBDDefaultCallout; +}; + +################################################################################ +# PB Chiplet NXCXAFIR +################################################################################ + +rule NxCxaFir +{ + CHECK_STOP: NXCXAFIR & ~NXCXAFIR_MASK & ~NXCXAFIR_ACT0 & ~NXCXAFIR_ACT1; + RECOVERABLE: NXCXAFIR & ~NXCXAFIR_MASK & ~NXCXAFIR_ACT0 & NXCXAFIR_ACT1; +}; + +group gNxCxaFir filter singlebit +{ + /** NXCXAFIR[0] + * BAR_PE + */ + (NxCxaFir, bit(0)) ? TBDDefaultCallout; + + /** NXCXAFIR[1] + * REGISTER_PE + */ + (NxCxaFir, bit(1)) ? TBDDefaultCallout; + + /** NXCXAFIR[2] + * MASTER_ARRAY_CE + */ + (NxCxaFir, bit(2)) ? TBDDefaultCallout; + + /** NXCXAFIR[3] + * MASTER_ARRAY_UE + */ + (NxCxaFir, bit(3)) ? TBDDefaultCallout; + + /** NXCXAFIR[4] + * TIMER_EXPIRED_RECOV_ERROR + */ + (NxCxaFir, bit(4)) ? TBDDefaultCallout; + + /** NXCXAFIR[5] + * TIMER_EXPIRED_XSTOP_ERROR + */ + (NxCxaFir, bit(5)) ? TBDDefaultCallout; + + /** NXCXAFIR[6] + * PSL_CMD_UE + */ + (NxCxaFir, bit(6)) ? TBDDefaultCallout; + + /** NXCXAFIR[7] + * PSL_CMD_SUE + */ + (NxCxaFir, bit(7)) ? TBDDefaultCallout; + + /** NXCXAFIR[8] + * SNOOP_ARRAY_CE + */ + (NxCxaFir, bit(8)) ? TBDDefaultCallout; + + /** NXCXAFIR[9] + * SNOOP_ARRAY_UE + */ + (NxCxaFir, bit(9)) ? TBDDefaultCallout; + + /** NXCXAFIR[10] + * RECOVERY_FAILED + */ + (NxCxaFir, bit(10)) ? TBDDefaultCallout; + + /** NXCXAFIR[13] + * MASTER_RECOVERABLE_ERROR + */ + (NxCxaFir, bit(13)) ? TBDDefaultCallout; + + /** NXCXAFIR[14] + * SNOOPER_RECOVERABLE_ERROR + */ + (NxCxaFir, bit(14)) ? TBDDefaultCallout; + + /** NXCXAFIR[15] + * XPT_RECOVERABLE_ERROR + */ + (NxCxaFir, bit(15)) ? TBDDefaultCallout; + + /** NXCXAFIR[16] + * MASTER_SYS_XSTOP_ERROR + */ + (NxCxaFir, bit(16)) ? TBDDefaultCallout; + + /** NXCXAFIR[17] + * SNOOPER_SYS_XSTOP_ERROR + */ + (NxCxaFir, bit(17)) ? TBDDefaultCallout; + + /** NXCXAFIR[18] + * XPT_SYS_XSTOP_ERROR + */ + (NxCxaFir, bit(18)) ? TBDDefaultCallout; + + /** NXCXAFIR[19] + * MUOP_ERROR_1 + */ + (NxCxaFir, bit(19)) ? TBDDefaultCallout; + + /** NXCXAFIR[20] + * MUOP_ERROR_2 + */ + (NxCxaFir, bit(20)) ? TBDDefaultCallout; + + /** NXCXAFIR[21] + * MUOP_ERROR_3 + */ + (NxCxaFir, bit(21)) ? TBDDefaultCallout; + + /** NXCXAFIR[22] + * SUOP_ERROR_1 + */ + (NxCxaFir, bit(22)) ? TBDDefaultCallout; + + /** NXCXAFIR[23] + * SUOP_ERROR_2 + */ + (NxCxaFir, bit(23)) ? TBDDefaultCallout; + + /** NXCXAFIR[24] + * SUOP_ERROR_3 + */ + (NxCxaFir, bit(24)) ? TBDDefaultCallout; + + /** NXCXAFIR[25] + * POWERBUS_MISC_ERROR + */ + (NxCxaFir, bit(25)) ? TBDDefaultCallout; + + /** NXCXAFIR[26] + * POWERBUS_INTERFACE_PE + */ + (NxCxaFir, bit(26)) ? TBDDefaultCallout; + + /** NXCXAFIR[27] + *POWERBUS_DATA_HANG_ERROR + */ + (NxCxaFir, bit(27)) ? TBDDefaultCallout; + + /** NXCXAFIR[28] + * POWERBUS_HANG_ERROR + */ + (NxCxaFir, bit(28)) ? TBDDefaultCallout; + + /** NXCXAFIR[29] + * LD_CLASS_CMD_ADDR_ERR + */ + (NxCxaFir, bit(29)) ? TBDDefaultCallout; + + /** NXCXAFIR[30] + * ST_CLASS_CMD_ADDR_ERR + */ + (NxCxaFir, bit(30)) ? TBDDefaultCallout; + + /** NXCXAFIR[31] + * PHB_LINK_DOWN + */ + (NxCxaFir, bit(31)) ? TBDDefaultCallout; + + /** NXCXAFIR[32] + * LD_CLASS_CMD_FOREIGN_LINK_FAIL + */ + (NxCxaFir, bit(32)) ? TBDDefaultCallout; + + /** NXCXAFIR[33] + * FOREIGN_LINK_HANG_ERROR + */ + (NxCxaFir, bit(33)) ? TBDDefaultCallout; + + /** NXCXAFIR[34] + * XPT_POWERBUS_CE + */ + (NxCxaFir, bit(34)) ? TBDDefaultCallout; + + /** NXCXAFIR[35] + * XPT_POWERBUS_UE + */ + (NxCxaFir, bit(35)) ? TBDDefaultCallout; + + /** NXCXAFIR[36] + * XPT_POWERBUS_SUE + */ + (NxCxaFir, bit(36)) ? TBDDefaultCallout; + + /** NXCXAFIR[37] + * TLBI_TIMEOUT + */ + (NxCxaFir, bit(37)) ? TBDDefaultCallout; + + /** NXCXAFIR[38] + * TLBI_SEQ_ERR + */ + (NxCxaFir, bit(38)) ? TBDDefaultCallout; + + /** NXCXAFIR[39] + * TLBI_BAD_OP_ERR + */ + (NxCxaFir, bit(39)) ? TBDDefaultCallout; + + /** NXCXAFIR[40] + * TLBI_SEQ_NUM_PARITY_ERR + */ + (NxCxaFir, bit(40)) ? TBDDefaultCallout; + + /** NXCXAFIR[41] + * ST_CLASS_CMD_FOREIGN_LINK_FAIL + */ + (NxCxaFir, bit(41)) ? TBDDefaultCallout; + + /** NXCXAFIR[47] + * SCOM_ERR2 + */ + (NxCxaFir, bit(47)) ? TBDDefaultCallout; + + /** NXCXAFIR[48] + * SCOM_ERR + */ + (NxCxaFir, bit(48)) ? TBDDefaultCallout; +}; + +################################################################################ +# PB Chiplet MCDFIR +################################################################################ + +rule McdFir +{ + CHECK_STOP: MCDFIR & ~MCDFIR_MASK & ~MCDFIR_ACT0 & ~MCDFIR_ACT1; + RECOVERABLE: MCDFIR & ~MCDFIR_MASK & ~MCDFIR_ACT0 & MCDFIR_ACT1; +}; + +group gMcdFir filter singlebit +{ + /** MCDFIR[0] + * MCD_ARRAY_ECC_UE_ERR + */ + (McdFir, bit(0)) ? TBDDefaultCallout; + + /** MCDFIR[1] + * MCD_ARRAY_ECC_CE_ERR + */ + (McdFir, bit(1)) ? TBDDefaultCallout; + + /** MCDFIR[2] + * MCD_REG_PARITY_ERR + */ + (McdFir, bit(2)) ? TBDDefaultCallout; + + /** MCDFIR[3] + * MCD_SM_ERR + */ + (McdFir, bit(3)) ? TBDDefaultCallout; + + /** MCDFIR[4] + * MCD_REC_HANG_ERR + */ + (McdFir, bit(4)) ? TBDDefaultCallout; + + /** MCDFIR[5] + * MCD_PB_PARITY_ERR + */ + (McdFir, bit(5)) ? TBDDefaultCallout; + + /** MCDFIR[6] + * MCD_UNSOLICITED_CRESP_ERR + */ + (McdFir, bit(6)) ? TBDDefaultCallout; + + /** MCDFIR[7] + * MCD_ACK_DEAD_ERR + */ + (McdFir, bit(7)) ? TBDDefaultCallout; + + /** MCDFIR[8] + * FIR_PARITY_ERR2 + */ + (McdFir, bit(8)) ? TBDDefaultCallout; + + /** MCDFIR[9] + * FIR_PARITY_ERR + */ + (McdFir, bit(9)) ? TBDDefaultCallout; +}; + +################################################################################ +# PB Chiplet PBEASTFIR and PBWESTFIR +################################################################################ + +# TODO - All these FIRs should have the same bit definition. Idealy, we will +# only want to have one copy of the bit definition. Unfortuately, the +# rule code parser does not have the support for something like this. +# Maybe we can add this as a later feature. + +rule PbEastFir +{ + CHECK_STOP: PBEASTFIR & ~PBEASTFIR_MASK & ~PBEASTFIR_ACT0 & ~PBEASTFIR_ACT1; + RECOVERABLE: PBEASTFIR & ~PBEASTFIR_MASK & ~PBEASTFIR_ACT0 & PBEASTFIR_ACT1; +}; + +rule PbWestFir +{ + CHECK_STOP: PBWESTFIR & ~PBWESTFIR_MASK & ~PBWESTFIR_ACT0 & ~PBWESTFIR_ACT1; + RECOVERABLE: PBWESTFIR & ~PBWESTFIR_MASK & ~PBWESTFIR_ACT0 & PBWESTFIR_ACT1; +}; + +group gPbWestEastFir filter singlebit +{ + /** PBWESTFIR[0] + * PB_WEST_PBIEX01_PBH_HW_ERROR + */ + (PbWestFir, bit(0)) ? TBDDefaultCallout; + + /** PBEASTFIR[0] + * PB_EAST_PBIEX04_PBH_HW_ERROR + */ + (PbEastFir, bit(0)) ? TBDDefaultCallout; + + /** PBWESTFIR[1] + * PB_WEST_PBIEX01_PBH_RECOV_ERROR + */ + (PbWestFir, bit(1)) ? TBDDefaultCallout; + + /** PBEASTFIR[1] + * PB_EAST_PBIEX04_PBH_RECOV_ERROR + */ + (PbEastFir, bit(1)) ? TBDDefaultCallout; + + /** PBWESTFIR[2] + * PB_WEST_PBIEX01_PBH_PROTOCOL_ERROR + */ + (PbWestFir, bit(2)) ? TBDDefaultCallout; + + /** PBEASTFIR[2] + * PB_EAST_PBIEX04_PBH_PROTOCOL_ERROR + */ + (PbEastFir, bit(2)) ? TBDDefaultCallout; + + /** PBWESTFIR[3] + * PB_WEST_PBIEX01_PBH_OVERFLOW_ERROR + */ + (PbWestFir, bit(3)) ? TBDDefaultCallout; + + /** PBEASTFIR[3] + * PB_EAST_PBIEX04_PBH_OVERFLOW_ERROR + */ + (PbEastFir, bit(3)) ? TBDDefaultCallout; + + /** PBWESTFIR[4] + * PB_WEST_PBIEX02_PBH_HW_ERROR + */ + (PbWestFir, bit(4)) ? TBDDefaultCallout; + + /** PBEASTFIR[4] + * PB_EAST_PBIEX05_PBH_HW_ERROR + */ + (PbEastFir, bit(4)) ? TBDDefaultCallout; + + /** PBWESTFIR[5] + * PB_WEST_PBIEX02_PBH_RECOV_ERROR + */ + (PbWestFir, bit(5)) ? TBDDefaultCallout; + + /** PBEASTFIR[5] + * PB_EAST_PBIEX05_PBH_RECOV_ERROR + */ + (PbEastFir, bit(5)) ? TBDDefaultCallout; + + /** PBWESTFIR[6] + * PB_WEST_PBIEX02_PBH_PROTOCOL_ERROR + */ + (PbWestFir, bit(6)) ? TBDDefaultCallout; + + /** PBEASTFIR[6] + * PB_EAST_PBIEX05_PBH_PROTOCOL_ERROR + */ + (PbEastFir, bit(6)) ? TBDDefaultCallout; + + /** PBWESTFIR[7] + * PB_WEST_PBIEX02_PBH_OVERFLOW_ERROR + */ + (PbWestFir, bit(7)) ? TBDDefaultCallout; + + /** PBEASTFIR[7] + * PB_EAST_PBIEX05_PBH_OVERFLOW_ERROR + */ + (PbEastFir, bit(7)) ? TBDDefaultCallout; + + /** PBWESTFIR[8] + * PB_WEST_PBIEX03_PBH_HW_ERROR + */ + (PbWestFir, bit(8)) ? TBDDefaultCallout; + + /** PBEASTFIR[8] + * PB_EAST_PBIEX06_PBH_HW_ERROR + */ + (PbEastFir, bit(8)) ? TBDDefaultCallout; + + /** PBWESTFIR[9] + * PB_WEST_PBIEX03_PBH_RECOV_ERROR + */ + (PbWestFir, bit(9)) ? TBDDefaultCallout; + + /** PBEASTFIR[9] + * PB_EAST_PBIEX06_PBH_RECOV_ERROR + */ + (PbEastFir, bit(9)) ? TBDDefaultCallout; + + /** PBWESTFIR[10] + * PB_WEST_PBIEX03_PBH_PROTOCOL_ERROR + */ + (PbWestFir, bit(10)) ? TBDDefaultCallout; + + /** PBEASTFIR[10] + * PB_EAST_PBIEX06_PBH_PROTOCOL_ERROR + */ + (PbEastFir, bit(10)) ? TBDDefaultCallout; + + /** PBWESTFIR[11] + * PB_WEST_PBIEX03_PBH_OVERFLOW_ERROR + */ + (PbWestFir, bit(11)) ? TBDDefaultCallout; + + /** PBEASTFIR[11] + * PB_EAST_PBIEX06_PBH_OVERFLOW_ERROR + */ + (PbEastFir, bit(11)) ? TBDDefaultCallout; + + /** PBWESTFIR[12] + * PB_WEST_PBIEX09_PBH_HW_ERROR + */ + (PbWestFir, bit(12)) ? TBDDefaultCallout; + + /** PBEASTFIR[12] + * PB_EAST_PBIEX12_PBH_HW_ERROR + */ + (PbEastFir, bit(12)) ? TBDDefaultCallout; + + /** PBWESTFIR[13] + * PB_WEST_PBIEX09_PBH_RECOV_ERROR + */ + (PbWestFir, bit(13)) ? TBDDefaultCallout; + + /** PBEASTFIR[13] + * PB_EAST_PBIEX12_PBH_RECOV_ERROR + */ + (PbEastFir, bit(13)) ? TBDDefaultCallout; + + /** PBWESTFIR[14] + * PB_WEST_PBIEX09_PBH_PROTOCOL_ERROR + */ + (PbWestFir, bit(14)) ? TBDDefaultCallout; + + /** PBEASTFIR[14] + * PB_EAST_PBIEX12_PBH_PROTOCOL_ERROR + */ + (PbEastFir, bit(14)) ? TBDDefaultCallout; + + /** PBWESTFIR[15] + * PB_WEST_PBIEX09_PBH_OVERFLOW_ERROR + */ + (PbWestFir, bit(15)) ? TBDDefaultCallout; + + /** PBEASTFIR[15] + * PB_EAST_PBIEX12_PBH_OVERFLOW_ERROR + */ + (PbEastFir, bit(15)) ? TBDDefaultCallout; + + /** PBWESTFIR[16] + * PB_WEST_PBIEX10_PBH_HW_ERROR + */ + (PbWestFir, bit(16)) ? TBDDefaultCallout; + + /** PBEASTFIR[16] + * PB_EAST_PBIEX13_PBH_HW_ERROR + */ + (PbEastFir, bit(16)) ? TBDDefaultCallout; + + /** PBWESTFIR[17] + * PB_WEST_PBIEX10_PBH_RECOV_ERROR + */ + (PbWestFir, bit(17)) ? TBDDefaultCallout; + + /** PBEASTFIR[17] + * PB_EAST_PBIEX13_PBH_RECOV_ERROR + */ + (PbEastFir, bit(17)) ? TBDDefaultCallout; + + /** PBWESTFIR[18] + * PB_WEST_PBIEX10_PBH_PROTOCOL_ERROR + */ + (PbWestFir, bit(18)) ? TBDDefaultCallout; + + /** PBEASTFIR[18] + * PB_EAST_PBIEX13_PBH_PROTOCOL_ERROR + */ + (PbEastFir, bit(18)) ? TBDDefaultCallout; + + /** PBWESTFIR[19] + * PB_WEST_PBIEX10_PBH_OVERFLOW_ERROR + */ + (PbWestFir, bit(19)) ? TBDDefaultCallout; + + /** PBEASTFIR[19] + * PB_EAST_PBIEX13_PBH_OVERFLOW_ERROR + */ + (PbEastFir, bit(19)) ? TBDDefaultCallout; + + /** PBWESTFIR[20] + * PB_WEST_PBIEX11_PBH_HW_ERROR + */ + (PbWestFir, bit(20)) ? TBDDefaultCallout; + + /** PBEASTFIR[20] + * PB_EAST_PBIEX14_PBH_HW_ERROR + */ + (PbEastFir, bit(20)) ? TBDDefaultCallout; + + /** PBWESTFIR[21] + * PB_WEST_PBIEX11_PBH_RECOV_ERROR + */ + (PbWestFir, bit(21)) ? TBDDefaultCallout; + + /** PBEASTFIR[21] + * PB_EAST_PBIEX14_PBH_RECOV_ERROR + */ + (PbEastFir, bit(21)) ? TBDDefaultCallout; + + /** PBWESTFIR[22] + * PB_WEST_PBIEX11_PBH_PROTOCOL_ERROR + */ + (PbWestFir, bit(22)) ? TBDDefaultCallout; + + /** PBEASTFIR[22] + * PB_EAST_PBIEX14_PBH_PROTOCOL_ERROR + */ + (PbEastFir, bit(22)) ? TBDDefaultCallout; + + /** PBWESTFIR[23] + * PB_WEST_PBIEX11_PBH_OVERFLOW_ERROR + */ + (PbWestFir, bit(23)) ? TBDDefaultCallout; + + /** PBEASTFIR[23] + * PB_EAST_PBIEX14_PBH_OVERFLOW_ERROR + */ + (PbEastFir, bit(23)) ? TBDDefaultCallout; + + /** PBWESTFIR[24] + * PB_WEST_DATA_OVERFLOW_ERROR + */ + (PbWestFir, bit(24)) ? TBDDefaultCallout; + + /** PBEASTFIR[24] + * PB_EAST_DATA_OVERFLOW_ERROR + */ + (PbEastFir, bit(24)) ? TBDDefaultCallout; + + /** PBWESTFIR[25] + * PB_WEST_DATA_PROTOCOL_ERROR + */ + (PbWestFir, bit(25)) ? TBDDefaultCallout; + + /** PBEASTFIR[25] + * PB_EAST_DATA_PROTOCOL_ERROR + */ + (PbEastFir, bit(25)) ? TBDDefaultCallout; + + /** PBWESTFIR[26] + * PB_WEST_DATA_ROUTE_ERROR + */ + (PbWestFir, bit(26)) ? TBDDefaultCallout; + + /** PBEASTFIR[26] + * PB_EAST_DATA_ROUTE_ERROR + */ + (PbEastFir, bit(26)) ? TBDDefaultCallout; + + /** PBWESTFIR[27] + * PB_WEST_CMD_OVERFLOW_ERROR + */ + (PbWestFir, bit(27)) ? TBDDefaultCallout; + + /** PBEASTFIR[27] + * PB_EAST_CMD_OVERFLOW_ERROR + */ + (PbEastFir, bit(27)) ? TBDDefaultCallout; + + /** PBWESTFIR[32] + * FIR_SCOM_WEST_ERR + */ + (PbWestFir, bit(32)) ? TBDDefaultCallout; + + /** PBEASTFIR[32] + * FIR_SCOM_EAST_ERR + */ + (PbEastFir, bit(32)) ? TBDDefaultCallout; + + /** PBWESTFIR[33] + * FIR_SCOM_WEST_ERR_DUP + */ + (PbWestFir, bit(33)) ? TBDDefaultCallout; + + /** PBEASTFIR[33] + * FIR_SCOM_EAST_ERR_DUP + */ + (PbEastFir, bit(33)) ? TBDDefaultCallout; +}; + +################################################################################ +# PB Chiplet PBCENTFIR +################################################################################ + +rule PbCentFir +{ + CHECK_STOP: PBCENTFIR & ~PBCENTFIR_MASK & ~PBCENTFIR_ACT0 & ~PBCENTFIR_ACT1; + RECOVERABLE: PBCENTFIR & ~PBCENTFIR_MASK & ~PBCENTFIR_ACT0 & PBCENTFIR_ACT1; + SPECIAL: PBCENTFIR & ~PBCENTFIR_MASK & PBCENTFIR_ACT0 & ~PBCENTFIR_ACT1; +}; + +group gPbCentFir filter singlebit +{ + /** PBCENTFIR[0] + * PB_CENT_PROTOCOL_ERROR + */ + (PbCentFir, bit(0)) ? TBDDefaultCallout; + + /** PBCENTFIR[1] + * PB_CENT_OVERFLOW_ERROR + */ + (PbCentFir, bit(1)) ? TBDDefaultCallout; + + /** PBCENTFIR[2] + * PB_CENT_HW_PARITY_ERROR + */ + (PbCentFir, bit(2)) ? TBDDefaultCallout; + + /** PBCENTFIR[3] + * PB_CENT_TLBIE_TM_TIMEOUT_ERROR + */ + (PbCentFir, bit(3)) ? TBDDefaultCallout; + + /** PBCENTFIR[4] + * PB_CENT_COHERENCY_ERROR + */ + (PbCentFir, bit(4)) ? TBDDefaultCallout; + + /** PBCENTFIR[5] + * PB_CENT_CRESP_ADDR_ERROR + */ + (PbCentFir, bit(5)) ? TBDDefaultCallout; + + /** PBCENTFIR[6] + * PB_CENT_CRESP_ERROR + */ + (PbCentFir, bit(6)) ? TBDDefaultCallout; + + /** PBCENTFIR[7] + * PB_CENT_HANG_RECOVERY_LIMIT_ERROR + */ + (PbCentFir, bit(7)) ? TBDDefaultCallout; + + /** PBCENTFIR[8] + * PB_CENT_DATA_ROUTE_ERROR + */ + (PbCentFir, bit(8)) ? TBDDefaultCallout; + + /** PBCENTFIR[9] + * PB_CENT_HANG_RECOVERY_GTE_LEVEL1 + */ + (PbCentFir, bit(9)) ? TBDDefaultCallout; + + /** PBCENTFIR[10] + * PB_CENT_FORCE_MP_IPL + */ + (PbCentFir, bit(10)) ? TBDDefaultCallout; + + /** PBCENTFIR[11] + * PB_CENT_FIR_SPARE_0 + */ + (PbCentFir, bit(11)) ? TBDDefaultCallout; + + /** PBCENTFIR[12] + * PB_CENT_F0LINK_ERROR + */ + (PbCentFir, bit(12)) ? TBDDefaultCallout; + + /** PBCENTFIR[13] + * PB_CENT_F1LINK_ERROR + */ + (PbCentFir, bit(13)) ? TBDDefaultCallout; + + /** PBCENTFIR[14] + * PB_CENT_F0_OVERFLOW + */ + (PbCentFir, bit(14)) ? TBDDefaultCallout; + + /** PBCENTFIR[15] + * PB_CENT_F1_OVERFLOW + */ + (PbCentFir, bit(15)) ? TBDDefaultCallout; + + /** PBCENTFIR[16] + * FIR_SCOM_CENT_ERR + */ + (PbCentFir, bit(16)) ? TBDDefaultCallout; + + /** PBCENTFIR[17] + * FIR_SCOM_CENT_ERR_DUP + */ + (PbCentFir, bit(17)) ? TBDDefaultCallout; +}; + +################################################################################ +# PB Chiplet PSIFIR +################################################################################ + +rule PsiFir +{ + CHECK_STOP: PSIFIR & ~PSIFIR_MASK & ~PSIFIR_ACT0 & ~PSIFIR_ACT1; + RECOVERABLE: PSIFIR & ~PSIFIR_MASK & ~PSIFIR_ACT0 & PSIFIR_ACT1; +}; + +group gPsiFir filter singlebit +{ + /** PSIFIR[0] + * PB_ECC_ERR_CE + */ + (PsiFir, bit(0)) ? TBDDefaultCallout; + + /** PSIFIR[1] + * PB_ECC_ERR_UE + */ + (PsiFir, bit(1)) ? TBDDefaultCallout; + + /** PSIFIR[2] + * PB_ECC_ERR_SUE + */ + (PsiFir, bit(3)) ? TBDDefaultCallout; + + /** PSIFIR[4] + * INTERRUPT_FROM_FSP + */ + (PsiFir, bit(4)) ? TBDDefaultCallout; + + /** PSIFIR[5] + * FSP_ECC_ERR_CE + */ + (PsiFir, bit(5)) ? TBDDefaultCallout; + + /** PSIFIR[6] + * FSP_ECC_ERR_UE + */ + (PsiFir, bit(6)) ? TBDDefaultCallout; + + /** PSIFIR[7] + * ERROR_STATE + */ + (PsiFir, bit(7)) ? TBDDefaultCallout; + + /** PSIFIR[8] + * INVALID_TTYPE + */ + (PsiFir, bit(8)) ? TBDDefaultCallout; + + /** PSIFIR[9] + * INVALID_CRESP + */ + (PsiFir, bit(9)) ? TBDDefaultCallout; + + /** PSIFIR[10] + * PB_DATA_TIME_OUT + */ + (PsiFir, bit(10)) ? TBDDefaultCallout; + + /** PSIFIR[11] + * PB_PARITY_ERROR + */ + (PsiFir, bit(11)) ? TBDDefaultCallout; + + /** PSIFIR[12] + * FSP_ACCESS_TRUSTED_SPACE + */ + (PsiFir, bit(12)) ? TBDDefaultCallout; + + /** PSIFIR[13] + * UNEXPECTED_PB + */ + (PsiFir, bit(13)) ? TBDDefaultCallout; + + /** PSIFIR[14] + * INTERRUPT_REG_CHANGE_WHILE_ACTIVE + */ + (PsiFir, bit(14)) ? TBDDefaultCallout; + + /** PSIFIR[15] + * INTERRUPT0_ADDRESS_ERROR + */ + (PsiFir, bit(15)) ? TBDDefaultCallout; + + /** PSIFIR[16] + * INTERRUPT1_ADDRESS_ERROR + */ + (PsiFir, bit(16)) ? TBDDefaultCallout; + + /** PSIFIR[17] + * INTERRUPT2_ADDRESS_ERROR + */ + (PsiFir, bit(17)) ? TBDDefaultCallout; + + /** PSIFIR[18] + * INTERRUPT3_ADDRESS_ERROR + */ + (PsiFir, bit(18)) ? TBDDefaultCallout; + + /** PSIFIR[19] + * INTERRUPT4_ADDRESS_ERROR + */ + (PsiFir, bit(19)) ? TBDDefaultCallout; + + /** PSIFIR[20] + * INTERRUPT5_ADDRESS_ERROR + */ + (PsiFir, bit(20)) ? TBDDefaultCallout; + + /** PSIFIR[21] + * TCBR_TP_PSI_GLB_ERR_0 + */ + (PsiFir, bit(21)) ? TBDDefaultCallout; + + /** PSIFIR[22] + * TCBR_TP_PSI_GLB_ERR_1 + */ + (PsiFir, bit(22)) ? TBDDefaultCallout; + + /** PSIFIR[23] + * SCOM_ERROR + */ + (PsiFir, bit(23)) ? TBDDefaultCallout; + + /** PSIFIR[24] + * FIR_PARITY_ERROR + */ + (PsiFir, bit(24)) ? TBDDefaultCallout; +}; + +################################################################################ +# PB Chiplet ICPFIR +################################################################################ + +rule IcpFir +{ + CHECK_STOP: ICPFIR & ~ICPFIR_MASK & ~ICPFIR_ACT0 & ~ICPFIR_ACT1; + RECOVERABLE: ICPFIR & ~ICPFIR_MASK & ~ICPFIR_ACT0 & ICPFIR_ACT1; +}; + +group gIcpFir filter singlebit +{ + /** ICPFIR[0] + * INT_HW_ERROR_EOI_Q + */ + (IcpFir, bit(0)) ? TBDDefaultCallout; + + /** ICPFIR[1] + * INT_HW_ERROR_FWD_Q + */ + (IcpFir, bit(1)) ? TBDDefaultCallout; + + /** ICPFIR[2] + * INT_HW_ERROR_IR_QU + */ + (IcpFir, bit(2)) ? TBDDefaultCallout; + + /** ICPFIR[3] + * INT_HW_ERROR_RET_Q + */ + (IcpFir, bit(3)) ? TBDDefaultCallout; + + /** ICPFIR[4] + * INT_HW_ERROR_ADDRI + */ + (IcpFir, bit(4)) ? TBDDefaultCallout; + + /** ICPFIR[5] + * INT_HW_ERROR_DATAI + */ + (IcpFir, bit(5)) ? TBDDefaultCallout; + + /** ICPFIR[6] + * INT_HW_ERROR_ADDRO + */ + (IcpFir, bit(7)) ? TBDDefaultCallout; + + /** ICPFIR[8] + * INT_HW_ERROR_LDSTQ + */ + (IcpFir, bit(8)) ? TBDDefaultCallout; + + /** ICPFIR[9] + * INT_HW_ERROR_REQQ + */ + (IcpFir, bit(9)) ? TBDDefaultCallout; + + /** ICPFIR[10] + * SCOM_REG_CHECK + */ + (IcpFir, bit(10)) ? TBDDefaultCallout; + + /** ICPFIR[11] + * INVALID_FORWARD_SETUP + */ + (IcpFir, bit(11)) ? TBDDefaultCallout; + + /** ICPFIR[12] + * ADDRESS_CORE_FIELD + */ + (IcpFir, bit(12)) ? TBDDefaultCallout; + + /** ICPFIR[13] + * ADDRESS_CORE_FIELD_MMIO + */ + (IcpFir, bit(13)) ? TBDDefaultCallout; + + /** ICPFIR[14] + * UNSOLICITED_CRESP + */ + (IcpFir, bit(14)) ? TBDDefaultCallout; + + /** ICPFIR[15] + * UNSOLICITED_DATA + */ + (IcpFir, bit(15)) ? TBDDefaultCallout; + + /** ICPFIR[16] + * INVALID_CMD + */ + (IcpFir, bit(16)) ? TBDDefaultCallout; + + /** ICPFIR[17] + * INVALID_CRESPZ + */ + (IcpFir, bit(17)) ? TBDDefaultCallout; + + /** ICPFIR[18] + * INVALID_CRESP + */ + (IcpFir, bit(18)) ? TBDDefaultCallout; + + /** ICPFIR[19] + * Reserved field (Access type is reserved) + */ + (IcpFir, bit(19)) ? TBDDefaultCallout; + + /** ICPFIR[20] + * ECC_CE_ON_DATA + */ + (IcpFir, bit(20)) ? TBDDefaultCallout; + + /** ICPFIR[21] + * ECC_UE_ON_DATA + */ + (IcpFir, bit(21)) ? TBDDefaultCallout; + + /** ICPFIR[22] + * ECC_SUE_ON_DATA + */ + (IcpFir, bit(22)) ? TBDDefaultCallout; + + /** ICPFIR[23] + * PARITY_CHK_ADDRESS + */ + (IcpFir, bit(23)) ? TBDDefaultCallout; + + /** ICPFIR[24] + * PARITY_CHK_TAG + */ + (IcpFir, bit(24)) ? TBDDefaultCallout; + + /** ICPFIR[25] + * TIMEOUT_LD_STQ + */ + (IcpFir, bit(25)) ? TBDDefaultCallout; + + /** ICPFIR[26] + * TIMEOUT_RETURNQ + */ + (IcpFir, bit(26)) ? TBDDefaultCallout; + + /** ICPFIR[27] + * TIMEOUT_FWDQ + */ + (IcpFir, bit(27)) ? TBDDefaultCallout; + + /** ICPFIR[28] + * TIMEOUT_EOIQ + */ + (IcpFir, bit(28)) ? TBDDefaultCallout; + + /** ICPFIR[32] + * EXT_TRACE_0 + */ + (IcpFir, bit(32)) ? TBDDefaultCallout; + + /** ICPFIR[33] + * EXT_TRACE_1 + */ + (IcpFir, bit(33)) ? TBDDefaultCallout; + + /** ICPFIR[34] + * ADU_RECOV + */ + (IcpFir, bit(34)) ? TBDDefaultCallout; + + /** ICPFIR[35] + * EXT_XSTOP + */ + (IcpFir, bit(35)) ? TBDDefaultCallout; +}; + +################################################################################ +# PB Chiplet PBAFIR +################################################################################ + +rule PbaFir +{ + CHECK_STOP: PBAFIR & ~PBAFIR_MASK & ~PBAFIR_ACT0 & ~PBAFIR_ACT1; + RECOVERABLE: PBAFIR & ~PBAFIR_MASK & ~PBAFIR_ACT0 & PBAFIR_ACT1; +}; + +group gPbaFir filter singlebit +{ + /** PBAFIR[0] + * PBAFIR_OCI_APAR_ERR + */ + (PbaFir, bit(0)) ? TBDDefaultCallout; + + /** PBAFIR[1] + * PBAFIR_PB_RDADRERR_FW + */ + (PbaFir, bit(1)) ? TBDDefaultCallout; + + /** PBAFIR[2] + * PBAFIR_PB_RDDATATO_FW + */ + (PbaFir, bit(2)) ? TBDDefaultCallout; + + /** PBAFIR[3] + * PBAFIR_PB_SUE_FW + */ + (PbaFir, bit(3)) ? TBDDefaultCallout; + + /** PBAFIR[4] + * PBAFIR_PB_UE_FW + */ + (PbaFir, bit(4)) ? TBDDefaultCallout; + + /** PBAFIR[5] + * PBAFIR_PB_CE_FW + */ + (PbaFir, bit(5)) ? TBDDefaultCallout; + + /** PBAFIR[6] + * PBAFIR_OCI_SLAVE_INIT + */ + (PbaFir, bit(6)) ? TBDDefaultCallout; + + /** PBAFIR[7] + * PBAFIR_OCI_WRPAR_ERR + */ + (PbaFir, bit(7)) ? TBDDefaultCallout; + + /** PBAFIR[8] + * PBAFIR_OCI_REREQTO + */ + (PbaFir, bit(8)) ? TBDDefaultCallout; + + /** PBAFIR[9] + * PBAFIR_PB_UNEXPCRESP + */ + (PbaFir, bit(9)) ? TBDDefaultCallout; + + /** PBAFIR[10] + * PBAFIR_PB_UNEXPDATA + */ + (PbaFir, bit(10)) ? TBDDefaultCallout; + + /** PBAFIR[11] + * PBAFIR_PB_PARITY_ERR + */ + (PbaFir, bit(11)) ? TBDDefaultCallout; + + /** PBAFIR[12] + * PBAFIR_PB_WRADRERR_FW + */ + (PbaFir, bit(12)) ? TBDDefaultCallout; + + /** PBAFIR[13] + * PBAFIR_PB_BADCRESP + */ + (PbaFir, bit(13)) ? TBDDefaultCallout; + + /** PBAFIR[14] + * PBAFIR_PB_ACKDEAD_FW + */ + (PbaFir, bit(14)) ? TBDDefaultCallout; + + /** PBAFIR[15] + * PBAFIR_PB_CRESPTO + */ + (PbaFir, bit(15)) ? TBDDefaultCallout; + + /** PBAFIR[16] + * PBAFIR_BCUE_SETUP_ERR + */ + (PbaFir, bit(16)) ? TBDDefaultCallout; + + /** PBAFIR[17] + * PBAFIR_BCUE_PB_ACK_DEAD + */ + (PbaFir, bit(17)) ? TBDDefaultCallout; + + /** PBAFIR[18] + * PBAFIR_BCUE_PB_ADRERR + */ + (PbaFir, bit(18)) ? TBDDefaultCallout; + + /** PBAFIR[19] + * PBAFIR_BCUE_OCI_DATERR + */ + (PbaFir, bit(19)) ? TBDDefaultCallout; + + /** PBAFIR[20] + * PBAFIR_BCDE_SETUP_ERR + */ + (PbaFir, bit(20)) ? TBDDefaultCallout; + + /** PBAFIR[21] + * PBAFIR_BCDE_PB_ACK_DEAD + */ + (PbaFir, bit(21)) ? TBDDefaultCallout; + + /** PBAFIR[22] + * PBAFIR_BCDE_PB_ADRERR + */ + (PbaFir, bit(22)) ? TBDDefaultCallout; + + /** PBAFIR[23] + * PBAFIR_BCDE_RDDATATO_ERR + */ + (PbaFir, bit(23)) ? TBDDefaultCallout; + + /** PBAFIR[24] + * PBAFIR_BCDE_SUE_ERR + */ + (PbaFir, bit(24)) ? TBDDefaultCallout; + + /** PBAFIR[25] + * PBAFIR_BCDE_UE_ERR + */ + (PbaFir, bit(25)) ? TBDDefaultCallout; + + /** PBAFIR[26] + * PBAFIR_BCDE_CE + */ + (PbaFir, bit(26)) ? TBDDefaultCallout; + + /** PBAFIR[27] + * PBAFIR_BCDE_OCI_DATERR + */ + (PbaFir, bit(27)) ? TBDDefaultCallout; + + /** PBAFIR[28] + * PBAFIR_INTERNAL_ERR + */ + (PbaFir, bit(28)) ? TBDDefaultCallout; + + /** PBAFIR[29] + * PBAFIR_ILLEGAL_CACHE_OP + */ + (PbaFir, bit(29)) ? TBDDefaultCallout; + + /** PBAFIR[30] + * PBAFIR_OCI_BAD_REG_ADDR + */ + (PbaFir, bit(30)) ? TBDDefaultCallout; + + /** PBAFIR[31] + * PBAFIR_AXPUSH_WRERR + */ + (PbaFir, bit(31)) ? TBDDefaultCallout; + + /** PBAFIR[32] + * PBAFIR_AXRCV_DLO_ERR + */ + (PbaFir, bit(32)) ? TBDDefaultCallout; + + /** PBAFIR[33] + * PBAFIR_AXRCV_DLO_TO + */ + (PbaFir, bit(33)) ? TBDDefaultCallout; + + /** PBAFIR[34] + * PBAFIR_AXRCV_RSVDATA_TO + */ + (PbaFir, bit(34)) ? TBDDefaultCallout; + + /** PBAFIR[35] + * PBAFIR_AXFLOW_ERR + */ + (PbaFir, bit(35)) ? TBDDefaultCallout; + + /** PBAFIR[36] + * PBAFIR_AXSND_DHI_RTYTO + */ + (PbaFir, bit(36)) ? TBDDefaultCallout; + + /** PBAFIR[37] + * PBAFIR_AXSND_DLO_RTYTO + */ + (PbaFir, bit(37)) ? TBDDefaultCallout; + + /** PBAFIR[38] + * PBAFIR_AXSND_RSVTO + */ + (PbaFir, bit(38)) ? TBDDefaultCallout; + + /** PBAFIR[39] + * PBAFIR_AXSND_RSVERR + */ + (PbaFir, bit(39)) ? TBDDefaultCallout; + + /** PBAFIR[40] + * PBAFIR_PB_ACKDEAD_FW_WR + */ + (PbaFir, bit(40)) ? TBDDefaultCallout; + + /** PBAFIR[44|45] + * PBAFIR_FIR_PARITY_ERR + */ + (PbaFir, bit(44|45)) ? TBDDefaultCallout; +}; + +################################################################################ +# PB Chiplet EHHCAFIR +################################################################################ + +rule EhHcaFir +{ + CHECK_STOP: EHHCAFIR & ~EHHCAFIR_MASK & ~EHHCAFIR_ACT0 & ~EHHCAFIR_ACT1; + RECOVERABLE: EHHCAFIR & ~EHHCAFIR_MASK & ~EHHCAFIR_ACT0 & EHHCAFIR_ACT1; +}; + +group gEhHcaFir filter singlebit +{ + /** EHHCAFIR[0] + * CE1_0_OUT: array0_a CE + */ + (EhHcaFir, bit(0)) ? TBDDefaultCallout; + + /** EHHCAFIR[1] + * CE2_0_OUT: array0_b CE + */ + (EhHcaFir, bit(1)) ? TBDDefaultCallout; + + /** EHHCAFIR[2 + * UE1_0_OUT: array0_a ue + */ + (EhHcaFir, bit(2)) ? TBDDefaultCallout; + + /** EHHCAFIR[3] + * UE2_0_OUT: array0_b ue + */ + (EhHcaFir, bit(3)) ? TBDDefaultCallout; + + /** EHHCAFIR[4] + * CE1_1_OUT: array1_a CE + */ + (EhHcaFir, bit(4)) ? TBDDefaultCallout; + + /** EHHCAFIR[5] + * CE2_1_OUT: array1_b CE + */ + (EhHcaFir, bit(5)) ? TBDDefaultCallout; + + /** EHHCAFIR[6] + * UE1_1_OUT: array1_a ue + */ + (EhHcaFir, bit(6)) ? TBDDefaultCallout; + + /** EHHCAFIR[7] + * UE2_1_OUT: array1_b ue + */ + (EhHcaFir, bit(7)) ? TBDDefaultCallout; + + /** EHHCAFIR[8] + * CE1_2_OUT: array2_a CE + */ + (EhHcaFir, bit(8)) ? TBDDefaultCallout; + + /** EHHCAFIR[9] + * CE2_2_OUT: array2_b CE + */ + (EhHcaFir, bit(9)) ? TBDDefaultCallout; + + /** EHHCAFIR[10] + * UE1_2_OUT: array2_a ue + */ + (EhHcaFir, bit(10)) ? TBDDefaultCallout; + + /** EHHCAFIR[11] + * UE2_2_OUT: array2_b ue + */ + (EhHcaFir, bit(11)) ? TBDDefaultCallout; + + /** EHHCAFIR[12] + * CE1_3_OUT: array3_a CE + */ + (EhHcaFir, bit(12)) ? TBDDefaultCallout; + + /** EHHCAFIR[13] + * CE2_3_OUT: array3_b CE + */ + (EhHcaFir, bit(13)) ? TBDDefaultCallout; + + /** EHHCAFIR[14] + * UE1_3_OUT: array3_a ue + */ + (EhHcaFir, bit(14)) ? TBDDefaultCallout; + + /** EHHCAFIR[15] + * UE2_3_OUT: array3_b ue + */ + (EhHcaFir, bit(15)) ? TBDDefaultCallout; + + /** EHHCAFIR[16] + * CE1_4_OUT: array4_a CE + */ + (EhHcaFir, bit(16)) ? TBDDefaultCallout; + + /** EHHCAFIR[17] + * CE2_4_OUT: array4_b CE + */ + (EhHcaFir, bit(17)) ? TBDDefaultCallout; + + /** EHHCAFIR[18] + * UE1_4_OUT: array4_a ue + */ + (EhHcaFir, bit(18)) ? TBDDefaultCallout; + + /** EHHCAFIR[19] + * UE2_4_OUT: array4_b ue + */ + (EhHcaFir, bit(19)) ? TBDDefaultCallout; + + /** EHHCAFIR[20] + * CE1_5_OUT: array5_a CE + */ + (EhHcaFir, bit(20)) ? TBDDefaultCallout; + + /** EHHCAFIR[21] + * CE2_5_OUT: array5_b CE + */ + (EhHcaFir, bit(21)) ? TBDDefaultCallout; + + /** EHHCAFIR[22] + * UE1_5_OUT: array5_a ue + */ + (EhHcaFir, bit(22)) ? TBDDefaultCallout; + + /** EHHCAFIR[23] + * UE2_5_OUT: array5_b ue + */ + (EhHcaFir, bit(23)) ? TBDDefaultCallout; + + /** EHHCAFIR[24] + * CE1_6_OUT: array6_a CE + */ + (EhHcaFir, bit(24)) ? TBDDefaultCallout; + + /** EHHCAFIR[25] + * CE2_6_OUT: array6_b CE + */ + (EhHcaFir, bit(25)) ? TBDDefaultCallout; + + /** EHHCAFIR[26] + * UE1_6_OUT: array6_a ue + */ + (EhHcaFir, bit(26)) ? TBDDefaultCallout; + + /** EHHCAFIR[27] + * UE2_6_OUT: array6_b ue + */ + (EhHcaFir, bit(27)) ? TBDDefaultCallout; + + /** EHHCAFIR[28] + * CE1_7_OUT: array7_a CE + */ + (EhHcaFir, bit(28)) ? TBDDefaultCallout; + + /** EHHCAFIR[29] + * CE2_7_OUT: array7_b CE + */ + (EhHcaFir, bit(29)) ? TBDDefaultCallout; + + /** EHHCAFIR[30] + * UE1_7_OUT: array7_a ue + */ + (EhHcaFir, bit(30)) ? TBDDefaultCallout; + + /** EHHCAFIR[31] + * UE2_7_OUT: array7_b ue + */ + (EhHcaFir, bit(31)) ? TBDDefaultCallout; + + /** EHHCAFIR[32] + * DROP_COUNTER_FULL: Drop Counter Full + */ + (EhHcaFir, bit(32)) ? TBDDefaultCallout; + + /** EHHCAFIR[33] + * INTERNAL_ERROR: Internal Error + */ + (EhHcaFir, bit(33)) ? TBDDefaultCallout; + + /** EHHCAFIR[34] + * SCOM_ERROR + */ + (EhHcaFir, bit(34)) ? TBDDefaultCallout; + + /** EHHCAFIR[35] + * FIR_PARITY_ERROR + */ + (EhHcaFir, bit(35)) ? TBDDefaultCallout; +}; + +################################################################################ +# PB Chiplet ENHCAFIR +################################################################################ + +rule EnHcaFir +{ + CHECK_STOP: ENHCAFIR & ~ENHCAFIR_MASK & ~ENHCAFIR_ACT0 & ~ENHCAFIR_ACT1; + RECOVERABLE: ENHCAFIR & ~ENHCAFIR_MASK & ~ENHCAFIR_ACT0 & ENHCAFIR_ACT1; +}; + +group gEnHcaFir filter singlebit +{ + /** ENHCAFIR[0] + * DPX0_DAT_UE: PB0 data UE + */ + (EnHcaFir, bit(0)) ? TBDDefaultCallout; + + /** ENHCAFIR[1] + * DPX0_DAT_SUE: PB0 data UE + */ + (EnHcaFir, bit(1)) ? TBDDefaultCallout; + + /** ENHCAFIR[2] + * DPX0_DAT_CE: PB0 data ue + */ + (EnHcaFir, bit(2)) ? TBDDefaultCallout; + + /** ENHCAFIR[3] + * + */ + (EnHcaFir, bit(3)) ? TBDDefaultCallout; + + /** ENHCAFIR[4] + * CO_DROP_COUNTER_FULL: Castout Drop Counter Full + */ + (EnHcaFir, bit(4)) ? TBDDefaultCallout; + + /** ENHCAFIR[5] + * DATA_HANG_DETECT: Castout Drop Counter Full + */ + (EnHcaFir, bit(5)) ? TBDDefaultCallout; + + /** ENHCAFIR[6] + * UNEXPECTED_DATA_OR_CRESP: Castout Drop Counter Full + */ + (EnHcaFir, bit(6)) ? TBDDefaultCallout; + + /** ENHCAFIR[7] + * INTERNAL_ERROR: Castout Drop Counter Full + */ + (EnHcaFir, bit(7)) ? TBDDefaultCallout; + + /** ENHCAFIR[8] + * SCOM_ERROR + */ + (EnHcaFir, bit(8)) ? TBDDefaultCallout; + + /** ENHCAFIR[9] + * FIR_PARITY_ERROR + */ + (EnHcaFir, bit(9)) ? TBDDefaultCallout; +}; + +################################################################################ +# PB Chiplet PCINESTFIRs +################################################################################ + +# TODO - All these FIRs should have the same bit definition. Idealy, we will +# only want to have one copy of the bit definition. Unfortuately, the +# rule code parser does not have the support for something like this. +# Maybe we can add this as a later feature. + +rule PciNestFir_0 +{ + CHECK_STOP: + PCINESTFIR_0 & ~PCINESTFIR_0_MASK & ~PCINESTFIR_0_ACT0 & ~PCINESTFIR_0_ACT1; + RECOVERABLE: + PCINESTFIR_0 & ~PCINESTFIR_0_MASK & ~PCINESTFIR_0_ACT0 & PCINESTFIR_0_ACT1; +}; + +rule PciNestFir_1 +{ + CHECK_STOP: + PCINESTFIR_1 & ~PCINESTFIR_1_MASK & ~PCINESTFIR_1_ACT0 & ~PCINESTFIR_1_ACT1; + RECOVERABLE: + PCINESTFIR_1 & ~PCINESTFIR_1_MASK & ~PCINESTFIR_1_ACT0 & PCINESTFIR_1_ACT1; +}; + +rule PciNestFir_2 +{ + CHECK_STOP: + PCINESTFIR_2 & ~PCINESTFIR_2_MASK & ~PCINESTFIR_2_ACT0 & ~PCINESTFIR_2_ACT1; + RECOVERABLE: + PCINESTFIR_2 & ~PCINESTFIR_2_MASK & ~PCINESTFIR_2_ACT0 & PCINESTFIR_2_ACT1; +}; + +group gPciNestFir filter singlebit +{ + /** PCINESTFIR_0[0] + * BAR_PE + */ + (PciNestFir_0, bit(0)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[0] + * BAR_PE + */ + (PciNestFir_1, bit(0)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[0] + * BAR_PE + */ + (PciNestFir_2, bit(0)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[1] + * NONBAR_PE + */ + (PciNestFir_0, bit(1)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[1] + * NONBAR_PE + */ + (PciNestFir_1, bit(1)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[1] + * NONBAR_PE + */ + (PciNestFir_2, bit(1)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[2] + * PB_TO_PEC_CE + */ + (PciNestFir_0, bit(2)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[2] + * PB_TO_PEC_CE + */ + (PciNestFir_1, bit(2)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[2] + * PB_TO_PEC_CE + */ + (PciNestFir_2, bit(2)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[3] + * PB_TO_PEC_UE + */ + (PciNestFir_0, bit(3)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[3] + * PB_TO_PEC_UE + */ + (PciNestFir_1, bit(3)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[3] + * PB_TO_PEC_UE + */ + (PciNestFir_2, bit(3)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[4] + * PB_TO_PEC_SUE + */ + (PciNestFir_0, bit(4)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[4] + * PB_TO_PEC_SUE + */ + (PciNestFir_1, bit(4)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[4] + * PB_TO_PEC_SUE + */ + (PciNestFir_2, bit(4)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[5] + * ARY_ECC_CE + */ + (PciNestFir_0, bit(5)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[5] + * ARY_ECC_CE + */ + (PciNestFir_1, bit(5)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[5] + * ARY_ECC_CE + */ + (PciNestFir_2, bit(5)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[6] + * ARY_ECC_UE + */ + (PciNestFir_0, bit(6)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[6] + * ARY_ECC_UE + */ + (PciNestFir_1, bit(6)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[6] + * ARY_ECC_UE + */ + (PciNestFir_2, bit(6)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[7] + * ARY_ECC_SUE + */ + (PciNestFir_0, bit(7)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[7] + * ARY_ECC_SUE + */ + (PciNestFir_1, bit(7)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[7] + * ARY_ECC_SUE + */ + (PciNestFir_2, bit(7)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[8] + * REGISTER_ARRAY_PE + */ + (PciNestFir_0, bit(8)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[8] + * REGISTER_ARRAY_PE + */ + (PciNestFir_1, bit(8)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[8] + * REGISTER_ARRAY_PE + */ + (PciNestFir_2, bit(8)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[9] + * PB_INTERFACE_PE + */ + (PciNestFir_0, bit(9)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[9] + * PB_INTERFACE_PE + */ + (PciNestFir_1, bit(9)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[9] + * PB_INTERFACE_PE + */ + (PciNestFir_2, bit(9)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[10] + * PB_DATA_HANG_ERRORS + */ + (PciNestFir_0, bit(10)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[10] + * PB_DATA_HANG_ERRORS + */ + (PciNestFir_1, bit(10)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[10] + * PB_DATA_HANG_ERRORS + */ + (PciNestFir_2, bit(10)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[11] + * PB_HANG_ERRORS + */ + (PciNestFir_0, bit(11)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[11] + * PB_HANG_ERRORS + */ + (PciNestFir_1, bit(11)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[11] + * PB_HANG_ERRORS + */ + (PciNestFir_2, bit(11)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[12] + * RD_ARE_ERRORS + */ + (PciNestFir_0, bit(12)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[12] + * RD_ARE_ERRORS + */ + (PciNestFir_1, bit(12)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[12] + * RD_ARE_ERRORS + */ + (PciNestFir_2, bit(12)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[13] + * NONRD_ARE_ERRORS + */ + (PciNestFir_0, bit(13)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[13] + * NONRD_ARE_ERRORS + */ + (PciNestFir_1, bit(13)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[13] + * NONRD_ARE_ERRORS + */ + (PciNestFir_2, bit(13)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[14] + * PCI_HANG_ERROR + */ + (PciNestFir_0, bit(14)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[14] + * PCI_HANG_ERROR + */ + (PciNestFir_1, bit(14)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[14] + * PCI_HANG_ERROR + */ + (PciNestFir_2, bit(14)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[15] + * PCI_CLOCK_ERROR + */ + (PciNestFir_0, bit(15)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[15] + * PCI_CLOCK_ERROR + */ + (PciNestFir_1, bit(15)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[15] + * PCI_CLOCK_ERROR + */ + (PciNestFir_2, bit(15)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[16] + * AIB_FENCE + */ + (PciNestFir_0, bit(16)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[16] + * AIB_FENCE + */ + (PciNestFir_1, bit(16)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[16] + * AIB_FENCE + */ + (PciNestFir_2, bit(16)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[17] + * HW_ERRORS + */ + (PciNestFir_0, bit(17)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[17] + * HW_ERRORS + */ + (PciNestFir_1, bit(17)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[17] + * HW_ERRORS + */ + (PciNestFir_2, bit(17)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[18] + * UNSOLICITIEDPBDATA + */ + (PciNestFir_0, bit(18)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[18] + * UNSOLICITIEDPBDATA + */ + (PciNestFir_1, bit(18)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[18] + * UNSOLICITIEDPBDATA + */ + (PciNestFir_2, bit(18)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[19] + * UNEXPECTEDCRESP + */ + (PciNestFir_0, bit(19)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[19] + * UNEXPECTEDCRESP + */ + (PciNestFir_1, bit(19)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[19] + * UNEXPECTEDCRESP + */ + (PciNestFir_2, bit(19)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[20] + * INVALIDCRESP + */ + (PciNestFir_0, bit(20)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[20] + * INVALIDCRESP + */ + (PciNestFir_1, bit(20)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[20] + * INVALIDCRESP + */ + (PciNestFir_2, bit(20)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[21] + * PBUNSUPPORTEDSIZE + */ + (PciNestFir_0, bit(21)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[21] + * PBUNSUPPORTEDSIZE + */ + (PciNestFir_1, bit(21)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[21] + * PBUNSUPPORTEDSIZE + */ + (PciNestFir_2, bit(21)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[22] + * PBUNSUPPORTEDCMD + */ + (PciNestFir_0, bit(22)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[22] + * PBUNSUPPORTEDCMD + */ + (PciNestFir_1, bit(22)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[22] + * PBUNSUPPORTEDCMD + */ + (PciNestFir_2, bit(22)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[23] + * AIB_PE + */ + (PciNestFir_0, bit(23)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[23] + * AIB_PE + */ + (PciNestFir_1, bit(23)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[23] + * AIB_PE + */ + (PciNestFir_2, bit(23)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[24] + * ASB_ERROR + */ + (PciNestFir_0, bit(24)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[24] + * ASB_ERROR + */ + (PciNestFir_1, bit(24)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[24] + * ASB_ERROR + */ + (PciNestFir_2, bit(24)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[25] + * FOREIGN_LINK_FAIL + */ + (PciNestFir_0, bit(25)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[25] + * FOREIGN_LINK_FAIL + */ + (PciNestFir_1, bit(25)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[25] + * FOREIGN_LINK_FAIL + */ + (PciNestFir_2, bit(25)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[26] + * FOREIGN_PB_HANG + */ + (PciNestFir_0, bit(26)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[26] + * FOREIGN_PB_HANG + */ + (PciNestFir_1, bit(26)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[26] + * FOREIGN_PB_HANG + */ + (PciNestFir_2, bit(26)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[27] + * CAPP_ERROR + */ + (PciNestFir_0, bit(27)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[27] + * CAPP_ERROR + */ + (PciNestFir_1, bit(27)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[27] + * CAPP_ERROR + */ + (PciNestFir_2, bit(27)) ? TBDDefaultCallout; + + /** PCINESTFIR_0[28] + * SYNC_SCOM_ERR + */ + (PciNestFir_0, bit(28)) ? TBDDefaultCallout; + + /** PCINESTFIR_1[28] + * SYNC_SCOM_ERR + */ + (PciNestFir_1, bit(28)) ? TBDDefaultCallout; + + /** PCINESTFIR_2[28] + * SYNC_SCOM_ERR + */ + (PciNestFir_2, bit(28)) ? TBDDefaultCallout; +}; + +################################################################################ +# PB Chiplet IOMCFIR_0 +################################################################################ + +# Venice only + +################################################################################ +# PB Chiplet IOMCFIR_1 +################################################################################ + +rule IomcFir_1 +{ + CHECK_STOP: IOMCFIR_1 & ~IOMCFIR_1_MASK & ~IOMCFIR_1_ACT0 & ~IOMCFIR_1_ACT1; + RECOVERABLE: IOMCFIR_1 & ~IOMCFIR_1_MASK & ~IOMCFIR_1_ACT0 & IOMCFIR_1_ACT1; +}; + +group gIomcFir_1 filter singlebit +{ +# FIXME:A temp fix to generate error signature by setting bit 0 + /** IOMCFIR_1[0] + * ERROR + */ + (IomcFir_1, bit(0)) ? TBDDefaultCallout; +}; + +################################################################################ +# Actions specific to PB chiplet +################################################################################ + + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Proc_acts_PCIE.rule b/src/usr/diag/prdf/common/plat/pegasus/Proc_acts_PCIE.rule new file mode 100755 index 000000000..ebc173ff8 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Proc_acts_PCIE.rule @@ -0,0 +1,1476 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Proc_acts_PCIE.rule $ +# +# 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 + +################################################################################ +# PCIE Chiplet Registers +################################################################################ + +rule PcieChipletFir +{ + CHECK_STOP: + (PCIE_CHIPLET_CS_FIR & `1EE0000000000000`) & ~PCIE_CHIPLET_FIR_MASK; + RECOVERABLE: + ((PCIE_CHIPLET_RE_FIR >> 2) & `1EE0000000000000`) & ~PCIE_CHIPLET_FIR_MASK; +}; + +group gPcieChipletFir filter singlebit +{ + /** PCIE_CHIPLET_FIR[3] + * Attention from LFIR + */ + (PcieChipletFir, bit(3)) ? analyze(gPcieLFir); + + /** PCIE_CHIPLET_FIR[4|5|6] + * Attention from PCICLOCKFIR (0-2) + */ + (PcieChipletFir, bit(4|5|6)) ? analyze(gPciClockFir); + + /** PCIE_CHIPLET_FIR[8] + * Attention from PBFFIR + */ + (PcieChipletFir, bit(8)) ? analyze(gPbfFir); + + /** PCIE_CHIPLET_FIR[9|10] + * Attention from IOPPCIFIR (0-1) + */ + (PcieChipletFir, bit(9|10)) ? analyze(gIopPciFir); +}; + +rule PcieChipletSpa +{ + SPECIAL: PCIE_CHIPLET_SPA & ~PCIE_CHIPLET_SPA_MASK; +}; + +group gPcieChipletSpa filter singlebit +{ + /** PCIE_CHIPLET_SPA[0] + * Attention from PBFFIR + */ + (PcieChipletSpa, bit(0)) ? analyze(gPbfFir); +}; + +################################################################################ +# PCIE Chiplet LFIR +################################################################################ + +rule PcieLFir +{ + CHECK_STOP: PCIE_LFIR & ~PCIE_LFIR_MASK & ~PCIE_LFIR_ACT0 & ~PCIE_LFIR_ACT1; + RECOVERABLE: PCIE_LFIR & ~PCIE_LFIR_MASK & ~PCIE_LFIR_ACT0 & PCIE_LFIR_ACT1; +}; + +group gPcieLFir filter singlebit +{ + /** PCIE_LFIR[0] + * CFIR internal parity error + */ + (PcieLFir, bit(0)) ? TBDDefaultCallout; + + /** PCIE_LFIR[1] + * Local errors from GPIO (PCB error) + */ + (PcieLFir, bit(1)) ? TBDDefaultCallout; + + /** PCIE_LFIR[2] + * Local errors from CC (PCB error) + */ + (PcieLFir, bit(2)) ? TBDDefaultCallout; + + /** PCIE_LFIR[3] + * Local errors from CC (OPCG, parity, scan collision, ...) + */ + (PcieLFir, bit(3)) ? TBDDefaultCallout; + + /** PCIE_LFIR[4] + * Local errors from PSC (PCB error) + */ + (PcieLFir, bit(4)) ? TBDDefaultCallout; + + /** PCIE_LFIR[5] + * Local errors from PSC (parity error) + */ + (PcieLFir, bit(5)) ? TBDDefaultCallout; + + /** PCIE_LFIR[6] + * Local errors from Thermal (parity error) + */ + (PcieLFir, bit(6)) ? TBDDefaultCallout; + + /** PCIE_LFIR[7] + * Local errors from Thermal (PCB error) + */ + (PcieLFir, bit(7)) ? TBDDefaultCallout; + + /** PCIE_LFIR[8|9] + * Local errors from Thermal (Trip error) + */ + (PcieLFir, bit(8|9)) ? TBDDefaultCallout; + + /** PCIE_LFIR[10|11] + * Local errors from Trace Array ( error) + */ + (PcieLFir, bit(10|11)) ? TBDDefaultCallout; +}; + +################################################################################ +# PCIE Chiplet PCICLOCKFIRs +################################################################################ + +# TODO - All these FIRs should have the same bit definition. Idealy, we will +# only want to have one copy of the bit definition. Unfortuately, the +# rule code parser does not have the support for something like this. +# Maybe we can add this as a later feature. + +rule PciClockFir_0 +{ + CHECK_STOP: + PCICLOCKFIR_0 & ~PCICLOCKFIR_0_MASK & ~PCICLOCKFIR_0_ACT0 & ~PCICLOCKFIR_0_ACT1; + RECOVERABLE: + PCICLOCKFIR_0 & ~PCICLOCKFIR_0_MASK & ~PCICLOCKFIR_0_ACT0 & PCICLOCKFIR_0_ACT1; +}; + +rule PciClockFir_1 +{ + CHECK_STOP: + PCICLOCKFIR_1 & ~PCICLOCKFIR_1_MASK & ~PCICLOCKFIR_1_ACT0 & ~PCICLOCKFIR_1_ACT1; + RECOVERABLE: + PCICLOCKFIR_1 & ~PCICLOCKFIR_1_MASK & ~PCICLOCKFIR_1_ACT0 & PCICLOCKFIR_1_ACT1; +}; + +rule PciClockFir_2 +{ + CHECK_STOP: + PCICLOCKFIR_2 & ~PCICLOCKFIR_2_MASK & ~PCICLOCKFIR_2_ACT0 & ~PCICLOCKFIR_2_ACT1; + RECOVERABLE: + PCICLOCKFIR_2 & ~PCICLOCKFIR_2_MASK & ~PCICLOCKFIR_2_ACT0 & PCICLOCKFIR_2_ACT1; +}; + +group gPciClockFir filter singlebit +{ + /** PCICLOCKFIR_0[0] + * AIB_COMMAND_INVALID + */ + (PciClockFir_0, bit(0)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[0] + * AIB_COMMAND_INVALID + */ + (PciClockFir_1, bit(0)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[0] + * AIB_COMMAND_INVALID + */ + (PciClockFir_2, bit(0)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[1] + * AIB_ADDRESSING_ERROR + */ + (PciClockFir_0, bit(1)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[1] + * AIB_ADDRESSING_ERROR + */ + (PciClockFir_1, bit(1)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[1] + * AIB_ADDRESSING_ERROR + */ + (PciClockFir_2, bit(1)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[2] + * AIB_SIZE_ALIGNMENT_ERROR + */ + (PciClockFir_0, bit(2)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[2] + * AIB_SIZE_ALIGNMENT_ERROR + */ + (PciClockFir_1, bit(2)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[2] + * AIB_SIZE_ALIGNMENT_ERROR + */ + (PciClockFir_2, bit(2)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[3] + * Reserved field (Access type is Reserved00) + */ + (PciClockFir_0, bit(3)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[3] + * Reserved field (Access type is Reserved00) + */ + (PciClockFir_1, bit(3)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[3] + * Reserved field (Access type is Reserved00) + */ + (PciClockFir_2, bit(3)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[4] + * AIB_CMD_CTRLS_PARITY_ERROR + */ + (PciClockFir_0, bit(4)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[4] + * AIB_CMD_CTRLS_PARITY_ERROR + */ + (PciClockFir_1, bit(4)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[4] + * AIB_CMD_CTRLS_PARITY_ERROR + */ + (PciClockFir_2, bit(4)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[5] + * AIB_DATA_CTRLS_PARITY_ERROR + */ + (PciClockFir_0, bit(5)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[5] + * AIB_DATA_CTRLS_PARITY_ERROR + */ + (PciClockFir_1, bit(5)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[5] + * AIB_DATA_CTRLS_PARITY_ERROR + */ + (PciClockFir_2, bit(5)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[6] + * MMIO_BAR_DOMAIN_TABLE_ECC_CORRECTABLE_ERROR + */ + (PciClockFir_0, bit(6)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[6] + * MMIO_BAR_DOMAIN_TABLE_ECC_CORRECTABLE_ERROR + */ + (PciClockFir_1, bit(6)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[6] + * MMIO_BAR_DOMAIN_TABLE_ECC_CORRECTABLE_ERROR + */ + (PciClockFir_2, bit(6)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[7] + * MMIO_BAR_DOMAIN_TABLE_ECC_UNCORRECTABLE_ERROR + */ + (PciClockFir_0, bit(7)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[7] + * MMIO_BAR_DOMAIN_TABLE_ECC_UNCORRECTABLE_ERROR + */ + (PciClockFir_1, bit(7)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[7] + * MMIO_BAR_DOMAIN_TABLE_ECC_UNCORRECTABLE_ERROR + */ + (PciClockFir_2, bit(7)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[8] + * AIB_BUS_PARITY_ERROR + */ + (PciClockFir_0, bit(8)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[8] + * AIB_BUS_PARITY_ERROR + */ + (PciClockFir_1, bit(8)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[8] + * AIB_BUS_PARITY_ERROR + */ + (PciClockFir_2, bit(8)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[9] + * Reserved field (Access type is Reserved01) + */ + (PciClockFir_0, bit(9)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[9] + * Reserved field (Access type is Reserved01) + */ + (PciClockFir_1, bit(9)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[9] + * Reserved field (Access type is Reserved01) + */ + (PciClockFir_2, bit(9)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[10] + * AIB_DATA_CTRLS_SEQUENCE_ERROR + */ + (PciClockFir_0, bit(10)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[10] + * AIB_DATA_CTRLS_SEQUENCE_ERROR + */ + (PciClockFir_1, bit(10)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[10] + * AIB_DATA_CTRLS_SEQUENCE_ERROR + */ + (PciClockFir_2, bit(10)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[11] + * MMIO_CMD_DATA_PARITY_ERROR + */ + (PciClockFir_0, bit(11)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[11] + * MMIO_CMD_DATA_PARITY_ERROR + */ + (PciClockFir_1, bit(11)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[11] + * MMIO_CMD_DATA_PARITY_ERROR + */ + (PciClockFir_2, bit(11)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[12] + * PCI_E_CFG_IO_WRITE_CA_OR_UR_RESPONSE + */ + (PciClockFir_0, bit(12)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[12] + * PCI_E_CFG_IO_WRITE_CA_OR_UR_RESPONSE + */ + (PciClockFir_1, bit(12)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[12] + * PCI_E_CFG_IO_WRITE_CA_OR_UR_RESPONSE + */ + (PciClockFir_2, bit(12)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[13] + * GBIF_TIMEOUT + */ + (PciClockFir_0, bit(13)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[13] + * GBIF_TIMEOUT + */ + (PciClockFir_1, bit(13)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[13] + * GBIF_TIMEOUT + */ + (PciClockFir_2, bit(13)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[14] + * MMIO_PENDING_ERROR + */ + (PciClockFir_0, bit(14)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[14] + * MMIO_PENDING_ERROR + */ + (PciClockFir_1, bit(14)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[14] + * MMIO_PENDING_ERROR + */ + (PciClockFir_2, bit(14)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[15] + * AIB_RX_DATA_ECC_CORRECTABLE_ERROR + */ + (PciClockFir_0, bit(15)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[15] + * AIB_RX_DATA_ECC_CORRECTABLE_ERROR + */ + (PciClockFir_1, bit(15)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[15] + * AIB_RX_DATA_ECC_CORRECTABLE_ERROR + */ + (PciClockFir_2, bit(15)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[16] + * AIB_RX_DATA_ECC_UNCORRECTABLE_ERROR + */ + (PciClockFir_0, bit(16)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[16] + * AIB_RX_DATA_ECC_UNCORRECTABLE_ERROR + */ + (PciClockFir_1, bit(16)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[16] + * AIB_RX_DATA_ECC_UNCORRECTABLE_ERROR + */ + (PciClockFir_2, bit(16)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[17] + * DCT_TABLE_ERROR + */ + (PciClockFir_0, bit(17)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[17] + * DCT_TABLE_ERROR + */ + (PciClockFir_1, bit(17)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[17] + * DCT_TABLE_ERROR + */ + (PciClockFir_2, bit(17)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[18] + * DMA_RESPONSE_DATA_ERROR + */ + (PciClockFir_0, bit(18)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[18] + * DMA_RESPONSE_DATA_ERROR + */ + (PciClockFir_1, bit(18)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[18] + * DMA_RESPONSE_DATA_ERROR + */ + (PciClockFir_2, bit(18)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[19] + * DMA_RESPONSE_TIMEOUT + */ + (PciClockFir_0, bit(19)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[19] + * DMA_RESPONSE_TIMEOUT + */ + (PciClockFir_1, bit(19)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[19] + * DMA_RESPONSE_TIMEOUT + */ + (PciClockFir_2, bit(19)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[20] + * TCE_RD_RESPONSE_ERROR_INDICATION + */ + (PciClockFir_0, bit(20)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[20] + * TCE_RD_RESPONSE_ERROR_INDICATION + */ + (PciClockFir_1, bit(20)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[20] + * TCE_RD_RESPONSE_ERROR_INDICATION + */ + (PciClockFir_2, bit(20)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[21] + * CFG_RETRY_TIMEOUT_ERROR + */ + (PciClockFir_0, bit(21)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[21] + * CFG_RETRY_TIMEOUT_ERROR + */ + (PciClockFir_1, bit(21)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[21] + * CFG_RETRY_TIMEOUT_ERROR + */ + (PciClockFir_2, bit(21)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[22] + * CFG_ACCESS_ERROR + */ + (PciClockFir_0, bit(22)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[22] + * CFG_ACCESS_ERROR + */ + (PciClockFir_1, bit(22)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[22] + * CFG_ACCESS_ERROR + */ + (PciClockFir_2, bit(22)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[24] + * RGA_MACRO_INTERNAL_ERROR + */ + (PciClockFir_0, bit(24)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[24] + * RGA_MACRO_INTERNAL_ERROR + */ + (PciClockFir_1, bit(24)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[24] + * RGA_MACRO_INTERNAL_ERROR + */ + (PciClockFir_2, bit(24)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[25] + * PHB3_REGISTER_PARITY_ERROR_RSM_ONE_HOT_ERROR + */ + (PciClockFir_0, bit(25)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[25] + * PHB3_REGISTER_PARITY_ERROR_RSM_ONE_HOT_ERROR + */ + (PciClockFir_1, bit(25)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[25] + * PHB3_REGISTER_PARITY_ERROR_RSM_ONE_HOT_ERROR + */ + (PciClockFir_2, bit(25)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[26] + * PHB3_REGISTER_ACCESS_ERROR + */ + (PciClockFir_0, bit(26)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[26] + * PHB3_REGISTER_ACCESS_ERROR + */ + (PciClockFir_1, bit(26)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[26] + * PHB3_REGISTER_ACCESS_ERROR + */ + (PciClockFir_2, bit(26)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[27] + * PAPR_OUTBOUND_INJECTION_ERROR_TRIGGERED + */ + (PciClockFir_0, bit(27)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[27] + * PAPR_OUTBOUND_INJECTION_ERROR_TRIGGERED + */ + (PciClockFir_1, bit(27)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[27] + * PAPR_OUTBOUND_INJECTION_ERROR_TRIGGERED + */ + (PciClockFir_2, bit(27)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[28] + * PCI_E_CORE_FATAL_ERROR + */ + (PciClockFir_0, bit(28)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[28] + * PCI_E_CORE_FATAL_ERROR + */ + (PciClockFir_1, bit(28)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[28] + * PCI_E_CORE_FATAL_ERROR + */ + (PciClockFir_2, bit(28)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[29] + * PCI_E_INBOUND_TLP_ECRC_ERROR + */ + (PciClockFir_0, bit(29)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[29] + * PCI_E_INBOUND_TLP_ECRC_ERROR + */ + (PciClockFir_1, bit(29)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[29] + * PCI_E_INBOUND_TLP_ECRC_ERROR + */ + (PciClockFir_2, bit(29)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[30] + * PCI_E_UTL_PRIMARY_INTERRUPT + */ + (PciClockFir_0, bit(30)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[30] + * PCI_E_UTL_PRIMARY_INTERRUPT + */ + (PciClockFir_1, bit(30)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[30] + * PCI_E_UTL_PRIMARY_INTERRUPT + */ + (PciClockFir_2, bit(30)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[31] + * PCI_E_UTL_SECONDARY_INTERRUPT + */ + (PciClockFir_0, bit(31)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[31] + * PCI_E_UTL_SECONDARY_INTERRUPT + */ + (PciClockFir_1, bit(31)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[31] + * PCI_E_UTL_SECONDARY_INTERRUPT + */ + (PciClockFir_2, bit(31)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[32] + * IODA_FATAL_ERROR + */ + (PciClockFir_0, bit(32)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[32] + * IODA_FATAL_ERROR + */ + (PciClockFir_1, bit(32)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[32] + * IODA_FATAL_ERROR + */ + (PciClockFir_2, bit(32)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[33] + * IODA_MSI_PE_MISMATCH_ERROR + */ + (PciClockFir_0, bit(33)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[33] + * IODA_MSI_PE_MISMATCH_ERROR + */ + (PciClockFir_1, bit(33)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[33] + * IODA_MSI_PE_MISMATCH_ERROR + */ + (PciClockFir_2, bit(33)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[34] + * IODA_IVT_ERROR + */ + (PciClockFir_0, bit(34)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[34] + * IODA_IVT_ERROR + */ + (PciClockFir_1, bit(34)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[34] + * IODA_IVT_ERROR + */ + (PciClockFir_2, bit(34)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[35] + * IODA_TVT_ERROR + */ + (PciClockFir_0, bit(35)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[35] + * IODA_TVT_ERROR + */ + (PciClockFir_1, bit(35)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[35] + * IODA_TVT_ERROR + */ + (PciClockFir_2, bit(35)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[36] + * IODA_TVT_ADDRESS_RANGE_ERROR + */ + (PciClockFir_0, bit(36)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[36] + * IODA_TVT_ADDRESS_RANGE_ERROR + */ + (PciClockFir_1, bit(36)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[36] + * IODA_TVT_ADDRESS_RANGE_ERROR + */ + (PciClockFir_2, bit(36)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[37] + * IODA_PAGE_ACCESS_ERROR + */ + (PciClockFir_0, bit(37)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[37] + * IODA_PAGE_ACCESS_ERROR + */ + (PciClockFir_1, bit(37)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[37] + * IODA_PAGE_ACCESS_ERROR + */ + (PciClockFir_2, bit(37)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[38] + * CFG_PAPR_INJECTION_TRIGGERED + */ + (PciClockFir_0, bit(38)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[38] + * CFG_PAPR_INJECTION_TRIGGERED + */ + (PciClockFir_1, bit(38)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[38] + * CFG_PAPR_INJECTION_TRIGGERED + */ + (PciClockFir_2, bit(38)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[39] + * PAPR_INBOUND_INJECTION_ERROR_TRIGGERED + */ + (PciClockFir_0, bit(39)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[39] + * PAPR_INBOUND_INJECTION_ERROR_TRIGGERED + */ + (PciClockFir_1, bit(39)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[39] + * PAPR_INBOUND_INJECTION_ERROR_TRIGGERED + */ + (PciClockFir_2, bit(39)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[40] + * INBOUND_FATAL_ERROR + */ + (PciClockFir_0, bit(40)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[40] + * INBOUND_FATAL_ERROR + */ + (PciClockFir_1, bit(40)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[40] + * INBOUND_FATAL_ERROR + */ + (PciClockFir_2, bit(40)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[41] + * MSI_ADDRESS_ALIGNMENT_ERROR + */ + (PciClockFir_0, bit(41)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[41] + * MSI_ADDRESS_ALIGNMENT_ERROR + */ + (PciClockFir_1, bit(41)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[41] + * MSI_ADDRESS_ALIGNMENT_ERROR + */ + (PciClockFir_2, bit(41)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[42] + * INTERNAL_BAR_DISABLED_ERROR + */ + (PciClockFir_0, bit(42)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[42] + * INTERNAL_BAR_DISABLED_ERROR + */ + (PciClockFir_1, bit(42)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[42] + * INTERNAL_BAR_DISABLED_ERROR + */ + (PciClockFir_2, bit(42)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[43] + * GBIF_INBOUND_COMPLETION_DONE_ERROR + */ + (PciClockFir_0, bit(43)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[43] + * GBIF_INBOUND_COMPLETION_DONE_ERROR + */ + (PciClockFir_1, bit(43)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[43] + * GBIF_INBOUND_COMPLETION_DONE_ERROR + */ + (PciClockFir_2, bit(43)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[44] + * PCT_TIMEOUT_ERROR + */ + (PciClockFir_0, bit(44)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[44] + * PCT_TIMEOUT_ERROR + */ + (PciClockFir_1, bit(44)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[44] + * PCT_TIMEOUT_ERROR + */ + (PciClockFir_2, bit(44)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[45] + * TCE_REQUEST_TIMEOUT_ERROR + */ + (PciClockFir_0, bit(45)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[45] + * TCE_REQUEST_TIMEOUT_ERROR + */ + (PciClockFir_1, bit(45)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[45] + * TCE_REQUEST_TIMEOUT_ERROR + */ + (PciClockFir_2, bit(45)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[47] + * AIB_TX_TIMEOUT_ERROR + */ + (PciClockFir_0, bit(47)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[47] + * AIB_TX_TIMEOUT_ERROR + */ + (PciClockFir_1, bit(47)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[47] + * AIB_TX_TIMEOUT_ERROR + */ + (PciClockFir_2, bit(47)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[48] + * AIB_TX_TIMEOUT_ERROR + */ + (PciClockFir_0, bit(48)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[48] + * AIB_TX_TIMEOUT_ERROR + */ + (PciClockFir_1, bit(48)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[48] + * AIB_TX_TIMEOUT_ERROR + */ + (PciClockFir_2, bit(48)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[49] + * TCE_REQUEST_UNEXPECTED_RESPONSE_ERROR + */ + (PciClockFir_0, bit(49)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[49] + * TCE_REQUEST_UNEXPECTED_RESPONSE_ERROR + */ + (PciClockFir_1, bit(49)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[49] + * TCE_REQUEST_UNEXPECTED_RESPONSE_ERROR + */ + (PciClockFir_2, bit(49)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[50] + * INBOUND_ECC_CORRECTABLE_ERROR + */ + (PciClockFir_0, bit(50)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[50] + * INBOUND_ECC_CORRECTABLE_ERROR + */ + (PciClockFir_1, bit(50)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[50] + * INBOUND_ECC_CORRECTABLE_ERROR + */ + (PciClockFir_2, bit(50)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[51] + * INBOUND_ECC_UNCORRECTABLE_ERROR + */ + (PciClockFir_0, bit(51)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[51] + * INBOUND_ECC_UNCORRECTABLE_ERROR + */ + (PciClockFir_1, bit(51)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[51] + * INBOUND_ECC_UNCORRECTABLE_ERROR + */ + (PciClockFir_2, bit(51)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[52] + * DMA_WRITE_MSI_INTERRUPT_DATA_POISONED_ERROR + */ + (PciClockFir_0, bit(52)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[52] + * DMA_WRITE_MSI_INTERRUPT_DATA_POISONED_ERROR + */ + (PciClockFir_1, bit(52)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[52] + * DMA_WRITE_MSI_INTERRUPT_DATA_POISONED_ERROR + */ + (PciClockFir_2, bit(52)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[55] + * DL_RX_MALFORMED + */ + (PciClockFir_0, bit(55)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[55] + * DL_RX_MALFORMED + */ + (PciClockFir_1, bit(55)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[55] + * DL_RX_MALFORMED + */ + (PciClockFir_2, bit(55)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[56] + * REPLAY_BUFFER_ECC_CORRECTABLE_ERROR + */ + (PciClockFir_0, bit(56)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[56] + * REPLAY_BUFFER_ECC_CORRECTABLE_ERROR + */ + (PciClockFir_1, bit(56)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[56] + * REPLAY_BUFFER_ECC_CORRECTABLE_ERROR + */ + (PciClockFir_2, bit(56)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[57] + * REPLAY_BUFFER_ECC_UNCORRECTABLE_ERROR + */ + (PciClockFir_0, bit(57)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[57] + * REPLAY_BUFFER_ECC_UNCORRECTABLE_ERROR + */ + (PciClockFir_1, bit(57)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[57] + * REPLAY_BUFFER_ECC_UNCORRECTABLE_ERROR + */ + (PciClockFir_2, bit(57)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[58] + * AIB_DAT_ERR_INDICATION + */ + (PciClockFir_0, bit(58)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[58] + * AIB_DAT_ERR_INDICATION + */ + (PciClockFir_1, bit(58)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[58] + * AIB_DAT_ERR_INDICATION + */ + (PciClockFir_2, bit(58)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[59] + * AIB_CREDITS_ERROR + */ + (PciClockFir_0, bit(59)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[59] + * AIB_CREDITS_ERROR + */ + (PciClockFir_1, bit(59)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[59] + * AIB_CREDITS_ERROR + */ + (PciClockFir_2, bit(59)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[60] + * CFG_EC08_FATAL_ERROR + */ + (PciClockFir_0, bit(60)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[60] + * CFG_EC08_FATAL_ERROR + */ + (PciClockFir_1, bit(60)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[60] + * CFG_EC08_FATAL_ERROR + */ + (PciClockFir_2, bit(60)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[61] + * CFG_EC08_NONFATAL_ERROR + */ + (PciClockFir_0, bit(61)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[61] + * CFG_EC08_NONFATAL_ERROR + */ + (PciClockFir_1, bit(61)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[61] + * CFG_EC08_NONFATAL_ERROR + */ + (PciClockFir_2, bit(61)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[62] + * CFG_EC08_CORR_ERROR + */ + (PciClockFir_0, bit(62)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[62] + * CFG_EC08_CORR_ERROR + */ + (PciClockFir_1, bit(62)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[62] + * CFG_EC08_CORR_ERROR + */ + (PciClockFir_2, bit(62)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_0[63] + * LEM_FIR_INTERNAL_PARITY_ERROR + */ + (PciClockFir_0, bit(63)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_1[63] + * LEM_FIR_INTERNAL_PARITY_ERROR + */ + (PciClockFir_1, bit(63)) ? TBDDefaultCallout; + + /** PCICLOCKFIR_2[63] + * LEM_FIR_INTERNAL_PARITY_ERROR + */ + (PciClockFir_2, bit(63)) ? TBDDefaultCallout; +}; + +################################################################################ +# PCIE Chiplet PBFFIR +################################################################################ + +rule PbfFir +{ + CHECK_STOP: PBFFIR & ~PBFFIR_MASK & ~PBFFIR_ACT0 & ~PBFFIR_ACT1; + RECOVERABLE: PBFFIR & ~PBFFIR_MASK & ~PBFFIR_ACT0 & PBFFIR_ACT1; + SPECIAL: PBFFIR & ~PBFFIR_MASK & PBFFIR_ACT0 & ~PBFFIR_ACT1; +}; + +group gPbfFir filter singlebit +{ + /** PBFFIR[0|1|2|3] + * F0_MAILBOX_WRITTEN + */ + (PbfFir, bit(0|1|2|3)) ? TBDDefaultCallout; + + /** PBFFIR[4] + * F0_RX_DETECT + */ + (PbfFir, bit(4)) ? TBDDefaultCallout; + + /** PBFFIR[5] + * F0_LINK_TRAINING_DONE + */ + (PbfFir, bit(5)) ? TBDDefaultCallout; + + /** PBFFIR[6] + * F0LINK_TRAINED + */ + (PbfFir, bit(6)) ? TBDDefaultCallout; + + /** PBFFIR[7] + * F0LINK_FIR_ERR + */ + (PbfFir, bit(7)) ? TBDDefaultCallout; + + /** PBFFIR[8] + * F0LINK_FMR_PSR_OBS_ERR + */ + (PbfFir, bit(8)) ? TBDDefaultCallout; + + /** PBFFIR[9] + * F0LINK_FMR_COR_ERR + */ + (PbfFir, bit(9)) ? TBDDefaultCallout; + + /** PBFFIR[10] + * F0LINK_FMR_SUE_ERR + */ + (PbfFir, bit(10)) ? TBDDefaultCallout; + + /** PBFFIR[11] + * F0LINK_FMR_UNC_ERR + */ + (PbfFir, bit(11)) ? TBDDefaultCallout; + + /** PBFFIR[12] + * F0_EQ_FAILED + */ + (PbfFir, bit(12)) ? TBDDefaultCallout; + + /** PBFFIR[13] + * F0_REPLAY_THRESHOLD + */ + (PbfFir, bit(13)) ? TBDDefaultCallout; + + /** PBFFIR[14] + * F0_CRC_ERROR + */ + (PbfFir, bit(14)) ? TBDDefaultCallout; + + /** PBFFIR[15] + * F0_LOST_PACKET + */ + (PbfFir, bit(15)) ? TBDDefaultCallout; + + /** PBFFIR[16] + * F0_NAK_RECEIVED + */ + (PbfFir, bit(16)) ? TBDDefaultCallout; + + /** PBFFIR[17] + * F0_REPLAY_TIMER_ERROR + */ + (PbfFir, bit(17)) ? TBDDefaultCallout; + + /** PBFFIR[18] + * F0_RETRAIN_THRESHOLD + */ + (PbfFir, bit(18)) ? TBDDefaultCallout; + + /** PBFFIR[19] + * F0_REPLAY_NUM_RETRAIN + */ + (PbfFir, bit(19)) ? TBDDefaultCallout; + + /** PBFFIR[20] + * F0_RX_ERROR + */ + (PbfFir, bit(20)) ? TBDDefaultCallout; + + /** PBFFIR[21] + * F0_DESKEW_ERROR + */ + (PbfFir, bit(21)) ? TBDDefaultCallout; + + /** PBFFIR[22] + * F0_FRAMING_ERROR + */ + (PbfFir, bit(22)) ? TBDDefaultCallout; + + /** PBFFIR[23] + * F0_OS_RECEIVED + */ + (PbfFir, bit(23)) ? TBDDefaultCallout; + + /** PBFFIR[24] + * F0_ECC_CE_ERR + */ + (PbfFir, bit(24)) ? TBDDefaultCallout; + + /** PBFFIR[25] + * F0_ECC_UE_ERR + */ + (PbfFir, bit(25)) ? TBDDefaultCallout; + + /** PBFFIR[26] + * F0_RETRAIN_ERR + */ + (PbfFir, bit(26)) ? TBDDefaultCallout; + + /** PBFFIR[27] + * F0_TRAINING_ERR + */ + (PbfFir, bit(27)) ? TBDDefaultCallout; + + /** PBFFIR[28] + * F0_UNRECOV_ERR + */ + (PbfFir, bit(28)) ? TBDDefaultCallout; + + /** PBFFIR[29] + * F0_INTERNAL_ERR + */ + (PbfFir, bit(29)) ? TBDDefaultCallout; + + /** PBFFIR[32|33|34|35] + * F1_MAILBOX_WRITTEN + */ + (PbfFir, bit(32|33|34|35)) ? TBDDefaultCallout; + + /** PBFFIR[36] + * F1_RX_DETECT + */ + (PbfFir, bit(36)) ? TBDDefaultCallout; + + /** PBFFIR[37] + * F1_LINK_TRAINING_DONE + */ + (PbfFir, bit(37)) ? TBDDefaultCallout; + + /** PBFFIR[38] + * F1LINK_TRAINED + */ + (PbfFir, bit(38)) ? TBDDefaultCallout; + + /** PBFFIR[39] + * F1LINK_FIR_ERR + */ + (PbfFir, bit(39)) ? TBDDefaultCallout; + + /** PBFFIR[40] + * F1LINK_FMR_PSR_OBS_ERR + */ + (PbfFir, bit(40)) ? TBDDefaultCallout; + + /** PBFFIR[41] + * F1LINK_FMR_COR_ERR + */ + (PbfFir, bit(41)) ? TBDDefaultCallout; + + /** PBFFIR[42] + * F1LINK_FMR_SUE_ERR + */ + (PbfFir, bit(42)) ? TBDDefaultCallout; + + /** PBFFIR[43] + * F1LINK_FMR_UNC_ERR + */ + (PbfFir, bit(43)) ? TBDDefaultCallout; + + /** PBFFIR[44] + * F1_EQ_FAILED + */ + (PbfFir, bit(44)) ? TBDDefaultCallout; + + /** PBFFIR[45] + * F1_REPLAY_THRESHOLD + */ + (PbfFir, bit(45)) ? TBDDefaultCallout; + + /** PBFFIR[46] + * F1_CRC_ERROR + */ + (PbfFir, bit(46)) ? TBDDefaultCallout; + + /** PBFFIR[47] + * F1_LOST_PACKET + */ + (PbfFir, bit(47)) ? TBDDefaultCallout; + + /** PBFFIR[48] + * F1_NAK_RECEIVED + */ + (PbfFir, bit(48)) ? TBDDefaultCallout; + + /** PBFFIR[49] + * F1_REPLAY_TIMER_ERROR + */ + (PbfFir, bit(49)) ? TBDDefaultCallout; + + /** PBFFIR[50] + * F1_RETRAIN_THRESHOLD + */ + (PbfFir, bit(50)) ? TBDDefaultCallout; + + /** PBFFIR[51] + * F1_REPLAY_NUM_RETRAIN + */ + (PbfFir, bit(51)) ? TBDDefaultCallout; + + /** PBFFIR[52] + * F1_RX_ERROR + */ + (PbfFir, bit(52)) ? TBDDefaultCallout; + + /** PBFFIR[53] + * F1_DESKEW_ERROR + */ + (PbfFir, bit(53)) ? TBDDefaultCallout; + + /** PBFFIR[54] + * F1_FRAMING_ERROR + */ + (PbfFir, bit(54)) ? TBDDefaultCallout; + + /** PBFFIR[55] + * F1_OS_RECEIVED + */ + (PbfFir, bit(55)) ? TBDDefaultCallout; + + /** PBFFIR[56] + * F1_ECC_CE_ERR + */ + (PbfFir, bit(56)) ? TBDDefaultCallout; + + /** PBFFIR[57] + * F1_ECC_UE_ERR + */ + (PbfFir, bit(57)) ? TBDDefaultCallout; + + /** PBFFIR[58] + * F1_RETRAIN_ERR + */ + (PbfFir, bit(58)) ? TBDDefaultCallout; + + /** PBFFIR[59] + * F1_TRAINING_ERR + */ + (PbfFir, bit(59)) ? TBDDefaultCallout; + + /** PBFFIR[60] + * F1_UNRECOV_ERR + */ + (PbfFir, bit(60)) ? TBDDefaultCallout; + + /** PBFFIR[61] + * F1_INTERNAL_ERR + */ + (PbfFir, bit(61)) ? TBDDefaultCallout; +}; + +################################################################################ +# PCIE Chiplet IOPPCIFIRs +################################################################################ + +# TODO - All these FIRs should have the same bit definition. Idealy, we will +# only want to have one copy of the bit definition. Unfortuately, the +# rule code parser does not have the support for something like this. +# Maybe we can add this as a later feature. + +rule IopPciFir_0 +{ + CHECK_STOP: + IOPPCIFIR_0 & ~IOPPCIFIR_0_MASK & ~IOPPCIFIR_0_ACT0 & ~IOPPCIFIR_0_ACT1; + RECOVERABLE: + IOPPCIFIR_0 & ~IOPPCIFIR_0_MASK & ~IOPPCIFIR_0_ACT0 & IOPPCIFIR_0_ACT1; +}; + +rule IopPciFir_1 +{ + CHECK_STOP: + IOPPCIFIR_1 & ~IOPPCIFIR_1_MASK & ~IOPPCIFIR_1_ACT0 & ~IOPPCIFIR_1_ACT1; + RECOVERABLE: + IOPPCIFIR_1 & ~IOPPCIFIR_1_MASK & ~IOPPCIFIR_1_ACT0 & IOPPCIFIR_1_ACT1; +}; + +group gIopPciFir filter singlebit +{ + /** IOPPCIFIR_0[0] + * FIR_STATUS_REG_G2_PLL_CCERR_STATUS + */ + (IopPciFir_0, bit(0)) ? TBDDefaultCallout; + + /** IOPPCIFIR_1[0] + * FIR_STATUS_REG_G2_PLL_CCERR_STATUS + */ + (IopPciFir_1, bit(0)) ? TBDDefaultCallout; + + /** IOPPCIFIR_0[1] + * FIR_STATUS_REG_G3_PLL_CCERR_STATUS + */ + (IopPciFir_0, bit(1)) ? TBDDefaultCallout; + + /** IOPPCIFIR_1[1] + * FIR_STATUS_REG_G3_PLL_CCERR_STATUS + */ + (IopPciFir_1, bit(1)) ? TBDDefaultCallout; + + /** IOPPCIFIR_0[2] + * FIR_STATUS_REG_TX_A_ERR_STATUS + */ + (IopPciFir_0, bit(2)) ? TBDDefaultCallout; + + /** IOPPCIFIR_1[2] + * FIR_STATUS_REG_TX_A_ERR_STATUS + */ + (IopPciFir_1, bit(2)) ? TBDDefaultCallout; + + /** IOPPCIFIR_0[3] + * FIR_STATUS_REG_TX_B_ERR_STATUS + */ + (IopPciFir_0, bit(3)) ? TBDDefaultCallout; + + /** IOPPCIFIR_1[3] + * FIR_STATUS_REG_TX_B_ERR_STATUS + */ + (IopPciFir_1, bit(3)) ? TBDDefaultCallout; + + /** IOPPCIFIR_0[4] + * FIR_STATUS_REG_RX_A_ERR_STATUS + */ + (IopPciFir_0, bit(4)) ? TBDDefaultCallout; + + /** IOPPCIFIR_1[4] + * FIR_STATUS_REG_RX_A_ERR_STATUS + */ + (IopPciFir_1, bit(4)) ? TBDDefaultCallout; + + /** IOPPCIFIR_0[5] + * FIR_STATUS_REG_RX_B_ERR_STATUS + */ + (IopPciFir_0, bit(5)) ? TBDDefaultCallout; + + /** IOPPCIFIR_1[5] + * FIR_STATUS_REG_RX_B_ERR_STATUS + */ + (IopPciFir_1, bit(5)) ? TBDDefaultCallout; + + /** IOPPCIFIR_0[6] + * FIR_STATUS_REG_ZCAL_B_ERR_STATUS + */ + (IopPciFir_0, bit(6)) ? TBDDefaultCallout; + + /** IOPPCIFIR_1[6] + * FIR_STATUS_REG_ZCAL_B_ERR_STATUS + */ + (IopPciFir_1, bit(6)) ? TBDDefaultCallout; + + /** IOPPCIFIR_0[7] + * FIR_STATUS_REG_SCOM_FIR_PERR0_STATUS + */ + (IopPciFir_0, bit(7)) ? TBDDefaultCallout; + + /** IOPPCIFIR_1[7] + * FIR_STATUS_REG_SCOM_FIR_PERR0_STATUS + */ + (IopPciFir_1, bit(7)) ? TBDDefaultCallout; + + /** IOPPCIFIR_0[8] + * FIR_STATUS_REG_SCOM_FIR_PERR1_STATUS + */ + (IopPciFir_0, bit(8)) ? TBDDefaultCallout; + + /** IOPPCIFIR_1[8] + * FIR_STATUS_REG_SCOM_FIR_PERR1_STATUS + */ + (IopPciFir_1, bit(8)) ? TBDDefaultCallout; +}; + +################################################################################ +# Actions specific to PCIE chiplet +################################################################################ + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Proc_acts_TP.rule b/src/usr/diag/prdf/common/plat/pegasus/Proc_acts_TP.rule new file mode 100755 index 000000000..2b4b50559 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Proc_acts_TP.rule @@ -0,0 +1,789 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Proc_acts_TP.rule $ +# +# 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 + +################################################################################ +# TP Chiplet Registers +################################################################################ + +rule TpChipletFir +{ + CHECK_STOP: + (TP_CHIPLET_CS_FIR & `1FFFF80000000000`) & ~TP_CHIPLET_FIR_MASK; + RECOVERABLE: + ((TP_CHIPLET_RE_FIR >> 2) & `1FFFF80000000000`) & ~TP_CHIPLET_FIR_MASK; +}; + +group gTpChipletFir filter singlebit +{ + /** TP_CHIPLET_FIR[3] + * Attention from TP_LFIR + */ + (TpChipletFir, bit(3)) ? analyze(gTpLFir); + + /** TP_CHIPLET_FIR[4] + * Attention from OCCFIR + */ + (TpChipletFir, bit(4)) ? analyze(gOccFir); + + /** TP_CHIPLET_FIR[5] + * Attention from MCIFIR (MCS 00 Venice only) + */ + (TpChipletFir, bit(5)) ? defaultMaskedError; + + /** TP_CHIPLET_FIR[6] + * Attention from MCIFIR (MCS 01 Venice only) + */ + (TpChipletFir, bit(6)) ? defaultMaskedError; + + /** TP_CHIPLET_FIR[7] + * Attention from MCIFIR (MCS 10 Venice only) + */ + (TpChipletFir, bit(7)) ? defaultMaskedError; + + /** TP_CHIPLET_FIR[8] + * Attention from MCIFIR (MCS 11 Venice only) + */ + (TpChipletFir, bit(8)) ? defaultMaskedError; + + /** TP_CHIPLET_FIR[9] + * Attention from MCIFIR (MCS 20) + */ + (TpChipletFir, bit(9)) ? analyzeMcs20; + + /** TP_CHIPLET_FIR[10] + * Attention from MCIFIR (MCS 21) + */ + (TpChipletFir, bit(10)) ? analyzeMcs21; + + /** TP_CHIPLET_FIR[11] + * Attention from MCIFIR (MCS 30) + */ + (TpChipletFir, bit(11)) ? analyzeMcs30; + + /** TP_CHIPLET_FIR[12] + * Attention from MCIFIR (MCS 31) + */ + (TpChipletFir, bit(12)) ? analyzeMcs31; + + /** TP_CHIPLET_FIR[13] + * Attention from IOMCFIR_1 (Venice only) + */ + (TpChipletFir, bit(13)) ? defaultMaskedError; + + /** TP_CHIPLET_FIR[14] + * Attention from IOMCFIR_1 + */ + (TpChipletFir, bit(14)) ? analyze(gIomcFir_1); + + /** TP_CHIPLET_FIR[15] + * Attention from PBAMFIR + */ + (TpChipletFir, bit(15)) ? analyze(gPbamFir); + + /** TP_CHIPLET_FIR[16|17|18|19] + * Attention from CS from MC 0-3 + */ + (TpChipletFir, bit(16|17|18|19)) ? defaultMaskedError; + + /** TP_CHIPLET_FIR[20] + * Attention from PMCFIR + */ + (TpChipletFir, bit(20)) ? analyze(gPmcFir); +}; + +rule TpChipletSpa +{ + SPECIAL: TP_CHIPLET_SPA & ~TP_CHIPLET_SPA_MASK; +}; + +group gTpChipletSpa filter singlebit +{ + /** TP_CHIPLET_FIR[0] + * Attention from OCCFIR + */ + (TpChipletSpa, bit(0)) ? analyze(gOccFir); + + /** TP_CHIPLET_FIR[1] + * Attention from MCIFIR_00 (Venice only) + */ + (TpChipletSpa, bit(1)) ? defaultMaskedError; + + /** TP_CHIPLET_FIR[2] + * Attention from MCIFIR_01 (Venice only) + */ + (TpChipletSpa, bit(2)) ? defaultMaskedError; + + /** TP_CHIPLET_FIR[3] + * Attention from MCIFIR_10 (Venice only) + */ + (TpChipletSpa, bit(3)) ? defaultMaskedError; + + /** TP_CHIPLET_FIR[4] + * Attention from MCIFIR_10 (Venice only) + */ + (TpChipletSpa, bit(4)) ? defaultMaskedError; + + /** TP_CHIPLET_FIR[5] + * Attention from MCIFIR_20 + */ + (TpChipletSpa, bit(5)) ? analyzeMcs20; + + /** TP_CHIPLET_FIR[6] + * Attention from MCIFIR_21 + */ + (TpChipletSpa, bit(6)) ? analyzeMcs21; + + /** TP_CHIPLET_FIR[7] + * Attention from MCIFIR_30 + */ + (TpChipletSpa, bit(7)) ? analyzeMcs30; + + /** TP_CHIPLET_FIR[8] + * Attention from MCIFIR_31 + */ + (TpChipletSpa, bit(8)) ? analyzeMcs31; +}; + +################################################################################ +# TP Chiplet LFIR +################################################################################ + +rule TpLFir +{ + CHECK_STOP: TP_LFIR & ~TP_LFIR_MASK & ~TP_LFIR_ACT0 & ~TP_LFIR_ACT1; + RECOVERABLE: TP_LFIR & ~TP_LFIR_MASK & ~TP_LFIR_ACT0 & TP_LFIR_ACT1; +}; + +group gTpLFir filter singlebit +{ + /** TP_LFIR[0] + * CFIR internal parity error + */ + (TpLFir, bit(0)) ? TBDDefaultCallout; + + /** TP_LFIR[1] + * Local errors from GPIO (PCB error) + */ + (TpLFir, bit(1)) ? TBDDefaultCallout; + + /** TP_LFIR[2] + * Local errors from CC (PCB error) + */ + (TpLFir, bit(2)) ? TBDDefaultCallout; + + /** TP_LFIR[3] + * Local errors from CC (OPCG, parity, scan collision, ...) + */ + (TpLFir, bit(3)) ? TBDDefaultCallout; + + /** TP_LFIR[4] + * Local errors from PSC (PCB error) + */ + (TpLFir, bit(4)) ? TBDDefaultCallout; + + /** TP_LFIR[5] + * Local errors from PSC (parity error) + */ + (TpLFir, bit(5)) ? TBDDefaultCallout; + + /** TP_LFIR[6] + * Local errors from Thermal (parity error) + */ + (TpLFir, bit(6)) ? TBDDefaultCallout; + + /** TP_LFIR[7] + * Local errors from Thermal (PCB error) + */ + (TpLFir, bit(7)) ? TBDDefaultCallout; + + /** TP_LFIR[8|9] + * Local errors from Thermal (Trip error) + */ + (TpLFir, bit(8|9)) ? TBDDefaultCallout; + + /** TP_LFIR[10|11] + * Local errors from Trace Array ( error) + */ + (TpLFir, bit(10|11)) ? TBDDefaultCallout; + + /** TP_LFIR[14] + * local errors from PCB ( error) + * + * These should never trigger directly themselves. + * Should be handled by global PRD PLL code. + */ + (TpLFir, bit(14)) ? threshold32pday; + +}; + +################################################################################ +# TP Chiplet OCCFIR +################################################################################ + +rule OccFir +{ + CHECK_STOP: OCCFIR & ~OCCFIR_MASK & ~OCCFIR_ACT0 & ~OCCFIR_ACT1; + RECOVERABLE: OCCFIR & ~OCCFIR_MASK & ~OCCFIR_ACT0 & OCCFIR_ACT1; + SPECIAL: OCCFIR & ~OCCFIR_MASK & OCCFIR_ACT0 & ~OCCFIR_ACT1; +}; + +group gOccFir filter singlebit +{ + /** OCCFIR[0] + * OCC_SCOM_OCCFIR_OCC_FW0 + */ + (OccFir, bit(0)) ? TBDDefaultCallout; + + /** OCCFIR[1] + * OCC_SCOM_OCCFIR_OCC_FW1 + */ + (OccFir, bit(1)) ? TBDDefaultCallout; + + /** OCCFIR[2] + * OCC_SCOM_OCCFIR_OCC_FW2 + */ + (OccFir, bit(2)) ? TBDDefaultCallout; + + /** OCCFIR[3] + * OCC_SCOM_OCCFIR_OCC_FW3 + */ + (OccFir, bit(3)) ? TBDDefaultCallout; + + /** OCCFIR[4] + * OCC_SCOM_OCCFIR_PMC_PORE_SW_MALF + */ + (OccFir, bit(4)) ? TBDDefaultCallout; + + /** OCCFIR[5] + * OCC_SCOM_OCCFIR_PMC_OCC_HB_MALF + */ + (OccFir, bit(5)) ? TBDDefaultCallout; + + /** OCCFIR[6] + * OCC_SCOM_OCCFIR_PORE_GPE0_FATAL_ERR + */ + (OccFir, bit(6)) ? TBDDefaultCallout; + + /** OCCFIR[7] + * OCC_SCOM_OCCFIR_PORE_GPE1_FATAL_ERR + */ + (OccFir, bit(7)) ? TBDDefaultCallout; + + /** OCCFIR[8] + * OCC_SCOM_OCCFIR_OCB_ERROR + */ + (OccFir, bit(8)) ? TBDDefaultCallout; + + /** OCCFIR[9] + * OCC_SCOM_OCCFIR_SRT_UE + */ + (OccFir, bit(9)) ? TBDDefaultCallout; + + /** OCCFIR[10] + * OCC_SCOM_OCCFIR_SRT_CE + */ + (OccFir, bit(10)) ? TBDDefaultCallout; + + /** OCCFIR[11] + * OCC_SCOM_OCCFIR_SRT_READ_ERROR + */ + (OccFir, bit(11)) ? TBDDefaultCallout; + + /** OCCFIR[12] + * OCC_SCOM_OCCFIR_SRT_WRITE_ERROR + */ + (OccFir, bit(12)) ? TBDDefaultCallout; + + /** OCCFIR[13] + * OCC_SCOM_OCCFIR_SRT_DATAOUT_PERR + */ + (OccFir, bit(13)) ? TBDDefaultCallout; + + /** OCCFIR[14] + * OCC_SCOM_OCCFIR_SRT_OCI_WRITE_DATA_PARITY + */ + (OccFir, bit(14)) ? TBDDefaultCallout; + + /** OCCFIR[15] + * OCC_SCOM_OCCFIR_SRT_OCI_BE_PARITY_ER + */ + (OccFir, bit(15)) ? TBDDefaultCallout; + + /** OCCFIR[16] + * OCC_SCOM_OCCFIR_SRT_OCI_ADDR_PARITY_ERR + */ + (OccFir, bit(16)) ? TBDDefaultCallout; + + /** OCCFIR[17] + * OCC_SCOM_OCCFIR_PORE_SW_ERROR_ERR + */ + (OccFir, bit(17)) ? TBDDefaultCallout; + + /** OCCFIR[18] + *OCC_SCOM_OCCFIR_PORE_GPE0_ERROR_ERR + */ + (OccFir, bit(18)) ? TBDDefaultCallout; + + /** OCCFIR[19] + * OCC_SCOM_OCCFIR_PORE_GPE1_ERROR_ERR + */ + (OccFir, bit(19)) ? TBDDefaultCallout; + + /** OCCFIR[20] + * OCC_SCOM_OCCFIR_EXTERNAL_TRAP + */ + (OccFir, bit(20)) ? TBDDefaultCallout; + + /** OCCFIR[21] + * OCC_SCOM_OCCFIR_PPC405_CORE_RESET + */ + (OccFir, bit(21)) ? TBDDefaultCallout; + + /** OCCFIR[22] + * OCC_SCOM_OCCFIR_PPC405_CHIP_RESET + */ + (OccFir, bit(22)) ? TBDDefaultCallout; + + /** OCCFIR[23] + * OCC_SCOM_OCCFIR_PPC405_SYSTEM_RESET + */ + (OccFir, bit(23)) ? TBDDefaultCallout; + + /** OCCFIR[24] + *OCC_SCOM_OCCFIR_PPC405_DBGMSRWE + */ + (OccFir, bit(24)) ? TBDDefaultCallout; + + /** OCCFIR[25] + * OCC_SCOM_OCCFIR_PPC405_DBGSTOPACK + */ + (OccFir, bit(25)) ? TBDDefaultCallout; + + /** OCCFIR[26] + * OCC_SCOM_OCCFIR_OCB_DB_OCI_TIMEOUT + */ + (OccFir, bit(26)) ? TBDDefaultCallout; + + /** OCCFIR[27] + * OCC_SCOM_OCCFIR_OCB_DB_OCI_READ_DATA_PARITY + */ + (OccFir, bit(27)) ? TBDDefaultCallout; + + /** OCCFIR[28] + * OCC_SCOM_OCCFIR_OCB_DB_OCI_SLAVE_ERROR + */ + (OccFir, bit(28)) ? TBDDefaultCallout; + + /** OCCFIR[29] + * OCC_SCOM_OCCFIR_OCB_PIB_ADDR_PARITY_ERR + */ + (OccFir, bit(29)) ? TBDDefaultCallout; + + /** OCCFIR[30] + * OCC_SCOM_OCCFIR_OCB_DB_PIB_DATA_PARITY_ERR + */ + (OccFir, bit(30)) ? TBDDefaultCallout; + + /** OCCFIR[31] + * OCC_SCOM_OCCFIR_OCB_IDC0_ERROR + */ + (OccFir, bit(31)) ? TBDDefaultCallout; + + /** OCCFIR[32] + * OCC_SCOM_OCCFIR_OCB_IDC1_ERROR + */ + (OccFir, bit(32)) ? TBDDefaultCallout; + + /** OCCFIR[33] + * OCC_SCOM_OCCFIR_OCB_IDC2_ERROR + */ + (OccFir, bit(33)) ? TBDDefaultCallout; + + /** OCCFIR[34] + * OCC_SCOM_OCCFIR_OCB_IDC3_ERROR + */ + (OccFir, bit(34)) ? TBDDefaultCallout; + + /** OCCFIR[35] + * OCC_SCOM_OCCFIR_SRT_FSM_ERR + */ + (OccFir, bit(35)) ? TBDDefaultCallout; + + /** OCCFIR[36] + * OCC_SCOM_OCCFIR_JTAGACC_ERR + */ + (OccFir, bit(36)) ? TBDDefaultCallout; + + /** OCCFIR[37] + * OCC_SCOM_OCCFIR_OCB_DW_ERR + */ + (OccFir, bit(37)) ? TBDDefaultCallout; + + /** OCCFIR[38] + * OCC_SCOM_OCCFIR_C405_ECC_UE + */ + (OccFir, bit(38)) ? TBDDefaultCallout; + + /** OCCFIR[39] + * OCC_SCOM_OCCFIR_C405_ECC_CE + */ + (OccFir, bit(39)) ? TBDDefaultCallout; + + /** OCCFIR[40] + * OCC_SCOM_OCCFIR_C405_OCI_MACHINECHECK + */ + (OccFir, bit(40)) ? TBDDefaultCallout; + + /** OCCFIR[41] + * OCC_SCOM_OCCFIR_SRAM_SPARE_DIRECT_ERROR0 + */ + (OccFir, bit(41)) ? TBDDefaultCallout; + + /** OCCFIR[42] + * OCC_SCOM_OCCFIR_SRAM_SPARE_DIRECT_ERROR1 + */ + (OccFir, bit(42)) ? TBDDefaultCallout; + + /** OCCFIR[43] + * OCC_SCOM_OCCFIR_SRAM_SPARE_DIRECT_ERROR2 + */ + (OccFir, bit(43)) ? TBDDefaultCallout; + + /** OCCFIR[44] + * OCC_SCOM_OCCFIR_SRAM_SPARE_DIRECT_ERROR3 + */ + (OccFir, bit(44)) ? TBDDefaultCallout; + + /** OCCFIR[45] + * OCC_SCOM_OCCFIR_SLW_OCISLV_ERR + */ + (OccFir, bit(45)) ? TBDDefaultCallout; + + /** OCCFIR[46] + * OCC_SCOM_OCCFIR_GPE_OCISLV_ERR + */ + (OccFir, bit(46)) ? TBDDefaultCallout; + + /** OCCFIR[47] + * OCC_SCOM_OCCFIR_OCB_OCISLV_ERR + */ + (OccFir, bit(47)) ? TBDDefaultCallout; + + /** OCCFIR[48] + * OCC_SCOM_OCCFIR_C405ICU_M_TIMEOUT + */ + (OccFir, bit(48)) ? TBDDefaultCallout; + + /** OCCFIR[49] + * OCC_SCOM_OCCFIR_C405DCU_M_TIMEOUT + */ + (OccFir, bit(49)) ? TBDDefaultCallout; + + /** OCCFIR[62|63] + * OCC_SCOM_OCCFIR_FIR_PARITY_ERR_DUP + */ + (OccFir, bit(62|63)) ? TBDDefaultCallout; +}; + +################################################################################ +# TP Chiplet PBAMFIR +################################################################################ + +rule PbamFir +{ + CHECK_STOP: PBAMFIR & ~PBAMFIR_MASK & ~PBAMFIR_ACT0 & ~PBAMFIR_ACT1; + RECOVERABLE: PBAMFIR & ~PBAMFIR_MASK & ~PBAMFIR_ACT0 & PBAMFIR_ACT1; +}; + +group gPbamFir filter singlebit +{ + /** PBAMFIR[0] + * INVALID_TRANSFER_SIZE + */ + (PbamFir, bit(0)) ? TBDDefaultCallout; + + /** PBAMFIR[1] + * INVALID_COMMAND + */ + (PbamFir, bit(1)) ? TBDDefaultCallout; + + /** PBAMFIR[2] + * INVALID_ADDRESS_ALIGNMENT + */ + (PbamFir, bit(2)) ? TBDDefaultCallout; + + /** PBAMFIR[3] + * OPB_ERROR + */ + (PbamFir, bit(3)) ? TBDDefaultCallout; + + /** PBAMFIR[4] + * OPB_TIMEOUT + */ + (PbamFir, bit(4)) ? TBDDefaultCallout; + + /** PBAMFIR[5] + * OPB_MASTER_HANG_TIMEOUT + */ + (PbamFir, bit(5)) ? TBDDefaultCallout; + + /** PBAMFIR[6] + * CMD_BUFFER_PAR_ERR + */ + (PbamFir, bit(6)) ? TBDDefaultCallout; + + /** PBAMFIR[7] + * DAT_BUFFER_PAR_ERR + */ + (PbamFir, bit(7)) ? TBDDefaultCallout; + + /** PBAMFIR[10] + * FIR_PARITY_ERR2 + */ + (PbamFir, bit(10)) ? TBDDefaultCallout; + + /** PBAMFIR[11] + * FIR_PARITY_ERR + */ + (PbamFir, bit(11)) ? TBDDefaultCallout; +}; + +################################################################################ +# TP Chiplet PMCFIR +################################################################################ + +rule PmcFir +{ + CHECK_STOP: PMCFIR & ~PMCFIR_MASK & ~PMCFIR_ACT0 & ~PMCFIR_ACT1; + RECOVERABLE: PMCFIR & ~PMCFIR_MASK & ~PMCFIR_ACT0 & PMCFIR_ACT1; +}; + +group gPmcFir filter singlebit +{ + /** PMCFIR[0] + * LFIR_PSTATE_OCI_MASTER_RDERR + */ + (PmcFir, bit(0)) ? TBDDefaultCallout; + + /** PMCFIR[1] + * LFIR_PSTATE_OCI_MASTER_RDDATA_PARITY_ERR + */ + (PmcFir, bit(1)) ? TBDDefaultCallout; + + /** PMCFIR[2] + * LFIR_PSTATE_GPST_CHECKBYTE_ERR + */ + (PmcFir, bit(2)) ? TBDDefaultCallout; + + /** PMCFIR[3] + * LFIR_PSTATE_GACK_TO_ERR + */ + (PmcFir, bit(3)) ? TBDDefaultCallout; + + /** PMCFIR[4] + * LFIR_PSTATE_PIB_MASTER_NONOFFLINE_ERR + */ + (PmcFir, bit(4)) ? TBDDefaultCallout; + + /** PMCFIR[5] + * LFIR_PSTATE_PIB_MASTER_OFFLINE_ERR + */ + (PmcFir, bit(5)) ? TBDDefaultCallout; + + /** PMCFIR[6] + * LFIR_PSTATE_OCI_MASTER_TO_ERR + */ + (PmcFir, bit(6)) ? TBDDefaultCallout; + + /** PMCFIR[7] + * LFIR_PSTATE_INTERCHIP_UE_ERR + */ + (PmcFir, bit(7)) ? TBDDefaultCallout; + + /** PMCFIR[8] + * LFIR_PSTATE_INTERCHIP_ERRORFRAME_ERR + */ + (PmcFir, bit(8)) ? TBDDefaultCallout; + + /** PMCFIR[9] + * LFIR_PSTATE_MS_FSM_ERR + */ + (PmcFir, bit(9)) ? TBDDefaultCallout; + + /** PMCFIR[10] + * LFIR_MS_COMP_PARITY_ERR + */ + (PmcFir, bit(10)) ? TBDDefaultCallout; + + /** PMCFIR[11] + * LFIR_IDLE_PORESW_FATAL_ERR + */ + (PmcFir, bit(11)) ? TBDDefaultCallout; + + /** PMCFIR[12] + * LFIR_IDLE_PORESW_STATUS_RC_ERR + */ + (PmcFir, bit(12)) ? TBDDefaultCallout; + + /** PMCFIR[13] + * LFIR_IDLE_PORESW_STATUS_VALUE_ERR + */ + (PmcFir, bit(13)) ? TBDDefaultCallout; + + /** PMCFIR[14] + * LFIR_IDLE_PORESW_WRITE_WHILE_INACTIVE_ERR + */ + (PmcFir, bit(14)) ? TBDDefaultCallout; + + /** PMCFIR[15] + * LFIR_IDLE_PORESW_TIMEOUT_ERR + */ + (PmcFir, bit(15)) ? TBDDefaultCallout; + + /** PMCFIR[16] + * LFIR_IDLE_OCI_MASTER_WRITE_TIMEOUT_ERR + */ + (PmcFir, bit(16)) ? TBDDefaultCallout; + + /** PMCFIR[17] + * LFIR_IDLE_INTERNAL_ERR + */ + (PmcFir, bit(17)) ? TBDDefaultCallout; + + /** PMCFIR[18] + * LFIR_INT_COMP_PARITY_ERR + */ + (PmcFir, bit(18)) ? TBDDefaultCallout; + + /** PMCFIR[19] + * LFIR_PMC_OCC_HEARTBEAT_TIMEOUT + */ + (PmcFir, bit(19)) ? TBDDefaultCallout; + + /** PMCFIR[20] + * LFIR_SPIVID_CRC_ERROR0 + */ + (PmcFir, bit(20)) ? TBDDefaultCallout; + + /** PMCFIR[21] + * LFIR_SPIVID_CRC_ERROR1 + */ + (PmcFir, bit(21)) ? TBDDefaultCallout; + + /** PMCFIR[22] + * LFIR_SPIVID_CRC_ERROR2 + */ + (PmcFir, bit(22)) ? TBDDefaultCallout; + + /** PMCFIR[23] + * LFIR_SPIVID_RETRY_TIMEOUT + */ + (PmcFir, bit(23)) ? TBDDefaultCallout; + + /** PMCFIR[24] + * LFIR_SPIVID_FSM_ERR + */ + (PmcFir, bit(24)) ? TBDDefaultCallout; + + /** PMCFIR[25] + * LFIR_SPIVID_MAJORITY_DETECTED_A_MINORITY + */ + (PmcFir, bit(25)) ? TBDDefaultCallout; + + /** PMCFIR[26] + * LFIR_O2S_CRC_ERROR0 + */ + (PmcFir, bit(26)) ? TBDDefaultCallout; + + /** PMCFIR[27] + * LFIR_O2S_CRC_ERROR1 + */ + (PmcFir, bit(27)) ? TBDDefaultCallout; + + /** PMCFIR[28] + *LFIR_O2S_CRC_ERROR1 + */ + (PmcFir, bit(28)) ? TBDDefaultCallout; + + /** PMCFIR[29] + * LFIR_O2S_RETRY_TIMEOUT + */ + (PmcFir, bit(29)) ? TBDDefaultCallout; + + /** PMCFIR[30] + * LFIR_O2S_WRITE_WHILE_BRIDGE_BUSY_ERR + */ + (PmcFir, bit(30)) ? TBDDefaultCallout; + + /** PMCFIR[31] + * LFIR_O2S_FSM_ERR + */ + (PmcFir, bit(31)) ? TBDDefaultCallout; + + /** PMCFIR[32] + * LFIR_O2S_MAJORITY_DETECTED_A_MINORITY + */ + (PmcFir, bit(32)) ? TBDDefaultCallout; + + /** PMCFIR[33] + * LFIR_O2P_WRITE_WHILE_BRIDGE_BUSY_ERR + */ + (PmcFir, bit(33)) ? TBDDefaultCallout; + + /** PMCFIR[34] + * LFIR_O2P_FSM_ERR + */ + (PmcFir, bit(34)) ? TBDDefaultCallout; + + /** PMCFIR[35] + * LFIR_OCI_SLAVE_ERR + */ + (PmcFir, bit(35)) ? TBDDefaultCallout; + + /** PMCFIR[36] + * LFIR_IF_COMP_PARITY_ERROR + */ + (PmcFir, bit(36)) ? TBDDefaultCallout; + + /** PMCFIR[47|48] + * FIR_PARITY_ERR + */ + (PmcFir, bit(47|48)) ? TBDDefaultCallout; +}; + +################################################################################ +# Actions specific to TP chiplet +################################################################################ + +/** Analyze connected MCS 20 */ +actionclass analyzeMcs20 { analyze(connected(TYPE_MCS, 4)); }; + +/** Analyze connected MCS 21 */ +actionclass analyzeMcs21 { analyze(connected(TYPE_MCS, 5)); }; + +/** Analyze connected MCS 30 */ +actionclass analyzeMcs30 { analyze(connected(TYPE_MCS, 6)); }; + +/** Analyze connected MCS 31 */ +actionclass analyzeMcs31 { analyze(connected(TYPE_MCS, 7)); }; + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Proc_acts_XBUS.rule b/src/usr/diag/prdf/common/plat/pegasus/Proc_acts_XBUS.rule new file mode 100755 index 000000000..2b3e7883c --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Proc_acts_XBUS.rule @@ -0,0 +1,276 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Proc_acts_XBUS.rule $ +# +# 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 + +################################################################################ +# XBUS Chiplet Registers +################################################################################ + +rule XbusChipletFir +{ + CHECK_STOP: + (XBUS_CHIPLET_CS_FIR & `1F90000000000000`) & ~XBUS_CHIPLET_FIR_MASK; + RECOVERABLE: + ((XBUS_CHIPLET_RE_FIR >> 2) & `1F90000000000000`) & ~XBUS_CHIPLET_FIR_MASK; +}; + +group gXbusChipletFir filter singlebit +{ + /** XbusChipletFir[3] + * Attention from LFIR + */ + (XbusChipletFir, bit(3)) ? analyze(gXbusLFir); + + /** XbusChipletFir[4] + * Attention from PBENFIR + */ + (XbusChipletFir, bit(4)) ? analyze(gPbenFir); + + /** XbusChipletFir[5] + * Attention from IOXFIR_0 (Venice only) + */ + (XbusChipletFir, bit(5)) ? defaultMaskedError; + + /** XbusChipletFir[6] + * Attention from IOXFIR_1 + */ + (XbusChipletFir, bit(6)) ? analyze(gIoxFir_1); + + /** XbusChipletFir[7] + * Attention from IOXFIR_2 (Venice only) + */ + (XbusChipletFir, bit(7)) ? defaultMaskedError; + + /** XbusChipletFir[8] + * Attention from IOXFIR_3 (Venice only) + */ + (XbusChipletFir, bit(8)) ? defaultMaskedError; +}; + +################################################################################ +# XBUS Chiplet LFIR +################################################################################ + +rule XbusLFir +{ + CHECK_STOP: XBUS_LFIR & ~XBUS_LFIR_MASK & ~XBUS_LFIR_ACT0 & ~XBUS_LFIR_ACT1; + RECOVERABLE: XBUS_LFIR & ~XBUS_LFIR_MASK & ~XBUS_LFIR_ACT0 & XBUS_LFIR_ACT1; +}; + +group gXbusLFir filter singlebit +{ + /** XBUS_LFIR[0] + * CFIR internal parity error + */ + (XbusLFir, bit(0)) ? TBDDefaultCallout; + + /** XBUS_LFIR[1] + * Local errors from GPIO (PCB error) + */ + (XbusLFir, bit(1)) ? TBDDefaultCallout; + + /** XBUS_LFIR[2] + * Local errors from CC (PCB error) + */ + (XbusLFir, bit(2)) ? TBDDefaultCallout; + + /** XBUS_LFIR[3] + * Local errors from CC (OPCG, parity, scan collision, ...) + */ + (XbusLFir, bit(3)) ? TBDDefaultCallout; + + /** XBUS_LFIR[4] + * Local errors from PSC (PCB error) + */ + (XbusLFir, bit(4)) ? TBDDefaultCallout; + + /** XBUS_LFIR[5] + * Local errors from PSC (parity error) + */ + (XbusLFir, bit(5)) ? TBDDefaultCallout; + + /** XBUS_LFIR[6] + * Local errors from Thermal (parity error) + */ + (XbusLFir, bit(6)) ? TBDDefaultCallout; + + /** XBUS_LFIR[7] + * Local errors from Thermal (PCB error) + */ + (XbusLFir, bit(7)) ? TBDDefaultCallout; + + /** XBUS_LFIR[8|9] + * Local errors from Thermal (Trip error) + */ + (XbusLFir, bit(8|9)) ? TBDDefaultCallout; + + /** XBUS_LFIR[10|11] + * Local errors from Trace Array ( error) + */ + (XbusLFir, bit(10|11)) ? TBDDefaultCallout; +}; + +################################################################################ +# XBUS Chiplet PBENFIR +################################################################################ + +rule PbenFir +{ + CHECK_STOP: PBENFIR & ~PBENFIR_MASK & ~PBENFIR_ACT0 & ~PBENFIR_ACT1; + RECOVERABLE: PBENFIR & ~PBENFIR_MASK & ~PBENFIR_ACT0 & PBENFIR_ACT1; +}; + +group gPbenFir filter singlebit +{ + /** PBENFIR[0] + * X0_LINK_RCV_CE: x0 link rcv ce + */ + (PbenFir, bit(0)) ? TBDDefaultCallout; + + /** PBENFIR[1] + * X0_LINK_RCV_DERR: x0 link rcv derr + */ + (PbenFir, bit(1)) ? TBDDefaultCallout; + + /** PBENFIR[2] + * X0_LINK_RCV_UE: x0 link rcv ue + */ + (PbenFir, bit(2)) ? TBDDefaultCallout; + + /** PBENFIR[3] + * X1_LINK_RCV_CE: x1 link rcv ce + */ + (PbenFir, bit(3)) ? TBDDefaultCallout; + + /** PBENFIR[4] + * X1_LINK_RCV_DERR: x1 link rcv derr + */ + (PbenFir, bit(4)) ? TBDDefaultCallout; + + /** PBENFIR[5] + * X1_LINK_RCV_UE: x1 link rcv ue + */ + (PbenFir, bit(5)) ? TBDDefaultCallout; + + /** PBENFIR[6] + * X2_LINK_RCV_CE: x2 link rcv ce + */ + (PbenFir, bit(6)) ? TBDDefaultCallout; + + /** PBENFIR[7] + * X2_LINK_RCV_DERR: x2 link rcv derr + */ + (PbenFir, bit(7)) ? TBDDefaultCallout; + + /** PBENFIR[8] + * X2_LINK_RCV_UE: x2 link rcv ue + */ + (PbenFir, bit(8)) ? TBDDefaultCallout; + + /** PBENFIR[9] + * X3_LINK_RCV_CE: x3 link rcv ce + */ + (PbenFir, bit(9)) ? TBDDefaultCallout; + + /** PBENFIR[10] + * X3_LINK_RCV_DERR: x3 link rcv derr + */ + (PbenFir, bit(10)) ? TBDDefaultCallout; + + /** PBENFIR[11] + * X3_LINK_RCV_UE: x3 link rcv ue + */ + (PbenFir, bit(11)) ? TBDDefaultCallout; + + /** PBENFIR[12] + * X_LINK_SND_CE: x link rcv ce + */ + (PbenFir, bit(12)) ? TBDDefaultCallout; + + /** PBENFIR[13] + * X_LINK_SND_SUE: x link rcv sue + */ + (PbenFir, bit(13)) ? TBDDefaultCallout; + + /** PBENFIR[14] + * X_LINK_SND_UE: x link rcv ue + */ + (PbenFir, bit(14)) ? TBDDefaultCallout; + + /** PBENFIR[15] + * X_LINK_CR_OVERFLOW: x link command/response/data buffer overflow + */ + (PbenFir, bit(15)) ? TBDDefaultCallout; + + /** PBENFIR[16] + * X0_LINK_FMR_ERR: x0 link framer error + */ + (PbenFir, bit(16)) ? TBDDefaultCallout; + + /** PBENFIR[17] + * X1_LINK_FMR_ERR: x1 link framer error + */ + (PbenFir, bit(17)) ? TBDDefaultCallout; + + /** PBENFIR[18] + * X2_LINK_FMR_ERR: x2 link framer error + */ + (PbenFir, bit(18)) ? TBDDefaultCallout; + + /** PBENFIR[19] + * X3_LINK_FMR_ERR: x3 link framer error + */ + (PbenFir, bit(19)) ? TBDDefaultCallout; + + /** PBENFIR[20] + * X_LINK_PSR_ERR: x link parser error + */ + (PbenFir, bit(20)) ? TBDDefaultCallout; + + /** PBENFIR[36] + * FIR_SCOM_ERR: pben iox fir_scom_err + */ + (PbenFir, bit(36)) ? TBDDefaultCallout; +}; + +################################################################################ +# XBUS Chiplet IOXFIR_1 +################################################################################ + +rule IoxFir_1 +{ + CHECK_STOP: IOXFIR_1 & ~IOXFIR_1_MASK & ~IOXFIR_1_ACT0 & ~IOXFIR_1_ACT1; + RECOVERABLE: IOXFIR_1 & ~IOXFIR_1_MASK & ~IOXFIR_1_ACT0 & IOXFIR_1_ACT1; +}; + +group gIoxFir_1 filter singlebit +{ + /** IOXFIR_1[0] + * TBD + */ + (IoxFir_1, bit(0)) ? TBDDefaultCallout; +}; + +################################################################################ +# Actions specific to XBUS chiplet +################################################################################ + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Proc_regs_ABUS.rule b/src/usr/diag/prdf/common/plat/pegasus/Proc_regs_ABUS.rule new file mode 100755 index 000000000..0cda7bddc --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Proc_regs_ABUS.rule @@ -0,0 +1,160 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Proc_regs_ABUS.rule $ +# +# 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 + + ############################################################################ + # ABUS Chiplet Registers + ############################################################################ + + register ABUS_CHIPLET_CS_FIR + { + name "ES.PBES_WRAP_TOP.TPC.XFIR"; + scomaddr 0x08040000; + capture group default; + }; + + register ABUS_CHIPLET_RE_FIR + { + name "ES.PBES_WRAP_TOP.TPC.RFIR"; + scomaddr 0x08040001; + capture group default; + }; + + register ABUS_CHIPLET_FIR_MASK + { + name "ES.PBES_WRAP_TOP.TPC.FIR_MASK"; + scomaddr 0x08040002; + capture type secondary; + capture group default; + }; + + ############################################################################ + # ABUS Chiplet LFIR + ############################################################################ + + register ABUS_LFIR + { + name "ES.PBES_WRAP_TOP.TPC.LOCAL_FIR"; + scomaddr 0x0804000a; + reset (&, 0x0804000b); + mask (|, 0x0804000f); + capture group default; + }; + + register ABUS_LFIR_MASK + { + name "ES.PBES_WRAP_TOP.TPC.EPS.FIR.LOCAL_FIR_MASK"; + scomaddr 0x0804000d; + capture type secondary; + capture group default; + }; + + register ABUS_LFIR_ACT0 + { + name "ES.PBES_WRAP_TOP.TPC.EPS.FIR.LOCAL_FIR_ACTION0"; + scomaddr 0x08040010; + capture type secondary; + capture group default; + }; + + register ABUS_LFIR_ACT1 + { + name "ES.PBES_WRAP_TOP.TPC.EPS.FIR.LOCAL_FIR_ACTION1"; + scomaddr 0x08040011; + capture type secondary; + capture group default; + }; + + ############################################################################ + # ABUS Chiplet PBESFIR + ############################################################################ + + register PBESFIR + { + name "ES.PBES_WRAP_TOP.PBES_TOP.MISC_IO.SCOM.PB_IOA_FIR_REG"; + scomaddr 0x08010800; + reset (&, 0x08010801); + mask (|, 0x08010805); + capture group default; + }; + + register PBESFIR_MASK + { + name "ES.PBES_WRAP_TOP.PBES_TOP.MISC_IO.SCOM.PB_IOA_FIR_MASK_REG"; + scomaddr 0x08010803; + capture type secondary; + capture group default; + }; + + register PBESFIR_ACT0 + { + name "ES.PBES_WRAP_TOP.PBES_TOP.MISC_IO.SCOM.PB_IOA_FIR_ACTION0_REG"; + scomaddr 0x08010806; + capture type secondary; + capture group default; + }; + + register PBESFIR_ACT1 + { + name "ES.PBES_WRAP_TOP.PBES_TOP.MISC_IO.SCOM.PB_IOA_FIR_ACTION1_REG"; + scomaddr 0x08010807; + capture type secondary; + capture group default; + }; + + ############################################################################ + # ABUS Chiplet IOAFIR + ############################################################################ + + register IOAFIR + { + name "ABUS.BUSCTL.SCOM.FIR_REG"; + scomaddr 0x08010c00; + reset (&, 0x08010c01); + mask (|, 0x08010c05); + capture group default; + }; + + register IOAFIR_MASK + { + name "ABUS.BUSCTL.SCOM.FIR_MASK_REG"; + scomaddr 0x08010c03; + capture type secondary; + capture group default; + }; + + register IOAFIR_ACT0 + { + name "ABUS.BUSCTL.SCOM.FIR_ACTION0_REG"; + scomaddr 0x08010c06; + capture type secondary; + capture group default; + }; + + register IOAFIR_ACT1 + { + name "ABUS.BUSCTL.SCOM.FIR_ACTION1_REG"; + scomaddr 0x08010c07; + capture type secondary; + capture group default; + }; + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Proc_regs_PB.rule b/src/usr/diag/prdf/common/plat/pegasus/Proc_regs_PB.rule new file mode 100755 index 000000000..c338b137d --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Proc_regs_PB.rule @@ -0,0 +1,754 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Proc_regs_PB.rule $ +# +# 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 + + ############################################################################ + # PB Chiplet Registers + ############################################################################ + + register PB_CHIPLET_CS_FIR + { + name "EH.TPC.XFIR"; + scomaddr 0x02040000; + capture group default; + }; + + register PB_CHIPLET_RE_FIR + { + name "EH.TPC.RFIR"; + scomaddr 0x02040001; + capture group default; + }; + + register PB_CHIPLET_FIR_MASK + { + name "EH.TPC.FIR_MASK"; + scomaddr 0x02040002; + capture type secondary; + capture group default; + }; + + register PB_CHIPLET_SPA + { + name "EH.TPC.EPS.FIR.SPATTN"; + scomaddr 0x02040004; + capture group default; + }; + + register PB_CHIPLET_SPA_MASK + { + name "EH.TPC.EPS.FIR.SPA_MASK"; + scomaddr 0x02040007; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PB Chiplet LFIR + ############################################################################ + + register PB_LFIR + { + name "EH.TPC.LOCAL_FIR"; + scomaddr 0x0204000a; + reset (&, 0x0204000b); + mask (|, 0x0204000f); + capture group default; + }; + + register PB_LFIR_MASK + { + name "EH.TPC.EPS.FIR.LOCAL_FIR_MASK"; + scomaddr 0x0204000d; + capture type secondary; + capture group default; + }; + + register PB_LFIR_ACT0 + { + name "EH.TPC.EPS.FIR.LOCAL_FIR_ACTION0"; + scomaddr 0x02040010; + capture type secondary; + capture group default; + }; + + register PB_LFIR_ACT1 + { + name "EH.TPC.EPS.FIR.LOCAL_FIR_ACTION1"; + scomaddr 0x02040011; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PB Chiplet NXDMAENGFIR + ############################################################################ + + register NXDMAENGFIR + { + name "EN.NX.DBG.NX_DMA_ENG_FIR"; + scomaddr 0x02013100; + reset (&, 0x02013101); + mask (|, 0x02013105); + capture group default; + }; + + register NXDMAENGFIR_MASK + { + name "EN.NX.DBG.NX_DMA_ENG_FIR_MASK"; + scomaddr 0x02013103; + capture type secondary; + capture group default; + }; + + register NXDMAENGFIR_ACT0 + { + name "EN.NX.DBG.NX_DMA_ENG_FIR_ACTION0"; + scomaddr 0x02013106; + capture type secondary; + capture group default; + }; + + register NXDMAENGFIR_ACT1 + { + name "EN.NX.DBG.NX_DMA_ENG_FIR_ACTION1"; + scomaddr 0x02013107; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PB Chiplet NXCQFIR + ############################################################################ + + register NXCQFIR + { + name "EN.NX.PBI.CQ_WRAP.NXCQ_SCOM.NX_CQ_FIR_REG"; + scomaddr 0x02013080; + reset (&, 0x02013081); + mask (|, 0x02013085); + capture group default; + }; + + register NXCQFIR_MASK + { + name "EN.NX.PBI.CQ_WRAP.NXCQ_SCOM.NX_CQ_FIR_MASK_REG"; + scomaddr 0x02013083; + capture type secondary; + capture group default; + }; + + register NXCQFIR_ACT0 + { + name "EN.NX.PBI.CQ_WRAP.NXCQ_SCOM.NX_CQ_FIR_ACTION0_REG"; + scomaddr 0x02013086; + capture type secondary; + capture group default; + }; + + register NXCQFIR_ACT1 + { + name "EN.NX.PBI.CQ_WRAP.NXCQ_SCOM.NX_CQ_FIR_ACTION1_REG"; + scomaddr 0x02013087; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PB Chiplet NXASFIR + ############################################################################ + + register NXASFIR + { + name "EN.NX.AS.FIR_REG"; + scomaddr 0x020130c0; + reset (&, 0x020130c1); + mask (|, 0x020130c5); + capture group default; + }; + + register NXASFIR_MASK + { + name "EN.NX.AS.FIR_MASK_REG"; + scomaddr 0x020130c3; + capture type secondary; + capture group default; + }; + + register NXASFIR_ACT0 + { + name "EN.NX.AS.FIR_ACTION0_REG"; + scomaddr 0x020130c6; + capture type secondary; + capture group default; + }; + + register NXASFIR_ACT1 + { + name "EN.NX.AS.FIR_ACTION1_REG"; + scomaddr 0x020130c7; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PB Chiplet NXCXAFIR + ############################################################################ + + register NXCXAFIR + { + name "EN.NX.CXA.CXA_XPT.XPT_SCOMFIR.FIR_REG"; + scomaddr 0x02013000; + reset (&, 0x02013001); + mask (|, 0x02013005); + capture group default; + }; + + register NXCXAFIR_MASK + { + name "EN.NX.CXA.CXA_XPT.XPT_SCOMFIR.FIR_MASK_REG"; + scomaddr 0x02013003; + capture type secondary; + capture group default; + }; + + register NXCXAFIR_ACT0 + { + name "EN.NX.CXA.CXA_XPT.XPT_SCOMFIR.FIR_ACTION0_REG"; + scomaddr 0x02013006; + capture type secondary; + capture group default; + }; + + register NXCXAFIR_ACT1 + { + name "EN.NX.CXA.CXA_XPT.XPT_SCOMFIR.FIR_ACTION1_REG"; + scomaddr 0x02013007; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PB Chiplet MCDFIR + ############################################################################ + + register MCDFIR + { + name "EH.PB.MCD.MCDCTL.FIR_REG"; + scomaddr 0x02013400; + reset (&, 0x02013401); + mask (|, 0x02013405); + capture group default; + }; + + register MCDFIR_MASK + { + name "EH.PB.MCD.MCDCTL.FIR_MASK_REG"; + scomaddr 0x02013403; + capture type secondary; + capture group default; + }; + + register MCDFIR_ACT0 + { + name "EH.PB.MCD.MCDCTL.FIR_ACTION0_REG"; + scomaddr 0x02013406; + capture type secondary; + capture group default; + }; + + register MCDFIR_ACT1 + { + name "EH.PB.MCD.MCDCTL.FIR_ACTION1_REG"; + scomaddr 0x02013407; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PB Chiplet PBWESTFIR + ############################################################################ + + register PBWESTFIR + { + name "EH.PB.MISC.PB_WEST_FIR_REG"; + scomaddr 0x02010c00; + reset (&, 0x02010c01); + mask (|, 0x02010c05); + capture group default; + }; + + register PBWESTFIR_MASK + { + name "EH.PB.MISC.PB_WEST_FIR_MASK_REG"; + scomaddr 0x02010c03; + capture type secondary; + capture group default; + }; + + register PBWESTFIR_ACT0 + { + name "EH.PB.MISC.PB_WEST_FIR_ACTION0_REG"; + scomaddr 0x02010c06; + capture type secondary; + capture group default; + }; + + register PBWESTFIR_ACT1 + { + name "EH.PB.MISC.PB_WEST_FIR_ACTION1_REG"; + scomaddr 0x02010c07; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PB Chiplet PBCENTFIR + ############################################################################ + + register PBCENTFIR + { + name "EH.PB.MISC.PB_CENT_FIR_REG"; + scomaddr 0x02010c40; + reset (&, 0x02010c41); + mask (|, 0x02010c45); + capture group default; + }; + + register PBCENTFIR_MASK + { + name "EH.PB.MISC.PB_CENT_FIR_MASK_REG"; + scomaddr 0x02010c43; + capture type secondary; + capture group default; + }; + + register PBCENTFIR_ACT1 + { + name "EH.PB.MISC.PB_CENT_FIR_ACTION1_REG"; + scomaddr 0x02010c47; + capture type secondary; + capture group default; + }; + + register PBCENTFIR_ACT0 + { + name "EH.PB.MISC.PB_CENT_FIR_ACTION0_REG"; + scomaddr 0x02010c46; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PB Chiplet PBEASTFIR + ############################################################################ + + register PBEASTFIR + { + name "EH.PB.MISC.PB_EAST_FIR_REG"; + scomaddr 0x02010c80; + reset (&, 0x02010c81); + mask (|, 0x02010c85); + capture group default; + }; + + register PBEASTFIR_MASK + { + name "EH.PB.MISC.PB_EAST_FIR_MASK_REG"; + scomaddr 0x02010c83; + capture type secondary; + capture group default; + }; + + register PBEASTFIR_ACT0 + { + name "EH.PB.MISC.PB_EAST_FIR_ACTION0_REG"; + scomaddr 0x02010c86; + capture type secondary; + capture group default; + }; + + register PBEASTFIR_ACT1 + { + name "EH.PB.MISC.PB_EAST_FIR_ACTION1_REG"; + scomaddr 0x02010c87; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PB Chiplet PBEXTFIR + ############################################################################ + + # External checkstop register - Used for FFDC only + # Any attention generated from this FIR register indicates that there was a + # checkstop attention raised on another chip. Currently, we do not do any + # additional analysis in this FIR because we assume we will get an interrupt + # from the offending chip. This FIR will set PB_CHIPLET_FIR[2] which is + # currently ignored. + + register PBEXTFIR + { + name "EH.PB.MISC.EXTFIR_REG"; + scomaddr 0x02010c6e; + capture group default; + }; + + ############################################################################ + # PB Chiplet PSIFIR + ############################################################################ + + register PSIFIR + { + name "EN.TPC.PSIHB.PSIHB_FIR_REG"; + scomaddr 0x02010900; + reset (&, 0x02010901); + mask (|, 0x02010905); + capture group default; + }; + + register PSIFIR_MASK + { + name "EN.TPC.PSIHB.PSIHB_FIR_MASK_REG"; + scomaddr 0x02010903; + capture type secondary; + capture group default; + }; + + register PSIFIR_ACT0 + { + name "EN.TPC.PSIHB.PSIHB_FIR_ACTION0_REG"; + scomaddr 0x02010906; + capture type secondary; + capture group default; + }; + + register PSIFIR_ACT1 + { + name "EN.TPC.PSIHB.PSIHB_FIR_ACTION1_REG"; + scomaddr 0x02010907; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PB Chiplet ICPFIR + ############################################################################ + + register ICPFIR + { + name "EN.TPC.INTP.SYNC_FIR_REG"; + scomaddr 0x020109c0; + reset (&, 0x020109c1); + mask (|, 0x020109c5); + capture group default; + }; + + register ICPFIR_MASK + { + name "EN.TPC.INTP.SYNC_FIR_MASK_REG"; + scomaddr 0x020109c3; + capture type secondary; + capture group default; + }; + + register ICPFIR_ACT0 + { + name "EN.TPC.INTP.SYNC_FIR_ACTION0_REG"; + scomaddr 0x020109c6; + capture type secondary; + capture group default; + }; + + register ICPFIR_ACT1 + { + name "EN.TPC.INTP.SYNC_FIR_ACTION1_REG"; + scomaddr 0x020109c7; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PB Chiplet PBAFIR + ############################################################################ + + register PBAFIR + { + name "EN.TPC.PBA.PBAFIR"; + scomaddr 0x02010840; + reset (&, 0x02010841); + mask (|, 0x02010845); + capture group default; + }; + + register PBAFIR_MASK + { + name "EN.TPC.PBA.PBAFIRMASK"; + scomaddr 0x02010843; + capture type secondary; + capture group default; + }; + + register PBAFIR_ACT0 + { + name "EN.TPC.PBA.PBAFIRACT0"; + scomaddr 0x02010846; + capture type secondary; + capture group default; + }; + + register PBAFIR_ACT1 + { + name "EN.TPC.PBA.PBAFIRACT1"; + scomaddr 0x02010847; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PB Chiplet EHHCAFIR + ############################################################################ + + register EHHCAFIR + { + name "EH.TPC.HCA.EHHCA_FIR_REG"; + scomaddr 0x02010980; + reset (&, 0x02010981); + mask (|, 0x02010985); + capture group default; + }; + + register EHHCAFIR_MASK + { + name "EH.TPC.HCA.EHHCA_FIR_MASK_REG"; + scomaddr 0x02010983; + capture type secondary; + capture group default; + }; + + register EHHCAFIR_ACT0 + { + name "EH.TPC.HCA.EHHCA_FIR_ACTION0_REG"; + scomaddr 0x02010986; + capture type secondary; + capture group default; + }; + + register EHHCAFIR_ACT1 + { + name "EH.TPC.HCA.EHHCA_FIR_ACTION1_REG"; + scomaddr 0x02010987; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PB Chiplet ENHCAFIR + ############################################################################ + + register ENHCAFIR + { + name "EN.TPC.BRIDGE.HCA.ENHCA_FIR_REG"; + scomaddr 0x02010940; + reset (&, 0x02010941); + mask (|, 0x02010945); + capture group default; + }; + + register ENHCAFIR_MASK + { + name "EN.TPC.BRIDGE.HCA.ENHCA_FIR_MASK_REG"; + scomaddr 0x02010943; + capture type secondary; + capture group default; + }; + + register ENHCAFIR_ACT0 + { + name "EN.TPC.BRIDGE.HCA.ENHCA_FIR_ACTION0_REG"; + scomaddr 0x02010946; + capture type secondary; + capture group default; + }; + + register ENHCAFIR_ACT1 + { + name "EN.TPC.BRIDGE.HCA.ENHCA_FIR_ACTION1_REG"; + scomaddr 0x02010947; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PB Chiplet PCINESTFIR_0 + ############################################################################ + + register PCINESTFIR_0 + { + name "ES.PE_WRAP_TOP.PE0.PEPBCQ.PBCQ.FIR_REG"; + scomaddr 0x02012000; + reset (&, 0x02012001); + mask (|, 0x02012005); + capture group default; + }; + + register PCINESTFIR_0_MASK + { + name "ES.PE_WRAP_TOP.PE0.PEPBCQ.PBCQ.FIR_MASK_REG"; + scomaddr 0x02012003; + capture type secondary; + capture group default; + }; + + register PCINESTFIR_0_ACT0 + { + name "ES.PE_WRAP_TOP.PE0.PEPBCQ.PBCQ.FIR_ACTION0_REG"; + scomaddr 0x02012006; + capture type secondary; + capture group default; + }; + + register PCINESTFIR_0_ACT1 + { + name "ES.PE_WRAP_TOP.PE0.PEPBCQ.PBCQ.FIR_ACTION1_REG"; + scomaddr 0x02012007; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PB Chiplet PCINESTFIR_1 + ############################################################################ + + register PCINESTFIR_1 + { + name "ES.PE_WRAP_TOP.PE1.PEPBCQ.PBCQ.FIR_REG"; + scomaddr 0x02012400; + reset (&, 0x02012401); + mask (|, 0x02012405); + capture group default; + }; + + register PCINESTFIR_1_MASK + { + name "ES.PE_WRAP_TOP.PE1.PEPBCQ.PBCQ.FIR_MASK_REG"; + scomaddr 0x02012403; + capture type secondary; + capture group default; + }; + + register PCINESTFIR_1_ACT0 + { + name "ES.PE_WRAP_TOP.PE1.PEPBCQ.PBCQ.FIR_ACTION0_REG"; + scomaddr 0x02012406; + capture type secondary; + capture group default; + }; + + register PCINESTFIR_1_ACT1 + { + name "ES.PE_WRAP_TOP.PE1.PEPBCQ.PBCQ.FIR_ACTION1_REG"; + scomaddr 0x02012407; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PB Chiplet PCINESTFIR_2 + ############################################################################ + + register PCINESTFIR_2 + { + name "ES.PE_WRAP_TOP.PE2.PEPBCQ.PBCQ.FIR_REG"; + scomaddr 0x02012800; + reset (&, 0x02012801); + mask (|, 0x02012805); + capture group default; + }; + + register PCINESTFIR_2_MASK + { + name "ES.PE_WRAP_TOP.PE2.PEPBCQ.PBCQ.FIR_MASK_REG"; + scomaddr 0x02012803; + capture type secondary; + capture group default; + }; + + register PCINESTFIR_2_ACT0 + { + name "ES.PE_WRAP_TOP.PE2.PEPBCQ.PBCQ.FIR_ACTION0_REG"; + scomaddr 0x02012806; + capture type secondary; + capture group default; + }; + + register PCINESTFIR_2_ACT1 + { + name "ES.PE_WRAP_TOP.PE2.PEPBCQ.PBCQ.FIR_ACTION1_REG"; + scomaddr 0x02012807; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PB Chiplet IOMCFIR_0 + ############################################################################ + + # Venice only scomaddr = 0x02011A00 + + ############################################################################ + # PB Chiplet IOMCFIR_1 + ############################################################################ + + register IOMCFIR_1 + { + name "IOMC1.BUSCTL.SCOM.FIR_REG"; + scomaddr 0x02011E00; + reset (&, 0x02011E01); + mask (|, 0x02011E05); + capture group default; + }; + + register IOMCFIR_1_MASK + { + name "IOMC1.BUSCTL.SCOM.FIR_MASK_REG"; + scomaddr 0x02011E03; + capture type secondary; + capture group default; + }; + + register IOMCFIR_1_ACT0 + { + name "IOMC1.BUSCTL.SCOM.FIR_ACTION0_REG"; + scomaddr 0x02011E06; + capture type secondary; + capture group default; + }; + + register IOMCFIR_1_ACT1 + { + name "IOMC1.BUSCTL.SCOM.FIR_ACTION1_REG"; + scomaddr 0x02011E07; + capture type secondary; + capture group default; + }; + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Proc_regs_PCIE.rule b/src/usr/diag/prdf/common/plat/pegasus/Proc_regs_PCIE.rule new file mode 100755 index 000000000..a8990ae39 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Proc_regs_PCIE.rule @@ -0,0 +1,323 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Proc_regs_PCIE.rule $ +# +# 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 + + ############################################################################ + # PCIE Chiplet Registers + ############################################################################ + + register PCIE_CHIPLET_CS_FIR + { + name "ES.PE_WRAP_TOP.TPC.XFIR"; + scomaddr 0x09040000; + capture group default; + }; + + register PCIE_CHIPLET_RE_FIR + { + name "ES.PE_WRAP_TOP.TPC.RFIR"; + scomaddr 0x09040001; + capture group default; + }; + + register PCIE_CHIPLET_FIR_MASK + { + name "ES.PE_WRAP_TOP.TPC.FIR_MASK"; + scomaddr 0x09040002; + capture type secondary; + capture group default; + }; + + register PCIE_CHIPLET_SPA + { + name "ES.PE_WRAP_TOP.TPC.EPS.FIR.SPATTN"; + scomaddr 0x09040004; + capture group default; + }; + + register PCIE_CHIPLET_SPA_MASK + { + name "ES.PE_WRAP_TOP.TPC.EPS.FIR.SPA_MASK"; + scomaddr 0x09040007; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PCIE Chiplet LFIR + ############################################################################ + + register PCIE_LFIR + { + name "ES.PE_WRAP_TOP.TPC.LOCAL_FIR"; + scomaddr 0x0904000a; + reset (&, 0x0904000b); + mask (|, 0x0904000f); + capture group default; + }; + + register PCIE_LFIR_MASK + { + name "ES.PE_WRAP_TOP.TPC.EPS.FIR.LOCAL_FIR_MASK"; + scomaddr 0x0904000d; + capture type secondary; + capture group default; + }; + + register PCIE_LFIR_ACT0 + { + name "ES.PE_WRAP_TOP.TPC.EPS.FIR.LOCAL_FIR_ACTION0"; + scomaddr 0x09040010; + capture type secondary; + capture group default; + }; + + register PCIE_LFIR_ACT1 + { + name "ES.PE_WRAP_TOP.TPC.EPS.FIR.LOCAL_FIR_ACTION1"; + scomaddr 0x09040011; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PCIE Chiplet PCICLOCKFIR_0 + ############################################################################ + + register PCICLOCKFIR_0 + { + name "ES.PE_WRAP_TOP.PE0.PH3_TOP.ETU.RSB.PR_REGS.LEM.FIR_REG"; + scomaddr 0x09012000; + reset (&, 0x09012001); + mask (|, 0x09012005); + capture group default; + }; + + register PCICLOCKFIR_0_MASK + { + name "ES.PE_WRAP_TOP.PE0.PH3_TOP.ETU.RSB.PR_REGS.LEM.FIR_MASK_REG"; + scomaddr 0x09012003; + capture type secondary; + capture group default; + }; + + register PCICLOCKFIR_0_ACT0 + { + name "ES.PE_WRAP_TOP.PE0.PH3_TOP.ETU.RSB.PR_REGS.LEM.FIR_ACTION0_REG"; + scomaddr 0x09012006; + capture type secondary; + capture group default; + }; + + register PCICLOCKFIR_0_ACT1 + { + name "ES.PE_WRAP_TOP.PE0.PH3_TOP.ETU.RSB.PR_REGS.LEM.FIR_ACTION1_REG"; + scomaddr 0x09012007; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PCIE Chiplet PCICLOCKFIR_1 + ############################################################################ + + register PCICLOCKFIR_1 + { + name "ES.PE_WRAP_TOP.PE1.PH3_TOP.ETU.RSB.PR_REGS.LEM.FIR_REG"; + scomaddr 0x09012400; + reset (&, 0x09012401); + mask (|, 0x09012405); + capture group default; + }; + + register PCICLOCKFIR_1_MASK + { + name "ES.PE_WRAP_TOP.PE1.PH3_TOP.ETU.RSB.PR_REGS.LEM.FIR_MASK_REG"; + scomaddr 0x09012403; + capture type secondary; + capture group default; + }; + + register PCICLOCKFIR_1_ACT0 + { + name "ES.PE_WRAP_TOP.PE1.PH3_TOP.ETU.RSB.PR_REGS.LEM.FIR_ACTION0_REG"; + scomaddr 0x09012406; + capture type secondary; + capture group default; + }; + + register PCICLOCKFIR_1_ACT1 + { + name "ES.PE_WRAP_TOP.PE1.PH3_TOP.ETU.RSB.PR_REGS.LEM.FIR_ACTION1_REG"; + scomaddr 0x09012407; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PCIE Chiplet PCICLOCKFIR_2 + ############################################################################ + + register PCICLOCKFIR_2 + { + name "ES.PE_WRAP_TOP.PE2.PH3_TOP.ETU.RSB.PR_REGS.LEM.FIR_REG"; + scomaddr 0x09012800; + reset (&, 0x09012801); + mask (|, 0x09012805); + capture group default; + }; + + register PCICLOCKFIR_2_MASK + { + name "ES.PE_WRAP_TOP.PE2.PH3_TOP.ETU.RSB.PR_REGS.LEM.FIR_MASK_REG"; + scomaddr 0x09012803; + capture type secondary; + capture group default; + }; + + register PCICLOCKFIR_2_ACT0 + { + name "ES.PE_WRAP_TOP.PE2.PH3_TOP.ETU.RSB.PR_REGS.LEM.FIR_ACTION0_REG"; + scomaddr 0x09012806; + capture type secondary; + capture group default; + }; + + register PCICLOCKFIR_2_ACT1 + { + name "ES.PE_WRAP_TOP.PE2.PH3_TOP.ETU.RSB.PR_REGS.LEM.FIR_ACTION1_REG"; + scomaddr 0x09012807; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PCIE Chiplet PBFFIR + ############################################################################ + + register PBFFIR + { + name "ES.PBES_WRAP_TOP.PBES_TOP.MISC_IOF.SCOM.PB_IOF_FIR_REG"; + scomaddr 0x09010800; + reset (&, 0x09010801); + mask (|, 0x09010805); + capture group default; + }; + + register PBFFIR_MASK + { + name "ES.PBES_WRAP_TOP.PBES_TOP.MISC_IOF.SCOM.PB_IOF_FIR_MASK_REG"; + scomaddr 0x09010803; + capture type secondary; + capture group default; + }; + + register PBFFIR_ACT0 + { + name "ES.PBES_WRAP_TOP.PBES_TOP.MISC_IOF.SCOM.PB_IOF_FIR_ACTION0_REG"; + scomaddr 0x09010806; + capture type secondary; + capture group default; + }; + + register PBFFIR_ACT1 + { + name "ES.PBES_WRAP_TOP.PBES_TOP.MISC_IOF.SCOM.PB_IOF_FIR_ACTION1_REG"; + scomaddr 0x09010807; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PCIE Chiplet IOPPCIFIR_0 + ############################################################################ + + register IOPPCIFIR_0 + { + name "IOP.IOP_X880.IOP_PMA0.IOP_PMA_PLL0.IOP_PMA_PLL_RLM.IOP_PMA_PLL_REG_CONTROL.FIR_STATUS_REG"; + scomaddr 0x09011400; + reset (&, 0x09011401); + mask (|, 0x09011405); + capture group default; + }; + + register IOPPCIFIR_0_MASK + { + name "IOP.IOP_X880.IOP_PMA0.IOP_PMA_PLL0.IOP_PMA_PLL_RLM.IOP_PMA_PLL_REG_CONTROL.FIR_MASK_REG"; + scomaddr 0x09011403; + capture type secondary; + capture group default; + }; + + register IOPPCIFIR_0_ACT0 + { + name "IOP.IOP_X880.IOP_PMA0.IOP_PMA_PLL0.IOP_PMA_PLL_RLM.IOP_PMA_PLL_REG_CONTROL.FIR_ACTION0_REG"; + scomaddr 0x09011406; + capture type secondary; + capture group default; + }; + + register IOPPCIFIR_0_ACT1 + { + name "IOP.IOP_X880.IOP_PMA0.IOP_PMA_PLL0.IOP_PMA_PLL_RLM.IOP_PMA_PLL_REG_CONTROL.FIR_ACTION1_REG"; + scomaddr 0x09011407; + capture type secondary; + capture group default; + }; + + ############################################################################ + # PCIE Chiplet IOPPCIFIR_1 + ############################################################################ + + register IOPPCIFIR_1 + { + name "IOP.IOP_X881.IOP_PMA0.IOP_PMA_PLL0.IOP_PMA_PLL_RLM.IOP_PMA_PLL_REG_CONTROL.FIR_STATUS_REG"; + scomaddr 0x09011840; + reset (&, 0x09011841); + mask (|, 0x09011845); + capture group default; + }; + + register IOPPCIFIR_1_MASK + { + name "IOP.IOP_X881.IOP_PMA0.IOP_PMA_PLL0.IOP_PMA_PLL_RLM.IOP_PMA_PLL_REG_CONTROL.FIR_MASK_REG"; + scomaddr 0x09011843; + capture type secondary; + capture group default; + }; + + register IOPPCIFIR_1_ACT0 + { + name "IOP.IOP_X881.IOP_PMA0.IOP_PMA_PLL0.IOP_PMA_PLL_RLM.IOP_PMA_PLL_REG_CONTROL.FIR_ACTION0_REG"; + scomaddr 0x09011846; + capture type secondary; + capture group default; + }; + + register IOPPCIFIR_1_ACT1 + { + name "IOP.IOP_X881.IOP_PMA0.IOP_PMA_PLL0.IOP_PMA_PLL_RLM.IOP_PMA_PLL_REG_CONTROL.FIR_ACTION1_REG"; + scomaddr 0x09011847; + capture type secondary; + capture group default; + }; + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Proc_regs_TP.rule b/src/usr/diag/prdf/common/plat/pegasus/Proc_regs_TP.rule new file mode 100755 index 000000000..18d24dc66 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Proc_regs_TP.rule @@ -0,0 +1,234 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Proc_regs_TP.rule $ +# +# 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 + + ############################################################################ + # TP Chiplet Registers + ############################################################################ + + register TP_CHIPLET_CS_FIR + { + name "EH.TPCHIP.TPC.XFIR"; + scomaddr 0x01040000; + capture group default; + }; + + register TP_CHIPLET_RE_FIR + { + name "EH.TPCHIP.TPC.RFIR"; + scomaddr 0x01040001; + capture group default; + }; + + register TP_CHIPLET_FIR_MASK + { + name "EH.TPCHIP.TPC.FIR_MASK"; + scomaddr 0x01040002; + capture type secondary; + capture group default; + }; + + register TP_CHIPLET_SPA + { + name "EH.TPCHIP.TPC.EPS.FIR.SPATTN"; + scomaddr 0x01040004; + capture group default; + }; + + register TP_CHIPLET_SPA_MASK + { + name "EH.TPCHIP.TPC.EPS.FIR.SPA_MASK"; + scomaddr 0x01040007; + capture type secondary; + capture group default; + }; + + ############################################################################ + # TP Chiplet LFIR + ############################################################################ + + register TP_LFIR + { + name "EH.TPCHIP.TPC.LOCAL_FIR"; + scomaddr 0x0104000a; + reset (&, 0x0104000b); + mask (|, 0x0104000f); + capture group default; + }; + + register TP_LFIR_AND + { + name "EH.TPCHIP.TPC.LOCAL_FIR_AND"; + scomaddr 0x0104000b; + capture type secondary; + capture group never; + }; + + register TP_LFIR_MASK + { + name "EH.TPCHIP.TPC.EPS.FIR.LOCAL_FIR_MASK"; + scomaddr 0x0104000d; + capture type secondary; + capture group default; + }; + + register TP_LFIR_MASK_AND + { + name "EH.TPCHIP.TPC.EPS.FIR.LOCAL_FIR_MASK_AND"; + scomaddr 0x0104000e; + capture group never; + }; + + register TP_LFIR_MASK_OR + { + name "EH.TPCHIP.TPC.EPS.FIR.LOCAL_FIR_MASK_OR"; + scomaddr 0x0104000f; + capture group never; + }; + + register TP_LFIR_ACT0 + { + name "EH.TPCHIP.TPC.EPS.FIR.LOCAL_FIR_ACTION0"; + scomaddr 0x01040010; + capture type secondary; + capture group never; + }; + + register TP_LFIR_ACT1 + { + name "EH.TPCHIP.TPC.EPS.FIR.LOCAL_FIR_ACTION1"; + scomaddr 0x01040011; + capture type secondary; + capture group never; + }; + + ############################################################################ + # TP Chiplet OCCFIR + ############################################################################ + + register OCCFIR + { + name "EH.TPCHIP.OCC.OCI.SCOM.OCC_SCOM_OCCLFIR"; + scomaddr 0x01010800; + reset (&, 0x01010801); + mask (|, 0x01010805); + capture group default; + }; + + register OCCFIR_MASK + { + name "EH.TPCHIP.OCC.OCI.SCOM.OCC_SCOM_OCCLFIRMASK"; + scomaddr 0x01010803; + capture type secondary; + capture group default; + }; + + register OCCFIR_ACT0 + { + name "EH.TPCHIP.OCC.OCI.SCOM.OCC_SCOM_OCCLFIRACT0"; + scomaddr 0x01010806; + capture type secondary; + capture group default; + }; + + register OCCFIR_ACT1 + { + name "EH.TPCHIP.OCC.OCI.SCOM.OCC_SCOM_OCCLFIRACT1"; + scomaddr 0x01010807; + capture type secondary; + capture group default; + }; + + ############################################################################ + # TP Chiplet PBAMFIR + ############################################################################ + + register PBAMFIR + { + name "EH.TPCHIP.PIB.LPCM.LPC.SYNC_FIR_REG"; + scomaddr 0x01010c00; + reset (&, 0x01010c01); + mask (|, 0x01010c05); + capture group default; + }; + + register PBAMFIR_MASK + { + name "EH.TPCHIP.PIB.LPCM.LPC.SYNC_FIR_MASK_REG"; + scomaddr 0x01010c03; + capture type secondary; + capture group default; + }; + + register PBAMFIR_ACT0 + { + name "EH.TPCHIP.PIB.LPCM.LPC.SYNC_FIR_ACTION0_REG"; + scomaddr 0x01010c06; + capture type secondary; + capture group default; + }; + + register PBAMFIR_ACT1 + { + name "EH.TPCHIP.PIB.LPCM.LPC.SYNC_FIR_ACTION1_REG"; + scomaddr 0x01010c07; + capture type secondary; + capture group default; + }; + + ############################################################################ + # TP Chiplet PMCFIR + ############################################################################ + + register PMCFIR + { + name "EH.TPCHIP.OCC.PMC.PMC_LFIR_ERR_REG"; + scomaddr 0x01010840; + reset (&, 0x01010841); + mask (|, 0x01010845); + capture group default; + }; + + register PMCFIR_MASK + { + name "EH.TPCHIP.OCC.PMC.PMC_LFIR_ERR_MASK_REG"; + scomaddr 0x01010843; + capture type secondary; + capture group default; + }; + + register PMCFIR_ACT0 + { + name "EH.TPCHIP.OCC.PMC.PMC_LFIR_ACTION0_REG"; + scomaddr 0x01010846; + capture type secondary; + capture group default; + }; + + register PMCFIR_ACT1 + { + name "EH.TPCHIP.OCC.PMC.PMC_LFIR_ACTION1_REG"; + scomaddr 0x01010847; + capture type secondary; + capture group default; + }; + diff --git a/src/usr/diag/prdf/common/plat/pegasus/Proc_regs_XBUS.rule b/src/usr/diag/prdf/common/plat/pegasus/Proc_regs_XBUS.rule new file mode 100755 index 000000000..93e5e52b6 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/Proc_regs_XBUS.rule @@ -0,0 +1,178 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/plat/pegasus/Proc_regs_XBUS.rule $ +# +# 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 + + ############################################################################ + # XBUS Chiplet Registers + ############################################################################ + + register XBUS_CHIPLET_CS_FIR + { + name "EN.PB.TPC.XFIR"; + scomaddr 0x04040000; + capture group default; + }; + + register XBUS_CHIPLET_RE_FIR + { + name "EN.PB.TPC.RFIR"; + scomaddr 0x04040001; + capture group default; + }; + + register XBUS_CHIPLET_FIR_MASK + { + name "EN.PB.TPC.FIR_MASK"; + scomaddr 0x04040002; + capture type secondary; + capture group default; + }; + + ############################################################################ + # XBUS Chiplet LFIR + ############################################################################ + + register XBUS_LFIR + { + name "EN.PB.TPC.LOCAL_FIR"; + scomaddr 0x0404000a; + reset (&, 0x0404000b); + mask (|, 0x0404000f); + capture group default; + }; + + register XBUS_LFIR_MASK + { + name "EN.PB.TPC.EPS.FIR.LOCAL_FIR_MASK"; + scomaddr 0x0404000d; + capture type secondary; + capture group default; + }; + + register XBUS_LFIR_ACT0 + { + name "EN.PB.TPC.EPS.FIR.LOCAL_FIR_ACTION0"; + scomaddr 0x04040010; + capture type secondary; + capture group default; + }; + + register XBUS_LFIR_ACT1 + { + name "EN.PB.TPC.EPS.FIR.LOCAL_FIR_ACTION1"; + scomaddr 0x04040011; + capture type secondary; + capture group default; + }; + + ############################################################################ + # XBUS Chiplet PBENFIR + ############################################################################ + + register PBENFIR + { + name "EN.PB.PBEN.MISC_IO.SCOM.FIR_REG"; + scomaddr 0x04010c00; + reset (&, 0x04010c01); + reset (|, 0x04010c05); + capture group default; + }; + + register PBENFIR_MASK + { + name "EN.PB.PBEN.MISC_IO.SCOM.FIR_MASK_REG"; + scomaddr 0x04010c03; + capture type secondary; + capture group default; + }; + + register PBENFIR_ACT0 + { + name "EN.PB.PBEN.MISC_IO.SCOM.FIR_REG_ACTION0"; + scomaddr 0x04010c06; + capture type secondary; + capture group default; + }; + + register PBENFIR_ACT1 + { + name "EN.PB.PBEN.MISC_IO.SCOM.FIR_REG_ACTION1"; + scomaddr 0x04010c07; + capture type secondary; + capture group default; + }; + + ############################################################################ + # XBUS Chiplet IOXFIR_0 + ############################################################################ + + # Venice only scomaddr = TBD + + ############################################################################ + # XBUS Chiplet IOXFIR_1 + ############################################################################ + + register IOXFIR_1 + { + name "XBUS1.BUSCTL.SCOM.FIR_REG"; + scomaddr 0x04011400; + reset (&, 0x04010c01); + reset (|, 0x04010c05); + capture group default; + }; + + register IOXFIR_1_MASK + { + name "XBUS1.BUSCTL.SCOM.FIR_MASK_REG"; + scomaddr 0x04011403; + capture type secondary; + capture group default; + }; + + register IOXFIR_1_ACT0 + { + name "XBUS1.BUSCTL.SCOM.FIR_ACTION0_REG"; + scomaddr 0x04011406; + capture type secondary; + capture group default; + }; + + register IOXFIR_1_ACT1 + { + name "XBUS1.BUSCTL.SCOM.FIR_ACTION0_REG"; + scomaddr 0x04011407; + capture type secondary; + capture group default; + }; + + ############################################################################ + # XBUS Chiplet IOXFIR_2 + ############################################################################ + + # Venice only scomaddr = TBD + + ############################################################################ + # XBUS Chiplet IOXFIR_3 + ############################################################################ + + # Venice only scomaddr = TBD + diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfCalloutUtil.C b/src/usr/diag/prdf/common/plat/pegasus/prdfCalloutUtil.C new file mode 100644 index 000000000..23d545e33 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/prdfCalloutUtil.C @@ -0,0 +1,44 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfCalloutUtil.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 prdfCalloutUtil.C */ + +#include <prdfCalloutUtil.H> + +#include <iipServiceDataCollector.h> + +namespace PRDF +{ +namespace CalloutUtil +{ + +void defaultError( STEP_CODE_DATA_STRUCT & i_sc ) +{ + i_sc.service_data->SetCallout( NextLevelSupport_ENUM ); + i_sc.service_data->SetCallout( SP_CODE ); + i_sc.service_data->SetServiceCall(); +} + +} // end namespace CalloutUtil +} // end namespace PRDF + diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfCalloutUtil.H b/src/usr/diag/prdf/common/plat/pegasus/prdfCalloutUtil.H new file mode 100644 index 000000000..e74c102bc --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/prdfCalloutUtil.H @@ -0,0 +1,49 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfCalloutUtil.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 prdfCalloutUtil_H +#define prdfCalloutUtil_H + +/** @file prdfCalloutUtil.H + * @brief Utility functions for common, non-trivial callouts. + */ + +struct STEP_CODE_DATA_STRUCT; + +namespace PRDF +{ +namespace CalloutUtil +{ + +/** + * @brief In many cases, an internal logic error may occur in which 2nd level + * support and FSP code need to be called out. This function is intented + * to help eliminate the need to constantly repeat the list of callouts. + * @param i_sc The step code data struct. + */ +void defaultError( STEP_CODE_DATA_STRUCT & i_sc ); + +} // end namespace CalloutUtil +} // end namespace PRDF + +#endif // prdfCalloutUtil_H diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfCenMba.C b/src/usr/diag/prdf/common/plat/pegasus/prdfCenMba.C new file mode 100755 index 000000000..f332030a2 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/prdfCenMba.C @@ -0,0 +1,168 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfCenMba.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 prdfCenMba.C + * @brief Contains all the plugin code for the PRD Centaur MBA + */ + +#include <iipServiceDataCollector.h> +#include <prdfCalloutUtil.H> +#include <prdfExtensibleChip.H> +#include <prdfMemUtil.H> +#include <prdfPlatServices.H> +#include <prdfPluginMap.H> + +#include <prdfCenMbaDataBundle.H> + +namespace PRDF +{ +namespace Mba +{ + +//############################################################################## +// +// Special plugins +// +//############################################################################## + +/** + * @brief Plugin that initializes the P8 Centaur MBA data bundle. + * @param i_mbaChip A Centaur MBA chip. + * @return SUCCESS + */ +int32_t Initialize( PrdfExtensibleChip * i_mbaChip ) +{ + i_mbaChip->getDataBundle() = new CenMbaDataBundle( i_mbaChip ); + return SUCCESS; +} +PRDF_PLUGIN_DEFINE( Mba, Initialize ); + +//------------------------------------------------------------------------------ + +/** + * @brief Plugin function called after analysis is complete but before PRD + * exits. + * @param i_mbaChip A Centaur MBA chip. + * @param i_sc The step code data struct. + * @note This is especially useful for any analysis that still needs to be + * done after the framework clears the FIR bits that were at attention. + * @return SUCCESS. + */ +int32_t PostAnalysis( PrdfExtensibleChip * i_mbaChip, + STEP_CODE_DATA_STRUCT & i_sc ) +{ + #ifdef __HOSTBOOT_MODULE + + using namespace TARGETING; + + // In hostboot, we need to clear MCI Fir bits. Do we will get the mcs + // chiplet connected with Mba and call its plugin to clear those FIR bits + int32_t l_rc = MemUtil::clearHostAttns( i_mbaChip, i_sc ); + if ( SUCCESS != l_rc ) + PRDF_ERR( "[Mba::PostAnalysis] MemUtil::clearHostAttns failed" ); + + // Send command complete to MDIA. + // This must be done in post analysis after attentions have been cleared. + if ( PlatServices::isInMdiaMode() ) + { + TargetHandle_t mbaTarget = i_mbaChip->GetChipHandle(); + CenMbaDataBundle * mbadb = getMbaDataBundle( i_mbaChip ); + + mbadb->iv_sendCmdCompleteMsg = false; + PlatServices::mdiaSendCmdComplete( mbaTarget ); + } + + #endif // __HOSTBOOT_MODULE + + return SUCCESS; +} +PRDF_PLUGIN_DEFINE( Mba, PostAnalysis ); + +//############################################################################## +// +// MBASPA +// +//############################################################################## + +/** + * @brief MBASPA[0] - Maintenance command complete. + * @param i_mbaChip A Centaur MBA chip. + * @param i_sc The step code data struct. + * @return SUCCESS + */ +int32_t MaintCmdComplete( PrdfExtensibleChip * i_mbaChip, + STEP_CODE_DATA_STRUCT & i_sc ) +{ + using namespace TARGETING; + + int32_t l_rc = SUCCESS; + TargetHandle_t mbaTarget = i_mbaChip->GetChipHandle(); + + do + { + #ifdef __HOSTBOOT_MODULE + + // TODO: Will need to change design once this for error path. + CenMbaDataBundle * mbadb = getMbaDataBundle( i_mbaChip ); + mbadb->iv_sendCmdCompleteMsg = true; + + #endif // __HOSTBOOT_MODULE + + } while (0); + + if ( SUCCESS != l_rc ) + { + PRDF_ERR( "[Mba::MaintCmdComplete] failed on MBA 0x%08x", + PlatServices::getHuid(mbaTarget) ); + CalloutUtil::defaultError( i_sc ); + } + + return SUCCESS; +} +PRDF_PLUGIN_DEFINE( Mba, MaintCmdComplete ); + +/** + * @brief Plugin to send a Skip MBA message for Memory Diagnositics. + * @note Does nothing in non-MDIA mode. + * @note Will stop any maintenance commands in progress. + * @param i_chip mba target + * @param i_sc The step code data struct. + * @return SUCCESS + */ +// FIXME: Story 51702 will implement this +int32_t SkipMbaMsg( PrdfExtensibleChip * i_chip, + STEP_CODE_DATA_STRUCT & i_sc ) +{ + using namespace TARGETING; + int32_t o_rc = SUCCESS; + TargetHandle_t mbaTarget = i_chip->GetChipHandle(); + + PRDF_ERR("[SkipMbaMsg] MBA 0x%08x : this function is not yet implemented!", + PlatServices::getHuid(mbaTarget)); + + return o_rc; +} +PRDF_PLUGIN_DEFINE( Mba, SkipMbaMsg ); + +} // end namespace Mba +} // end namespace PRDF diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaDataBundle.H b/src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaDataBundle.H new file mode 100644 index 000000000..9fd12de20 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaDataBundle.H @@ -0,0 +1,86 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfCenMbaDataBundle.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 prdfCenMbaDataBundle_H +#define prdfCenMbaDataBundle_H + +/** @file prdfCenMbaDataBundle.H + * @brief Contains the data bundle for a PRD Centaur MBA object. + */ + +#include <prdfExtensibleChip.H> + +//------------------------------------------------------------------------------ + +namespace PRDF +{ + +/** + * @brief The P7 Centaur MBA data bundle. + */ +class CenMbaDataBundle : public PrdfDataBundle +{ + public: // functions + + /** + * @brief Constructor. + * @param i_mbaChip The MBA chip. + */ + explicit CenMbaDataBundle( PrdfExtensibleChip * i_mbaChip ) : + iv_sendCmdCompleteMsg(false) + {} + + /** + * @brief Destructor. + */ + ~CenMbaDataBundle() {} + + private: // functions + + CenMbaDataBundle( const CenMbaDataBundle & ); + const CenMbaDataBundle & operator=( const CenMbaDataBundle & ); + + public: // instance variables + + /** TRUE if a maintenance command complete message needs to be sent in the + * post analysis plugin, FALSE otherwise. */ + bool iv_sendCmdCompleteMsg; + +}; + +//------------------------------------------------------------------------------ + +/** + * @brief Wrapper function for the CenMbaDataBundle. + * @param i_mbaChip The MBA chip. + * @return This MBA's data bundle. + */ +inline CenMbaDataBundle * getMbaDataBundle( PrdfExtensibleChip * i_mbaChip ) +{ + return static_cast<CenMbaDataBundle *>(i_mbaChip->getDataBundle()); +} + +} // end namespace PRDF + +#endif // prdfCenMbaDataBundle_H + diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfCenMembuf.C b/src/usr/diag/prdf/common/plat/pegasus/prdfCenMembuf.C new file mode 100755 index 000000000..8282bf55a --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/prdfCenMembuf.C @@ -0,0 +1,101 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfCenMembuf.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 prdfCenMembuf.C + * @brief Contains all the plugin code for the PRD Centaur Membuf + */ + +#include <iipServiceDataCollector.h> +#include <prdfCalloutUtil.H> +#include <prdfExtensibleChip.H> +#include <prdfMemUtil.H> +#include <prdfPlatServices.H> +#include <prdfPluginMap.H> + + +namespace PRDF +{ +namespace Membuf +{ + +//############################################################################## +// +// Special plugins +// +//############################################################################## + +/** + * @brief Plugin that initializes the P8 Centaur Membuf data bundle. + * @param i_mbaChip A Centaur Membuf chip. + * @return SUCCESS + */ +int32_t Initialize( PrdfExtensibleChip * i_mbaChip ) +{ + // FIXME: need to implement + return SUCCESS; +} +PRDF_PLUGIN_DEFINE( Membuf, Initialize ); + +//------------------------------------------------------------------------------ + +/** + * @fn CheckForRecovered + * @brief Used when the chip has a CHECK_STOP attention to check for the + * presence of recovered errors. + */ +int32_t CheckForRecovered(PrdfExtensibleChip * i_chip, + bool & o_hasRecovered) +{ + //FIXME: need to fully implement for Membuf + o_hasRecovered = false; + + return SUCCESS; +} PRDF_PLUGIN_DEFINE( Membuf, CheckForRecovered ); + +//------------------------------------------------------------------------------ + + + +//------------------------------------------------------------------------------ + +/** + * @brief Plugin function called after analysis is complete but before PRD + * exits. + * @param i_membufChip A Centaur Membuf chip. + * @param i_sc The step code data struct. + * @note This is especially useful for any analysis that still needs to be + * done after the framework clears the FIR bits that were at attention. + * @return SUCCESS. + */ +int32_t PostAnalysis( PrdfExtensibleChip * i_membufChip, + STEP_CODE_DATA_STRUCT & i_sc ) +{ + //FIXME: need to implement + + return SUCCESS; +} +PRDF_PLUGIN_DEFINE( Membuf, PostAnalysis ); + + +} // end namespace Membuf +} // end namespace PRDF diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfCenPll.C b/src/usr/diag/prdf/common/plat/pegasus/prdfCenPll.C new file mode 100755 index 000000000..4beda7535 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/prdfCenPll.C @@ -0,0 +1,221 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfCenPll.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 prdfCenPLL.C + * @brief chip Plug-in code for centaur pll support + */ + +#include <iipServiceDataCollector.h> +#include <prdfExtensibleChip.H> +#include <prdfPluginMap.H> +#include <prdfBitString.H> +#include <iipscr.h> +#include <prdfPlatServices.H> +#include <iipglobl.h> +#include <iipSystem.h> + +namespace PRDF +{ + +namespace Membuf +{ + + +enum +{ + PLL_DETECT_CENT_MEM = 18, // mem PLL error bit + PLL_DETECT_CENT_NEST = 19 // nest PLL error bit +}; + +/** + * @brief Query the PLL chip for a PLL error on Centaur Plugin + * @param i_chip Centaur chip + * @param o_result set to true in the presence of PLL error + * @returns Failure or Success of query. + * @note + */ +int32_t QueryPll( PrdfExtensibleChip * i_chip, + bool & o_result) +{ + int32_t rc = SUCCESS; + o_result = false; + + SCAN_COMM_REGISTER_CLASS * TP_LFIR = i_chip->getRegister("TP_LFIR"); + SCAN_COMM_REGISTER_CLASS * TP_LFIRmask = i_chip->getRegister("TP_LFIR_MASK"); + + do + { + rc = TP_LFIR->Read(); + if (rc != SUCCESS) break; + + rc = TP_LFIRmask->Read(); + if (rc != SUCCESS) break; + + if((TP_LFIR->IsBitSet(PLL_DETECT_CENT_MEM) && + !(TP_LFIRmask->IsBitSet(PLL_DETECT_CENT_MEM))) || + (TP_LFIR->IsBitSet(PLL_DETECT_CENT_NEST) && + !(TP_LFIRmask->IsBitSet(PLL_DETECT_CENT_NEST)))) + { + o_result = true; + } + + } while(0); + + return rc; + +} +PRDF_PLUGIN_DEFINE( Membuf, QueryPll ); + +/** + * @brief Clear the PLL error for Centaur Plugin + * @param i_chip Centaur chip + * @param i_sc The step code data struct. + * @returns Failure or Success of query. + * @note + */ +int32_t ClearPll( PrdfExtensibleChip * i_chip, + STEP_CODE_DATA_STRUCT & i_sc) +{ + int32_t rc = SUCCESS; + + if (CHECK_STOP != i_sc.service_data->GetAttentionType()) + { + SCAN_COMM_REGISTER_CLASS * TP_LFIR = i_chip->getRegister("TP_LFIR_AND"); + TP_LFIR->setAllBits(); + TP_LFIR->ClearBit(PLL_DETECT_CENT_MEM); + TP_LFIR->ClearBit(PLL_DETECT_CENT_NEST); + rc = TP_LFIR->Write(); + } + + return rc; + +} +PRDF_PLUGIN_DEFINE( Membuf, ClearPll ); + +/** + * @brief Mask the PLL error for Centaur Plugin + * @param i_chip Centaur chip + * @param Output Unused. + * @returns Failure or Success of query. + * @note + */ +int32_t MaskPll( PrdfExtensibleChip * i_chip,void * unused) +{ + int32_t rc = SUCCESS; + + SCAN_COMM_REGISTER_CLASS * TP_LFIR = i_chip->getRegister("TP_LFIR"); + SCAN_COMM_REGISTER_CLASS * TP_LFIR_or = i_chip->getRegister("TP_LFIR_MASK_OR"); + + rc = TP_LFIR->Read(); + TP_LFIR_or->clearAllBits(); + + if(TP_LFIR->IsBitSet(PLL_DETECT_CENT_MEM)) TP_LFIR_or->SetBit(PLL_DETECT_CENT_MEM); + if(TP_LFIR->IsBitSet(PLL_DETECT_CENT_NEST)) TP_LFIR_or->SetBit(PLL_DETECT_CENT_NEST); + + rc |= TP_LFIR_or->Write(); + + return rc; + +} +PRDF_PLUGIN_DEFINE( Membuf, MaskPll ); + +/** + * @brief Adds to the callout list for Centaur PLL errors. + * @param i_chip Centaur chip. + * @param i_sc The step code data struct. + * @return SUCCESS. + */ +int32_t CalloutPll( PrdfExtensibleChip * i_chip, + STEP_CODE_DATA_STRUCT & i_sc ) +{ + // FIXME: RTC: 51628 will address clock target issue + // set Level 2 callout since we don't have clock target yet + i_sc.service_data->SetCallout( NextLevelSupport_ENUM ); + + return SUCCESS; +} +PRDF_PLUGIN_DEFINE( Membuf, CalloutPll ); + +/** + Send a PLL error message on Centaur Plugin. + @param i_chip the chip that this is for. + @param i_sc service data. + @returns Failure Or Success of message call. + @note + */ +int32_t PllPostAnalysis( PrdfExtensibleChip * i_chip, + STEP_CODE_DATA_STRUCT & i_sc ) +{ + using namespace TARGETING; + int32_t l_rc = SUCCESS; + +// Need to send MBA Skip Message to MDIA in Hostboot only +#ifdef __HOSTBOOT_MODULE + + TargetHandle_t l_cenHandle = i_chip->GetChipHandle(); + + do + { + TargetHandleList list = PlatServices::getConnected(l_cenHandle , TYPE_MBA); + if ( 0 == list.size() ) + { + PRDF_ERR("[PllPostAnalysis] failed to get MBAs connected to this " + "Membuf: 0x%08x", PlatServices::getHuid(l_cenHandle) ); + l_rc = FAIL; + break; + } + + for (TargetHandleList::iterator mbaIt = list.begin(); mbaIt != list.end(); ++mbaIt) + { + // Get the extensible chip for this mba + PrdfExtensibleChip *l_mbaChip = (PrdfExtensibleChip *)systemPtr->GetChip(*mbaIt); + + //Check to make sure we are at threshold and have something garded. + if( (NULL != l_mbaChip) && + (i_sc.service_data->IsAtThreshold()) && + (i_sc.service_data->QueryGard() != GardResolution::NoGard) ) + { + //Call the Skip Maintanence Command on this mba + PrdfExtensibleChipFunction * l_skipMbaMsg = + l_mbaChip->getExtensibleFunction("SkipMbaMsg", true); + + // This call will return an error if it doesn't complete. + // Don't fail on error. keep going. + l_rc |= (*l_skipMbaMsg)(l_mbaChip, + PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT &>(i_sc)); + } + } + + } while(0); + +#endif // ifdef __HOSTBOOT_MODULE + + return l_rc; +} +PRDF_PLUGIN_DEFINE( Membuf, PllPostAnalysis ); + + +} // end namespace Membuf + +} // end namespace PRDF diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfDramRepairs.C b/src/usr/diag/prdf/common/plat/pegasus/prdfDramRepairs.C new file mode 100644 index 000000000..7d5820656 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/prdfDramRepairs.C @@ -0,0 +1,449 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfDramRepairs.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 prdfDramRepairs.C */ + + +#include <prdfMain.H> +#include <prdf_service_codes.H> +#include <iipconst.h> +#include <iipglobl.h> +#include <prdfEnums.H> +#include <prdfPlatServices.H> +#include <prdfMemoryMru.H> + +using namespace HWAS; +using namespace std; +using namespace TARGETING; + +namespace PRDF +{ + +static const uint8_t INVALID_SYMBOL = 0xff; + +bool validSymbol(uint8_t i_symbol) +{ + return i_symbol != INVALID_SYMBOL; +} + +bool commitRestoreCallout(bool (*i_func)(errlHndl_t &, void *), void * i_data) +{ + PRDF_DENTER("commitRestoreCallout"); + + errlHndl_t err = NULL; + bool o_term = false; + + PRDF_HW_CREATE_ERRL( + err, + ERRL_SEV_PREDICTIVE, + ERRL_ETYPE_NOT_APPLICABLE, + SRCI_MACH_CHECK, + SRCI_NO_ATTR, + PRDF_RESTORE_DRAM_REPAIR, + FSP_DEFAULT_REFCODE, + PRDF_DETECTED_FAIL_HARDWARE_PROBABLE, + 0, 0, 0, 0, // user data + HOM_SYS_NO_TERMINATE, + false); // no pld check + + // add the callout + + if((*i_func)(err, i_data)) + { + o_term = true; + } + + bool term = false; + + PRDF_HW_COMMIT_ERRL( + term, + err, + HOM_DECONFIG_DEFER, + ERRL_ACTION_REPORT, + HOM_CONTINUE); + + if(term) + { + // FIXME...this is a little goofy. + // Should be scrubbed with RTC 51552 + + PRDF_COMMIT_ERRL(err, ERRL_ACTION_REPORT); + } + + return o_term; +} + +bool addMemMruCallout(errlHndl_t & io_log, void * i_memMru) +{ + PRDF_DENTER("addMemMruCallout"); + + bool o_term = false; + + PRDF_HW_ADD_MEMMRU_CALLOUT( + o_term, + *static_cast<PrdfMemoryMru *>(i_memMru), + SRCI_PRIORITY_HIGH, + HOM_DECONFIG, + HOM_DECONFIG_GARD, + io_log, + false, // don't write src to vpd + GARD_Predictive, + ERRL_SEV_PREDICTIVE, + false); // don't update hcdb + + return o_term; +} + +bool addDimmCallout(errlHndl_t & io_log, void * i_dimm) +{ + PRDF_DENTER("addDimmCallout"); + + bool o_term = false; + + PRDF_HW_ADD_CALLOUT( + o_term, + static_cast<TargetHandle_t>(i_dimm), + SRCI_PRIORITY_HIGH, + HOM_DECONFIG, + HOM_DECONFIG_GARD, + io_log, + false, // don't write src to vpd + GARD_Predictive, + ERRL_SEV_PREDICTIVE, + false); // don't update hcdb + + return o_term; +} + +bool processRepairedRanks( + TargetHandle_t i_mba, + uint8_t i_repairedRankMask) +{ + PRDF_DENTER("processRepairedRanks: %p, 0x%02x", + i_mba, i_repairedRankMask); + + // check the argument ranks for repairs + // that violate RAS policy + + errlHndl_t err = NULL; + + bool calloutMade = false; + + // check each rank for repairs + // that violate RAS policy + + for ( uint8_t rankNumber = 0; + rankNumber < DIMM_DQ_MAX_MBAPORT_DIMMS * DIMM_DQ_MAX_DIMM_RANKS; + ++rankNumber ) + { + if(0 == ((0x80 >> rankNumber) & i_repairedRankMask)) + { + // this rank didn't have any repairs + + continue; + } + + uint8_t sm = INVALID_SYMBOL, + cm = INVALID_SYMBOL; + + if(SUCCESS != PlatServices::mssGetMarkStore( + i_mba, rankNumber, cm, sm)) + { + // skip this rank + + continue; + } + + uint8_t sp0 = INVALID_SYMBOL, + sp1 = INVALID_SYMBOL, + sp = INVALID_SYMBOL; + + if(SUCCESS != PlatServices::mssGetSteerMux( + i_mba, + rankNumber, + mss_SteerMux::READ_MUX, + sp0, sp1, sp)) + { + // skip this rank + + PRDF_COMMIT_ERRL(err, ERRL_ACTION_REPORT); + continue; + } + + if((validSymbol(sp0) || validSymbol(sp1) || validSymbol(sp)) + && validSymbol(cm)) + { + // this rank has both a steer + // and a chip mark + + // FIXME replace with a real memory mru + + struct GetMemoryMru + { + PrdfMemoryMru * operator()( + TargetHandle_t i_mba, + uint8_t i_rank, + uint8_t i_symbol) + { + return NULL; + } + + } getMemoryMru; + + PrdfMemoryMru * memoryMru = getMemoryMru(i_mba, rankNumber, cm); + + commitRestoreCallout(&addMemMruCallout, memoryMru); + + calloutMade = true; + } + } + + PRDF_DEXIT("processRepairedRanks"); + + return calloutMade; +} + +bool processBadDimms(TargetHandle_t i_mba, uint8_t i_badDimmMask) +{ + PRDF_DENTER("processBadDimms: %p, 0x%02x", i_mba, i_badDimmMask); + + const struct DimmPortAssoc + { + uint8_t port; + uint8_t dimm; + uint8_t enc; + + } dimmPortAssoc[] = { + + {0, 0, 0x8}, + {0, 1, 0x4}, + {1, 0, 0x2}, + {1, 1, 0x1}, + }; + + uint64_t calloutCount = 0; + + // callout the argument dimms + + // get all the dimms connected to this MBA + + TARGETING::TargetHandleList dimms = PlatServices::getConnected( + i_mba, TARGETING::TYPE_DIMM); + + // convert the encoded dimms that had too many repairs to + // dimm targets + + TargetHandleList::iterator dit = dimms.end(); + + while(dit-- != dimms.begin()) + { + uint8_t port = 0, dimm = 0; + + if(SUCCESS != PlatServices::getMbaPort(*dit, port)) + { + // skip this dimm + continue; + } + + if(SUCCESS != PlatServices::getMbaDimm(*dit, dimm)) + { + // skip this dimm + continue; + } + + // see if the passed in dimm + // was flagged as bad by the restore procedure + + bool match = false; + + const DimmPortAssoc * it = dimmPortAssoc + + sizeof(dimmPortAssoc)/sizeof(*dimmPortAssoc); + + while(!match && it-- != dimmPortAssoc) + { + if(i_badDimmMask & it->enc + && port == it->port + && dimm == it->dimm) + { + // this dimm is a match + + match = true; + } + } + + // call them out + + if(match) + { + ++calloutCount; + commitRestoreCallout(&addDimmCallout, *dit); + } + } + + PRDF_DEXIT("processBadDimms: bad dimm count: %d", calloutCount); + + return 0 != calloutCount; +} + +bool processDq(TargetHandle_t i_mba) +{ + PRDF_DENTER("processDq: %p", i_mba); + + // callout any dimms on the argument MBA + // that have any bad dq + + uint64_t calloutCount = 0; + + // get all the dimms connected to this MBA + + TARGETING::TargetHandleList dimms = PlatServices::getConnected( + i_mba, TARGETING::TYPE_DIMM); + + TargetHandleList::iterator dit = dimms.end(); + + // call them out if they have any bad dq + + while(dit-- != dimms.begin()) + { + uint8_t port = 0, dimm = 0; + + if(SUCCESS != PlatServices::getMbaPort(*dit, port)) + { + // skip this dimm + continue; + } + + if(SUCCESS != PlatServices::getMbaDimm(*dit, dimm)) + { + // skip this dimm + continue; + } + + bool badDq = false; + uint8_t bitmap[DIMM_DQ_RANK_BITMAP_SIZE]; + + uint64_t rankNumber = DIMM_DQ_MAX_DIMM_RANKS; + + while(rankNumber-- && !badDq) + { + if(SUCCESS != PlatServices::getBadDqBitmap( + i_mba, + port, + dimm, + rankNumber, + bitmap)) + { + // skip this rank + continue; + } + + uint8_t * it = bitmap + DIMM_DQ_RANK_BITMAP_SIZE; + + while(!badDq && it-- != bitmap) + { + if(*it) + { + badDq = true; + } + } + } + + if(badDq) + { + ++calloutCount; + commitRestoreCallout(&addDimmCallout, *dit); + } + } + + PRDF_DEXIT("processDq: bad dq dimm count: %d", calloutCount); + + return 0 != calloutCount; +} + +int32_t restoreDramRepairs(TargetHandle_t i_mba) +{ + bool calloutMade = false; + + PRDF_DENTER("restoreDramRepairs: %p", i_mba); + + uint8_t repairedRankMask = 0, badDimmMask = 0; + + do { + + if(PlatServices::isMemoryPreservingIpl()) + { + // nothing to do in MPIPL + + break; + } + + // in mfg mode, check dq and don't restore anything + + if(PlatServices::areDramRepairsDisabled() + && processDq(i_mba)) + { + calloutMade = true; + + break; + } + + if(SUCCESS != PlatServices::mssRestoreDramRepairs( + i_mba, + repairedRankMask, + badDimmMask)) + { + // can't check anything if + // this doesn't work + + PRDF_ERR( "[restoreDramRepairs] " + "PlatServices::mssRestoreDramRepairs failed" ); + + break; + } + + // callout bad dimms + + if(processBadDimms( + i_mba, + badDimmMask)) + { + calloutMade = true; + } + + // check repaired ranks for + // RAS policy violations + + if(processRepairedRanks( + i_mba, + repairedRankMask)) + { + calloutMade = true; + } + + } while(0); + + PRDF_DEXIT("restoreDramRepairs"); + + return calloutMade ? FAIL : SUCCESS; +} +} diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfMemUtil.C b/src/usr/diag/prdf/common/plat/pegasus/prdfMemUtil.C new file mode 100644 index 000000000..46f3486f0 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/prdfMemUtil.C @@ -0,0 +1,114 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfMemUtil.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 prdfMemUtil.C */ + +#include <prdfMemUtil.H> + +#include <iipconst.h> +#include <iipglobl.h> +#include <iipSystem.h> +#include <iipServiceDataCollector.h> +#include <prdfExtensibleChip.H> +#include <prdfPlatServices.H> + +namespace PRDF +{ +namespace MemUtil +{ + +#ifdef __HOSTBOOT_MODULE + +int32_t clearHostAttns( PrdfExtensibleChip * i_memChip, + STEP_CODE_DATA_STRUCT & i_sc ) +{ + using namespace TARGETING; + + int32_t o_rc = SUCCESS; + + TargetHandle_t memHandle = i_memChip->GetChipHandle(); + + do + { + // Get the attached MCS chip. + PrdfExtensibleChip * mcsChip = i_memChip; + if ( TYPE_MCS != PlatServices::getTargetType(memHandle) ) + { + TargetHandleList list = PlatServices::getConnected( memHandle, + TYPE_MCS ); + if ( 1 == list.size() ) + mcsChip = (PrdfExtensibleChip *)systemPtr->GetChip( list[0] ); + else + { + PRDF_ERR( "[MemUtil::clearHostAttns] getConnected() failed" ); + o_rc = FAIL; + break; + } + } + + // Clear FIR bits based on the cause attention type. + // Note: The cause attention type is different than the global attention + // type, in that it is the attention type that we actually + // isolated to. For example, the global attention type could be + // CHECK_STOP but the cause atttention type could be RECOVERABLE. + SCAN_COMM_REGISTER_CLASS * firand = mcsChip->getRegister("MCIFIR_AND"); + firand->setAllBits(); + + ATTENTION_TYPE l_attnType = i_sc.service_data->GetCauseAttentionType(); + switch ( l_attnType ) + { + case CHECK_STOP: firand->ClearBit(12); break; + case RECOVERABLE: firand->ClearBit(15); break; + case SPECIAL: firand->ClearBit(16); + firand->ClearBit(17); break; + default: + PRDF_ERR( "[MemUtil::clearHostAttns] Invalid attention type %d", + l_attnType ); + o_rc = FAIL; + break; + } + if ( SUCCESS != o_rc ) break; + + o_rc = firand->Write(); + if ( SUCCESS != o_rc) + { + PRDF_ERR( "[MemUtil::clearHostAttns] MCIFIR_AND write failed" ); + break; + } + + } while(0); + + if ( SUCCESS != o_rc ) + { + PRDF_ERR( "[MemUtil::clearHostAttns] Failed: i_memChip=0x%08x", + PlatServices::getHuid(memHandle) ); + } + + return o_rc; +} + +#endif // __HOSTBOOT_MODULE + +} // end namespace MemUtil +} // end namespace PRDF + diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfMemUtil.H b/src/usr/diag/prdf/common/plat/pegasus/prdfMemUtil.H new file mode 100644 index 000000000..03b25ce95 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/prdfMemUtil.H @@ -0,0 +1,58 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfMemUtil.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 prdfMemUtil_H +#define prdfMemUtil_H + +/** @file prdfMemUtil.H + * @brief General utility functions for the memory subsystem. + */ + +#include <iipconst.h> + +class PrdfExtensibleChip; +struct STEP_CODE_DATA_STRUCT; + +namespace PRDF +{ +namespace MemUtil +{ + +//#ifdef __HOSTBOOT_MODULE + +/** + * @brief Clears bits in the MCIFIR that are triggered by centaur attentions + * that are reported to the host. + * @param i_memChip Any memory chip (MCS, MEMBUF, MBS, MBA, DIMM, etc.). + * @param i_sc The step code data struct. + * @return Non-SUCCESS for internal errors, SUCCESS otherwise. + */ +int32_t clearHostAttns( PrdfExtensibleChip * i_memChip, + STEP_CODE_DATA_STRUCT & i_sc ); + +//#endif // __HOSTBOOT_MODULE + +} // end namespace MemUtil +} // end namespace PRDF + +#endif // prdfMemUtil_H diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfP8Mcs.C b/src/usr/diag/prdf/common/plat/pegasus/prdfP8Mcs.C new file mode 100755 index 000000000..a43ae8ea6 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/prdfP8Mcs.C @@ -0,0 +1,57 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfP8Mcs.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 prdfP8Mcs.C + * @brief Contains all the plugin code for the PRD P8 MCS + */ + +#include <iipServiceDataCollector.h> +#include <prdfExtensibleChip.H> +#include <prdfPluginMap.H> + +//############################################################################## +// +// Special plugins +// +//############################################################################## + +namespace PRDF +{ +namespace Mcs +{ + +/** + * @brief Plugin that initializes the MCS data bundle. + * @param i_mcsChip An MCS chip. + * @return SUCCESS + */ +int32_t Initialize( PrdfExtensibleChip * i_mcsChip ) +{ + // FIXME: Add proper initialization as per requirement + return SUCCESS; +} +PRDF_PLUGIN_DEFINE( Mcs, Initialize ); + +} // end namespace Mcs +} // end namespace PRDF + diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfP8Pll.C b/src/usr/diag/prdf/common/plat/pegasus/prdfP8Pll.C new file mode 100755 index 000000000..b89cae099 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/prdfP8Pll.C @@ -0,0 +1,150 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfP8Pll.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 prdfP8PLL.C + * @brief chip Plug-in code for proc pll support + */ + +#include <iipServiceDataCollector.h> +#include <prdfExtensibleChip.H> +#include <prdfPluginMap.H> +#include <prdfBitString.H> +#include <iipscr.h> +#include <prdfPlatServices.H> + +namespace PRDF +{ + +namespace Proc +{ + + +enum +{ + PLL_DETECT_P8 = 14, //Bit position of the error bit. +}; + +/** + * @brief Query the PLL chip for a PLL error on P8 Plugin + * @param i_chip P8 chip + * @param o_result set to true in the presence of PLL error + * @returns Failure or Success of query. + * @note + */ +int32_t QueryPll( PrdfExtensibleChip * i_chip, + bool & o_result) +{ + int32_t rc = SUCCESS; + o_result = false; + + SCAN_COMM_REGISTER_CLASS * TP_LFIR = i_chip->getRegister("TP_LFIR"); + SCAN_COMM_REGISTER_CLASS * TP_LFIRmask = i_chip->getRegister("TP_LFIR_MASK"); + + do + { + rc = TP_LFIR->Read(); + if (rc != SUCCESS) break; + + rc = TP_LFIRmask->Read(); + if (rc != SUCCESS) break; + + if(TP_LFIR->IsBitSet(PLL_DETECT_P8) && + !(TP_LFIRmask->IsBitSet(PLL_DETECT_P8))) + { + o_result = true; + } + + } while(0); + + return rc; + +} +PRDF_PLUGIN_DEFINE( Proc, QueryPll ); + +/** + * @brief Clear the PLL error for P8 Plugin + * @param i_chip P8 chip + * @param i_sc The step code data struct + * @returns Failure or Success of query. + * @note + */ +int32_t ClearPll( PrdfExtensibleChip * i_chip, + STEP_CODE_DATA_STRUCT & i_sc) +{ + int32_t rc = SUCCESS; + + if (CHECK_STOP != i_sc.service_data->GetAttentionType()) + { + SCAN_COMM_REGISTER_CLASS * TP_LFIR = i_chip->getRegister("TP_LFIR_AND"); + TP_LFIR->setAllBits(); + TP_LFIR->ClearBit(PLL_DETECT_P8); + rc = TP_LFIR->Write(); + } + + return rc; + +} +PRDF_PLUGIN_DEFINE( Proc, ClearPll ); + +/** + * @brief Mask the PLL error for P8 Plugin + * @param i_chip P8 chip + * @param Output Unused. + * @returns Failure or Success of query. + * @note + */ +int32_t MaskPll( PrdfExtensibleChip * i_chip,void * unused) +{ + int32_t rc = SUCCESS; + SCAN_COMM_REGISTER_CLASS * tpmask_or = i_chip->getRegister("TP_LFIR_MASK_OR"); + tpmask_or->clearAllBits(); + tpmask_or->SetBit(PLL_DETECT_P8); + rc = tpmask_or->Write(); + return rc; + +} +PRDF_PLUGIN_DEFINE( Proc, MaskPll ); + +/** + * @brief Adds to the callout list for P8 PLL errors. + * @param i_chip P8 chip. + * @param i_sc The step code data struct. + * @return SUCCESS. + */ +int32_t CalloutPll( PrdfExtensibleChip * i_chip, + STEP_CODE_DATA_STRUCT & i_sc ) +{ + // FIXME: RTC: 51628 will address clock target issue + // set Level 2 callout since we don't have clock target yet + i_sc.service_data->SetCallout( NextLevelSupport_ENUM ); + + return SUCCESS; + +} +PRDF_PLUGIN_DEFINE( Proc, CalloutPll ); + + +} // end namespace Proc + +} // end namespace PRDF diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfP8Proc.C b/src/usr/diag/prdf/common/plat/pegasus/prdfP8Proc.C new file mode 100755 index 000000000..961b1785a --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/prdfP8Proc.C @@ -0,0 +1,362 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfP8Proc.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 prdfP8Proc.C + * @brief Contains all the plugin code for the PRD P8 Proc + */ +#include <prdfPluginDef.H> +#include <iipServiceDataCollector.h> +#include <prdfExtensibleChip.H> +#include <prdfPlatServices.H> +#include <prdfPluginMap.H> + +namespace PRDF +{ +namespace Proc +{ + +//############################################################################## +// +// Special plugins +// +//############################################################################## + +/** + * @brief Plugin that initializes the P8 Mba data bundle. + * @param i_chip P8 chip. + * @return SUCCESS + */ +int32_t Initialize( PrdfExtensibleChip * i_chip ) +{ + // FIXME: Add proper initialization as per requirement + return SUCCESS; +} +PRDF_PLUGIN_DEFINE( Proc, Initialize ); + +/** + * @brief Checks the Global Broadcast register. + * @param i_reg - the global recoverable register + * @param i_tpReg - the TP chiplet recoverable register + * @return true if only MC bits are on. + */ +static inline bool OnlyMcRec (SCAN_COMM_REGISTER_CLASS * i_reg, + SCAN_COMM_REGISTER_CLASS * i_tpReg) +{ + bool rc = false; + + if ( (0 == i_reg->GetBitFieldJustified(2,23)) && + (0 == i_tpReg->GetBitFieldJustified(1,2)) && + (0 != i_tpReg->GetBitFieldJustified(3,8)) && + (0 == i_tpReg->GetBitFieldJustified(11,8)) ) + { + rc = true; + } + return rc; +} + +/** + * @brief Checks the GLobal CS Brodacast register and + * the PBXSTP Chiplet register + * @param i_glcs - the Global CS Broadcast register + * @param i_tpcs - the TPXSTP register + * @param i_pbcs - the PBXSTP register + * @return true if only mem bits are on in CS, or, + * if the only other CS is External CS. + */ +static inline bool OnlyMcOrExtCS (SCAN_COMM_REGISTER_CLASS * i_glcs, + SCAN_COMM_REGISTER_CLASS * i_tpCs, + SCAN_COMM_REGISTER_CLASS * i_pbcs) +{ + bool rc = false; + + if (((0 == i_glcs->GetBitFieldJustified(3,22)) && //No CS besides TP and PB + (0 == i_tpCs->GetBitFieldJustified(3,2 )) && //No CS in TP besides MCs + (0 == i_tpCs->GetBitFieldJustified(13,8))) //No CS in TP besides MCs + && //and + (((!i_glcs->IsBitSet(2)) && // if its not from PB + (0 != i_tpCs->GetBitFieldJustified(5,8))) // and it is from a MC + || // or + ((i_glcs->IsBitSet(2)) && // it is from PB + (i_pbcs->IsBitSet(2)) && // and its external + (0 == i_pbcs->GetBitFieldJustified(3,18)))))// and nothing else in PB + { + rc = true; + } + + return rc; +} + +/** + * @brief Used when the chip has a CHECK_STOP attention to check for the + * presence of recovered errors. + * @param i_chip - P8 chip. + * @param o_hasRecovered - true if chip has a recovered that we want to analyze + * @return SUCCESS + */ +int32_t CheckForRecovered(PrdfExtensibleChip * i_chip, + bool & o_hasRecovered) +{ + o_hasRecovered = false; + int32_t o_rc = SUCCESS; + + SCAN_COMM_REGISTER_CLASS * l_rer = + i_chip->getRegister("GLOBAL_RE_FIR"); + o_rc |= l_rer->Read(); + + SCAN_COMM_REGISTER_CLASS * l_TPrer = + i_chip->getRegister("TP_CHIPLET_RE_FIR"); + o_rc |= l_TPrer->Read(); + + SCAN_COMM_REGISTER_CLASS * l_TPxstp = + i_chip->getRegister("TP_CHIPLET_CS_FIR"); + o_rc |= l_TPxstp->Read(); + + SCAN_COMM_REGISTER_CLASS * l_xstop = + i_chip->getRegister("GLOBAL_CS_FIR"); + o_rc |= l_xstop->Read(); + + SCAN_COMM_REGISTER_CLASS * l_pbXstpFir = + i_chip->getRegister("PB_CHIPLET_CS_FIR"); + o_rc |= l_pbXstpFir->Read(); + + if (o_rc) + { + PRDF_ERR( "[CheckForRecovered] SCOM fail on 0x%08x rc=%x", + i_chip->GetId(), o_rc); + return o_rc; + } + + if ( 0 != l_rer->GetBitFieldJustified(0,32) ) + { + if ( 0 == l_TPrer->GetBitFieldJustified(3,8) ) + { //No MC Recov + o_hasRecovered = true; + } + else if ( 0 != l_TPxstp->GetBitFieldJustified(5,8) ) + { + // There is Mc Recov and Mc xstop + if ( OnlyMcRec(l_rer, l_TPrer) && + OnlyMcOrExtCS(l_xstop, l_TPxstp, l_pbXstpFir) ) + { + // Ignore the Mc Recoverable if only the Mc bits are + // on in Global Recoverable reg, and, either the only + // Global CS bits are Mc or there is an External CS. + } + else + { + o_hasRecovered = true; + } + } + else + { + // MC Recov does not match MC Xstop + o_hasRecovered = true; + } + } + + return SUCCESS; +} PRDF_PLUGIN_DEFINE( Proc, CheckForRecovered ); + +//------------------------------------------------------------------------------ +/** + * @brief Used when the chip is queried, by the fabric domain, for RECOVERED + * attentions to assign a severity to the attention for sorting. + * @param[in] i_chip - P8 chip + * @param[out] o_sev - Priority order (lowest to highest): + * 1 - Core chiplet checkstop + * 2 - Core chiplet error + * 3 - PCB chiplet error (TOD logic) + * 4 - Other error + * 5 - Memory controller chiplet + * + * @return SUCCESS + * + */ +int32_t CheckForRecoveredSev(PrdfExtensibleChip * i_chip, + uint32_t & o_sev) +{ + SCAN_COMM_REGISTER_CLASS * l_rer = NULL; + SCAN_COMM_REGISTER_CLASS * l_TPrer = NULL; + SCAN_COMM_REGISTER_CLASS * l_unitxstp = NULL; + + int32_t o_rc = SUCCESS; + + l_unitxstp = i_chip->getRegister("GLOBALUNITXSTPFIR"); + o_rc |= l_unitxstp->Read(); + l_rer = i_chip->getRegister("GLOBAL_RE_FIR"); + o_rc |= l_rer->Read(); + l_TPrer = i_chip->getRegister("TP_CHIPLET_RE_FIR"); + o_rc |= l_TPrer->Read(); + + if (o_rc) + { + PRDF_ERR( "[CheckForRecoveredSev] SCOM fail on 0x%08x rc=%x", + i_chip->GetId(), o_rc); + return o_rc; + } + + if (l_TPrer->GetBitFieldJustified(3,8) != 0) + { + // errors from MCS chiplets + o_sev = 5; + } + else if(l_rer->IsBitSet(2) || l_rer->IsBitSet(4) || l_rer->IsBitSet(8)) + { + // errors from PB, X, or A bus chiplets + o_sev = 4; + } + else if(l_rer->IsBitSet(1)) + { + // error from TP (other than MCS chiplets) + o_sev = 3; + } + else if((l_rer->GetBitFieldJustified(11,14) & + l_unitxstp->GetBitFieldJustified(11,14)) == 0) + { + // core recoverable + o_sev = 2; + } + else + { + // core checkstop + o_sev = 1; + } + + return SUCCESS; + +} PRDF_PLUGIN_DEFINE( Proc, CheckForRecoveredSev ); + +/** @func GetCheckstopInfo + * To be called from the fabric domain to gather Checkstop information. This + * information is used in a sorting algorithm. + * + * This is a plugin function: GetCheckstopInfo + * + * @param i_chip - The chip. + * @param o_wasInternal - True if this chip has an internal checkstop. + * @param o_externalChips - List of external fabrics driving checkstop. + * @param o_wofValue - Current WOF value (unused for now). + */ +int32_t GetCheckstopInfo(PrdfExtensibleChip * i_chip, + bool & o_wasInternal, + TARGETING::TargetHandleList & o_externalChips, + uint64_t & o_wofValue) +{ + using namespace TARGETING; using namespace PlatServices; + + // Clear parameters. + o_wasInternal = false; + o_externalChips.erase(o_externalChips.begin(), o_externalChips.end()); + o_wofValue = 0; + + SCAN_COMM_REGISTER_CLASS * l_globalFir = + i_chip->getRegister("GLOBAL_CS_FIR"); + + SCAN_COMM_REGISTER_CLASS * l_pbXstpFir = + i_chip->getRegister("PB_CHIPLET_CS_FIR"); + + SCAN_COMM_REGISTER_CLASS * l_extXstpFir = + i_chip->getRegister("PBEXTFIR"); + + int32_t o_rc = SUCCESS; + o_rc |= l_globalFir->Read(); + o_rc |= l_pbXstpFir->Read(); + o_rc |= l_extXstpFir->Read(); + + if(o_rc) + { + PRDF_ERR( "[GetCheckstopInfo] SCOM fail on 0x%08x rc=%x", + i_chip->GetId(), o_rc); + return o_rc; + } + + if ((0 != l_globalFir->GetBitFieldJustified(0,32)) && + (!l_globalFir->IsBitSet(2) || + !l_pbXstpFir->IsBitSet(2))) + o_wasInternal = true; + + // Get connected chips. + uint32_t l_connectedXstps = l_extXstpFir->GetBitFieldJustified(0,7); + uint32_t l_positions[] = + { + 0, // bit 0 - XBUS 0 + 1, // bit 1 - XBUS 1 + 2, // bit 2 - XBUS 2 + 3, // bit 3 - XBUS 3 + 0, // bit 4 - ABUS 0 + 1, // bit 5 - ABUS 1 + 2 // bit 6 - ABUS 2 + }; + + for (int i = 0, j = 0x40; i < 7; i++, j >>= 1) + { + if (0 != (j & l_connectedXstps)) + { + TargetHandle_t l_connectedFab = + getConnectedPeerProc(i_chip->GetChipHandle(), + i<4 ? TYPE_XBUS : TYPE_ABUS, + l_positions[i]); + + if (NULL != l_connectedFab) + { + o_externalChips.push_back(l_connectedFab); + } + } + } + + // Read WOF value. + SCAN_COMM_REGISTER_CLASS * l_wof = i_chip->getRegister("TODWOF"); + o_rc |= l_wof->Read(); + + if(o_rc) + { + PRDF_ERR( "[GetCheckstopInfo] SCOM fail on 0x%08x rc=%x", + i_chip->GetId(), o_rc); + return o_rc; + } + + o_wofValue = (((uint64_t)l_wof->GetBitFieldJustified(0,32)) << 32) | + ((uint64_t)l_wof->GetBitFieldJustified(32,32)); + + return SUCCESS; + +} PRDF_PLUGIN_DEFINE( Proc, GetCheckstopInfo ); + +int32_t CoreConfigured(PrdfExtensibleChip * i_chip, + bool & o_isCoreConfigured) +{ + using namespace TARGETING; + + o_isCoreConfigured = false; + + TargetHandleList l_coreList = + PlatServices::getConnected(i_chip->GetChipHandle(), TYPE_EX); + + if (l_coreList.size() > 0) + o_isCoreConfigured = true; + + return SUCCESS; +} PRDF_PLUGIN_DEFINE(Proc, CoreConfigured); + +} // end namespace Proc +} // end namespace PRDF diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfP8SystemSpecific.C b/src/usr/diag/prdf/common/plat/pegasus/prdfP8SystemSpecific.C new file mode 100644 index 000000000..090770545 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/prdfP8SystemSpecific.C @@ -0,0 +1,43 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfP8SystemSpecific.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 */ + +#include <prdfSystemSpecific.H> + +#include <iipglobl.h> +#include <iipScanCommRegisterAccess.h> +#include <prdfPegasusConfigurator.H> +#include <prdfPlatServices.H> + + +namespace PrdfSystemSpecific +{ + PRDF::Configurator * getConfiguratorPtr() + { + return new PRDF::PegasusConfigurator; + } + + void postAnalysisWorkarounds(STEP_CODE_DATA_STRUCT & i_sdc) + { + return; + } +}; diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfPegasusConfigurator.C b/src/usr/diag/prdf/common/plat/pegasus/prdfPegasusConfigurator.C new file mode 100644 index 000000000..ea0fb5dd3 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/prdfPegasusConfigurator.C @@ -0,0 +1,298 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfPegasusConfigurator.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 */ + +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ + +#include <iipglobl.h> +#include <prdfPegasusConfigurator.H> +#include <prdfRuleFiles.H> + +#include <prdfRuleChip.H> +#include <iipDomainContainer.h> +#include <prdfScanFacility.H> +#include <iipResolutionFactory.h> + +#include <prdfFabricDomain.H> +#include <prdfExDomain.H> +#include <prdfMcsDomain.H> +#include <prdfMembufDomain.H> +#include <prdfMbaDomain.H> +#include <prdfPlatServices.H> +#include <iipSystem.h> +#include <prdrLoadChipCache.H> // To flush chip-file cache. + +namespace PRDF +{ + +//------------------------------------------------------------------------------ + +// Resolution for no chips at attention. +CallAttnResolution PegasusConfigurator::noAttnResolution; + +//------------------------------------------------------------------------------ +// Local Helper functions + +/** + * @brief Return max number of nodes in the system + * Note that Hostboot only has node view. + * @return max number of nodes + * always return 1 in Hostboot + */ +uint32_t _getMaxNumNodes() +{ + #ifdef __HOSTBOOT_MODULE + return 1; // only one node in Hostboot + #else + return MAX_NODE_PER_SYS; + #endif +} + +/** + * @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. + * Hostboot only has node view so it always returns 0. + */ +uint32_t _getNodePosition( TARGETING::TargetHandle_t i_pTarget ) +{ + using namespace TARGETING; + + uint32_t o_pos = 0; + + #ifndef __HOSTBOOT_MODULE + + o_pos = PlatServices::getNodePosition(i_pTarget); + + #endif + + return o_pos; +} + +//------------------------------------------------------------------------------ + +System * PegasusConfigurator::build() +{ + using namespace TARGETING; + + PRDF_ENTER( "PegasusConfigurator::build()" ); + + // Create System object to populate with domains. + System * l_system = new System(noAttnResolution); + + // Create domains. + FabricDomain * l_procDomain = new FabricDomain( FABRIC_DOMAIN ); + PrdfExDomain * l_exDomain = new PrdfExDomain( EX_DOMAIN ); + PrdfMcsDomain * l_mcsDomain = new PrdfMcsDomain( MCS_DOMAIN ); + PrdfMembufDomain * l_membufDomain = new PrdfMembufDomain( MEMBUF_DOMAIN ); + PrdfMbaDomain * l_mbaDomain = new PrdfMbaDomain( MBA_DOMAIN ); + + uint32_t l_maxNodeCount = _getMaxNumNodes(); + + // PLL domains + PllDomainList l_fabricPllDomains(l_maxNodeCount, NULL); + PllDomainList l_membPllDomains( l_maxNodeCount, NULL); + + // Add chips to domains. + addDomainChips( TYPE_PROC, l_procDomain, &l_fabricPllDomains ); + addDomainChips( TYPE_EX, l_exDomain ); + addDomainChips( TYPE_MCS, l_mcsDomain ); + addDomainChips( TYPE_MEMBUF, l_membufDomain, &l_membPllDomains ); + addDomainChips( TYPE_MBA, l_mbaDomain ); + + // Add Pll domains to domain list. + addPllDomainsToSystem( l_fabricPllDomains, l_membPllDomains ); + + // Add domains to domain list. NOTE: Order is important because this is the + // order the domains will be analyzed. + sysDmnLst.push_back( l_procDomain ); + sysDmnLst.push_back( l_exDomain ); + sysDmnLst.push_back( l_mcsDomain ); + sysDmnLst.push_back( l_membufDomain ); + sysDmnLst.push_back( l_mbaDomain ); + + // Add chips to the system. + Configurator::chipList & chips = getChipList(); + l_system->AddChips( chips.begin(), chips.end() ); + + // Add domains to the system. + Configurator::domainList & domains = getDomainList(); + l_system->AddDomains( domains.begin(), domains.end() ); + + PRDF_EXIT( "PegasusConfigurator::build()" ); + + return l_system; +} + +//------------------------------------------------------------------------------ + +void PegasusConfigurator::addDomainChips( TARGETING::TYPE i_type, + PrdfRuleChipDomain * io_domain, + PllDomainList * io_pllDomains ) +{ + using namespace TARGETING; + + int32_t l_rc = SUCCESS; + + // Get references to factory objects. + ScanFacility & scanFac = ScanFacility::Access(); + ResolutionFactory & resFac = ResolutionFactory::Access(); + + // Get rule filename based on type. + const char * fileName = ""; + switch ( i_type ) + { + case TYPE_PROC: fileName = PRDF::Proc; break; + case TYPE_EX: fileName = PRDF::Ex; break; + case TYPE_MCS: fileName = PRDF::Mcs; break; + case TYPE_MEMBUF: fileName = PRDF::Membuf; break; + case TYPE_MBA: fileName = PRDF::Mba; break; + + default: + // Print a trace statement, but do not fail the build. + PRDF_ERR( "[addDomainChips] Unsupported target type: %d", i_type ); + l_rc = FAIL; + } + + if ( SUCCESS == l_rc ) + { + // Get all targets of specified type and add to given domain. + TargetHandleList list = PlatServices::getFunctionalTargetList( i_type ); + for ( TargetHandleList::const_iterator itr = list.begin(); + itr != list.end(); ++itr ) + { + if ( NULL == *itr ) continue; + + PrdfRuleChip * chip = new PrdfRuleChip( fileName, *itr, + scanFac, resFac ); + sysChipLst.push_back( chip ); + io_domain->AddChip( chip ); + + // PLL domains + switch ( i_type ) + { + case TYPE_PROC: + addChipsToPllDomain(CLOCK_DOMAIN_FAB, + io_pllDomains, + chip, + *itr, + scanFac, + resFac); + break; + case TYPE_MEMBUF: + addChipsToPllDomain(CLOCK_DOMAIN_MEMBUF, + io_pllDomains, + chip, + *itr, + scanFac, + resFac); + break; + default: + break; + } + } + + // Flush rule table cache since objects are all built. + Prdr::LoadChipCache::flushCache(); + + } +} + +void PegasusConfigurator::addChipsToPllDomain( + DOMAIN_ID i_domainId, + PllDomainList * io_pllDomains, + PrdfRuleChip * i_chip, + TARGETING::TargetHandle_t i_pTarget, + ScanFacility & i_scanFac, + ResolutionFactory & i_resFac) +{ + using namespace TARGETING; + + do + { + uint32_t l_node = _getNodePosition(i_pTarget); + + // Fabric PLL - only one per node as all fabs on node have same clock source + if(NULL != io_pllDomains) + { + if(NULL == (*io_pllDomains)[l_node]) + { + if((CLOCK_DOMAIN_FAB == i_domainId) || + (CLOCK_DOMAIN_MEMBUF == i_domainId)) + { + Resolution & l_clock =(CLOCK_DOMAIN_FAB == i_domainId) ? + i_resFac.GetClockResolution(i_pTarget, TYPE_PROC) : + i_resFac.GetClockResolution(i_pTarget, TYPE_MEMBUF); + + #ifdef __HOSTBOOT_MODULE + (*io_pllDomains)[l_node] = new PllDomain( + i_domainId, l_clock, + ThresholdResolution::cv_pllDefault ); + #else + (*io_pllDomains)[l_node] = new PllDomain( + i_domainId, l_clock, CONTENT_HW, + ThresholdResolution::cv_pllDefault ); + #endif + } + else + { + PRDF_ERR( "[addChipsToPllDomain] Unsupported PLL Domain: " + "0x%08x", i_domainId ); + break; + } + } + + (*io_pllDomains)[l_node]->AddChip(i_chip); + } + + } while(0); +} + +void PegasusConfigurator::addPllDomainsToSystem( + PllDomainList & i_fabricPllDomains, + PllDomainList & i_membPllDomains) +{ + uint32_t l_maxNodeCount = _getMaxNumNodes(); + + //Add Fabric Pll Domains to the system. + for(uint32_t n = 0; n < l_maxNodeCount; ++n) + { + if(NULL != i_fabricPllDomains[n]) + { + sysDmnLst.push_back(i_fabricPllDomains[n]); + } + } + + //Add Membuf Pll Domains to the system. + for(uint32_t n = 0; n < l_maxNodeCount; ++n) + { + if(NULL != i_membPllDomains[n]) + { + sysDmnLst.push_back(i_membPllDomains[n]); + } + } +} + +} // End namespace PRDF diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfPegasusConfigurator.H b/src/usr/diag/prdf/common/plat/pegasus/prdfPegasusConfigurator.H new file mode 100644 index 000000000..4d442993b --- /dev/null +++ b/src/usr/diag/prdf/common/plat/pegasus/prdfPegasusConfigurator.H @@ -0,0 +1,124 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfPegasusConfigurator.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 prdfPegasusConfigurator_H +#define prdfPegasusConfigurator_H + +/** @file prdfPegasusConfigurator.H + * @brief Builds the PRD system model for Pegasus (P8 based systems). + */ + +#include <iipConfigurator.h> +#include <iipCallAttnResolution.h> // For CallAttnResolution +#include <prdfPllDomain.H> + +class PrdfRuleChipDomain; + +namespace PRDF +{ + +typedef std::vector< PRDF::PllDomain *> PllDomainList; +typedef std::vector< CHIP_CLASS *> PllChipList; + +/** @brief PRD configurator for Pegasus (P8 systems) */ +class PegasusConfigurator : public Configurator +{ + public: + + /** + * @brief Constructor + */ + PegasusConfigurator() : + Configurator( PrdfRuleChipDomain::TOTAL_CHIPS, + PrdfRuleChipDomain::TOTAL_DOMAINS ) + {} + + /** + * @brief Destructor + * @note This configurator does not delete the objects it created during + * build(); that is the responsibility of the system object. + */ + ~PegasusConfigurator() {} + + /** + * @brief Create the PRD system object, all chip instances, and all domain + * instances. + * @return Pointer to configured system. + * @note The caller of this function owns the responsiblity of deleting + * the system object created. + */ + virtual System * build(); + + private: // functions + + /** @brief Copy not allowed. */ + PegasusConfigurator( const PegasusConfigurator & right ); + + /** @brief Assignment not allowed. */ + const PegasusConfigurator & operator=( const PegasusConfigurator & right ); + + /** + * @brief Will add all chips of a given type to a domain. + * @parm i_type The specified target type. + * @parm io_domain The associated domain. + * @parm io_pllDomains The associated PLL domain (optional for some) + */ + void addDomainChips( TARGETING::TYPE i_type, + PrdfRuleChipDomain * io_domain, + PllDomainList * io_pllDomains = NULL ); + + /** + * @brief Add chip to its Pll Domain. + * @param i_domainId - Domain Id (CLOCK_DOMAIN_FAB/_MEMBUF) + * @param i_fabricPllDomains - List of Pll Domains + * @param i_chip - Pointer to chip. + * @param i_pTarget - chip target. + * @param i_scanFac - Scan Facility. + * @param i_resFac - Resolution Factory. + */ + void addChipsToPllDomain( + DOMAIN_ID i_domainId, + PllDomainList * io_fabricPllDomains, + PrdfRuleChip * i_chip, + TARGETING::TargetHandle_t i_pTarget, + ScanFacility & i_scanFac, + ResolutionFactory & i_resFac); + + /** + * @brief Add Pll Domains to the System. + * @param i_fabricPllDomains - List of Fabric Pll Domains + * @param i_membPllDomains - List of Membuf Pll Domains + */ + void addPllDomainsToSystem( + PllDomainList & i_fabricPllDomains, + PllDomainList & i_membPllDomains); + + private: // data + + static CallAttnResolution noAttnResolution; + +}; + +} // End namespace PRDF + +#endif diff --git a/src/usr/diag/prdf/common/plat/prdfL3Table.C b/src/usr/diag/prdf/common/plat/prdfL3Table.C new file mode 100755 index 000000000..5bacecb2b --- /dev/null +++ b/src/usr/diag/prdf/common/plat/prdfL3Table.C @@ -0,0 +1,81 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/prdfL3Table.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 prdfL3Table.C + @brief description +*/ +//------------------------------------------------------------------------------------------------- +// Includes +//------------------------------------------------------------------------------------------------- +#define prdfL3Table_C + +#include <prdfL3Table.H> + +#undef prdfL3Table_C +//------------------------------------------------------------------------------------------------- +// User Types, Constants, macros, prototypes, globals +//------------------------------------------------------------------------------------------------- + +//------------------------------------------------------------------------------------------------- +// Member Function Specifications +//------------------------------------------------------------------------------------------------- + +//------------------------------------------------------------------------------------------------- + +int32_t prdfL3TableAdd(TARGETING::TargetHandle_t i_pl3targetHandle, uint32_t address) +{ + int32_t rc = 0; + return rc; +} + +//------------------------------------------------------------------------------------------------- + +void prdfL3TableGet(TARGETING::TargetHandle_t i_pl3targetHandle, uint32_t table[LineDeleteTableSize]) +{ +} + +//------------------------------------------------------------------------------------------------- + +int32_t prdfL3TableCount(TARGETING::TargetHandle_t i_pl3targetHandle) +{ + int32_t rc = 0; + return rc; +} + +//------------------------------------------------------------------------------------------------- + +errlHndl_t prdfL3LineDelete(TARGETING::TargetHandle_t i_pl3targetHandle, uint32_t address) +{ + return NULL; +} + +//------------------------------------------------------------------------------------------------- + +// Change Log ************************************************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- ------ ------- -------- -------- ------------------------------------------------------- +// 485074 fips310 12/14/04 dgilbert Initial Creation +// +// End Change Log ********************************************************************************* diff --git a/src/usr/diag/prdf/common/plat/prdfL3Table.H b/src/usr/diag/prdf/common/plat/prdfL3Table.H new file mode 100755 index 000000000..6414f82b5 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/prdfL3Table.H @@ -0,0 +1,113 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/prdfL3Table.H $ */ +/* */ +/* 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 */ + +#ifndef PRDFL3TABLE_H +#define PRDFL3TABLE_H +/** + @file prdfL3Table.H + @brief Description +*/ + + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#include <stdint.h> +#include <targeting/common/target.H> +#include <errlentry.H> + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +enum l3TableEnum +{ + LineDeleteTableSize = 10, ///< Size of line delete table + TableSizeBytes = LineDeleteTableSize*4, // wl01 + allFox = 0xffffffff, ///< uint of -1 + l3AddressMask = 0x007ffff0 +}; + + /** + Add a cache line address to the cache line delete table + <ul> + <br><b>Parameters: </b> L3 target Handle, cacheline address in format from ReadDataErLg2 register + <br><b>Returns: </b> 0 = address already in table, 1-LineDeleteTableSize = position added to table, LineDeleteTableSize + 1 = table overflow + <br><b>Requirements:</b> preconditions + <br><b>Promises: </b> postconditions + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> + </ul><br> +*/ +extern int32_t prdfL3TableAdd(TARGETING::TargetHandle_t i_pl3targetHandle, uint32_t address); + + /** + Copies the line delete table to memory address passed in + <ul> + <br><b>Parameters: </b> L3 target Handle, address of int32[10] + <br><b>Returns: </b> returns void + <br><b>Requirements:</b> preconditions + <br><b>Promises: </b> postconditions + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> + </ul><br> +*/ +extern void prdfL3TableGet(TARGETING::TargetHandle_t i_pl3targetHandle, uint32_t table[LineDeleteTableSize]); + + /** + Get the count of line deletes in the table + <ul> + <br><b>Parameters: </b> L3 target Handle + <br><b>Returns: </b> returns the number of line deletes in the table + <br><b>Requirements:</b> preconditions + <br><b>Promises: </b> postconditions + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> + </ul><br> +*/ +extern int32_t prdfL3TableCount(TARGETING::TargetHandle_t i_pl3targetHandle); + + /** + Makes the call to DA to do the line delete + <ul> + <br><b>Parameters: </b> L3 target Handle, cacheline address in format from ReadDataErLg2 register + <br><b>Returns: </b> returns return code from D/a + <br><b>Requirements:</b> preconditions + <br><b>Promises: </b> postconditions + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> + </ul><br> +*/ +extern errlHndl_t prdfL3LineDelete(TARGETING::TargetHandle_t i_pl3targetHandle, uint32_t address); + + +#endif /* PRDFL3TABLE_H */ + +// Change Log ***************************************************************** +// +// Flag Reason Vers Date Coder Description +// ---- ------ -------- -------- -------- ------------------------------------ +// 485074 fips310 12/14/04 dgilbert Initial Creation from prdfGrL3Table.H +// +// End Change Log ************************************************************* diff --git a/src/usr/diag/prdf/common/plat/prdfLineDelete.C b/src/usr/diag/prdf/common/plat/prdfLineDelete.C new file mode 100755 index 000000000..a3f669918 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/prdfLineDelete.C @@ -0,0 +1,249 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/prdfLineDelete.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2005,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 prdfLineDelete.C + * Contains the definitions needed for the line delete algorithms and the CE + * table. + */ + + +#include <prdfLineDelete.H> +#include <iipServiceDataCollector.h> +#include <prdfBitString.H> + +// See prdfLineDelete.H for full function documentation. +namespace PrdfLineDelete +{ + + /* PrdfCacheCETable::addAddress + * Insert address into CE table. + */ + bool PrdfCacheCETable::addAddress( PrdfCacheAddress i_addr, + STEP_CODE_DATA_STRUCT & i_sdc ) + { + // Get the time of the current error. + PrdTimer timeOfError = i_sdc.service_data->GetTOE(); + + // Check if time interval has elapsed. If so, flush the table. + if ( (timeOfError > cv_flushTimer) || !cv_flushTimerInited ) + { + this->flushTable(); + cv_flushTimer = timeOfError + iv_thPolicy.interval; + cv_flushTimerInited = true; + } + + // Increment address hit count and total table count. + uint32_t count = ++cv_ceTable[i_addr]; + cv_total++; + + // Return whether the address threshold has been reached or not. + return ( iv_thPolicy.threshold <= count ); + } + + /* PrdfCacheCETable::isIntervalElapsed() + */ + bool PrdfCacheCETable::isIntervalElapsed( STEP_CODE_DATA_STRUCT & i_sdc ) + { + bool o_rc = false; + if ( cv_flushTimerInited ) + o_rc = ( i_sdc.service_data->GetTOE() > cv_flushTimer ); + return o_rc; + } + + /* PrdfCacheCETable::flushTable() + * Clear all entries from CE table. + */ + void PrdfCacheCETable::flushTable() + { + // wipe interval timer and clear all hits. + cv_flushTimerInited = false; + cv_ceTable.clear(); + cv_total = 0; + } + + /* PrdfCacheCETable::getTotalCount() + * Clear all CE hits from the table and reset timer to 0. + */ + uint32_t PrdfCacheCETable::getTotalCount() // zs01 + { + return cv_total; + } + + /* PrdfCacheCETable::addToCaptureData() + * Will add CE table to the capture data. + */ + void PrdfCacheCETable::addToCaptureData(TARGETING::TargetHandle_t i_pchipHandle, int32_t i_scomId, + CaptureData & io_cd) // zs02 + { + const uint32_t l_maxEntries + = CaptureData::MAX_ENTRY_SIZE / (2 * sizeof(uint32_t)); + + uint32_t l_entryTable[l_maxEntries * 2]; + uint32_t l_entryIndex = 0; + + // Loop on all entries in CE table. + for (PrdfCacheAddressTable::iterator i = cv_ceTable.begin(); + i != cv_ceTable.end(); ++i) + { + // Add entry to table. + l_entryTable[2 * l_entryIndex] = i.first(); + l_entryTable[2 * l_entryIndex + 1] = i.second(); + + // Check if entry chunk is filled, or reached the end of entries. + if ( ( l_maxEntries == (l_entryIndex + 1) ) || + ( (i + 1) == cv_ceTable.end() ) ) + { + // Add chunk to capture data. + BIT_STRING_ADDRESS_CLASS l_entryChunk( 0, + ( ( (l_entryIndex + 1) * (2 * sizeof(uint32_t)) ) * 8 ), + (CPU_WORD*) l_entryTable ); + io_cd.Add(i_pchipHandle, i_scomId, l_entryChunk); + } + + // Increment entry ID. + l_entryIndex = (l_entryIndex + 1) % l_maxEntries; + } + } + + /* PrdfCacheCETable::getLargestEntry + * Will search the PrdfCacheCETable for the address with the largest count + */ + PrdfCacheAddress PrdfCacheCETable::getLargestEntry( uint32_t * o_count ) + { + PrdfCacheAddress largestEntry = 0; + uint32_t highestCount = 0; + + // Loop on all entries in CE table. + for (PrdfCacheAddressTable::iterator i = cv_ceTable.begin(); + i != cv_ceTable.end(); ++i) + { + if ( i.second() > highestCount ) + { + largestEntry = i.first(); + highestCount = i.second(); + + if (o_count != NULL) + (*o_count) = highestCount; + } + } + + return largestEntry; + } + + /* PrdfCacheCETable::getTableSize + */ + uint32_t PrdfCacheCETable::getTableSize() //zs04 + { + return cv_ceTable.size(); + } + + //mp26 a + /* PrdfCacheCETable::getCRCAnalysisEntries + * Will search the PrdfCacheCETable for the address with the largest count + * Also returns highest, second highest, and lowest count values + */ + + //NOTE: need to make sure table size is not zero before calling this function. + PrdfCacheAddress PrdfCacheCETable::getCRCAnalysisEntries( + uint32_t & o_countHigh, + uint32_t & o_count2ndHigh, + uint32_t & o_countLow) + { + PrdfCacheAddress largestEntry = 0; + + do + { + + PrdfCacheAddressTable::iterator i = cv_ceTable.begin(); + + // Initialize the counts to the value of the first entry. + largestEntry = i.first(); + o_countHigh = i.second(); + o_count2ndHigh = 0; + o_countLow = 0; + + if ( 1 == getTableSize() ) break; // only one entry + + ++i; // There are at least two entries, start at the second. + + // Initialize 2nd highest count and low count. + if ( i.second() > o_countHigh ) + { + o_count2ndHigh = o_countHigh; + o_countLow = o_countHigh; + + largestEntry = i.first(); + o_countHigh = i.second(); + } + else + { + o_count2ndHigh = i.second(); + o_countLow = i.second(); + } + + // Loop on all entries in CE table. + ++i; // Start at third entry. + // Note: loop will exit immediately if the table count is 2. + for ( ; i != cv_ceTable.end(); ++i ) + { + // Get highest count. + if ( i.second() > o_countHigh ) + { + o_count2ndHigh = o_countHigh; + + largestEntry = i.first(); + o_countHigh = i.second(); + } + // Get second highest count. + else if ( (i.second() > o_count2ndHigh) && + (i.second() <= o_countHigh) ) + { + o_count2ndHigh = i.second(); + } + // Get lowest count. + else if ( i.second() < o_countLow ) + { + o_countLow = i.second(); + } + } + + } while (0); + + return largestEntry; + } +}; + + + +// Change Log ****************************************************************** +// +// Flag Reason Vers Date Coder Description +// ---- ------- ---- -------- -------- ----------------------------------------- +// F522128 f300 09/22/05 iawillia Initial File Creation +// zs01 F565934 f310 09/06/06 zshelle Adding getTotalCount() +// zs02 d573288 f310 10/05/06 zshelle Adding addToCaptureData() +// zs03 588751 f310 03/12/07 zshelle Adding getLargestEntry() +// zs04 633659 f340 04/11/08 zshelle Add getEntryCount() and getTableSize() +// mp26 F750906 f720 plute Add getCRCAnalysisEntries +// +// End Change Log ************************************************************** diff --git a/src/usr/diag/prdf/common/plat/prdfLineDelete.H b/src/usr/diag/prdf/common/plat/prdfLineDelete.H new file mode 100755 index 000000000..8c7d3c80c --- /dev/null +++ b/src/usr/diag/prdf/common/plat/prdfLineDelete.H @@ -0,0 +1,191 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/prdfLineDelete.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2005,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 prdfLineDelete.H + * Contains the definitions needed for the line delete algorithms and the CE + * table. + */ + +#ifndef __PRDFLINEDELETE_H +#define __PRDFLINEDELETE_H + +#include <UtilSMap.H> +#include <prdfThresholdResolutions.H> +#include <iipstep.h> +#include <iipCaptureData.h> + +/** @namespace PrdfLineDelete + * Namespace to encapsulate all of the LineDelete specific classes and enums. + */ +namespace PrdfLineDelete +{ + + /** @enum PrdfCacheType + * Used to express where a cache error occured. + */ + enum PrdfCacheType + { + L3 = 0, + L3_DIR = 1, + L2 = 2, + L2_DIR = 4, + CACHE_MASK = L3 | L3_DIR | L2 | L2_DIR, + + SLICE_A = 8, + SLICE_B = 16, + SLICE_MASK = SLICE_A | SLICE_B + }; + + /** @enum PrdfCacheErrorType + * Used to express the types of cache errors that can occur. + */ + enum PrdfCacheErrorType + { + UE, CE + }; + + /** @typedef PrdfCacheAddress + * Used to index cache error hits in the CE table. + */ + typedef uint32_t PrdfCacheAddress; + + /** @typedef PrdfCacheAddressTable + * Maps Cache Addresses to hit counts. + */ + typedef UtilSMap<PrdfCacheAddress, uint32_t> PrdfCacheAddressTable; + + /** @class PrdfCacheCETable + * Used to store and threshold cache CE errors. + * + * Takes a threshold policy (such as "2 per day") and allows that many hits + * per address before signalling "at threshold". (the 2nd occurance would + * be the at threshold). + * + * @note This is now being used for eRepair as well as cache CEs. + */ + class PrdfCacheCETable + { + public: + + /** + * @brief Constructor from ThresholdPolicy struct. + * @param i_thPolicy A pointer to a ThresholdPolicy struct. + */ + explicit PrdfCacheCETable( + const ThresholdResolution::ThresholdPolicy & i_thPolicy ) : + iv_thPolicy(i_thPolicy), cv_flushTimerInited(false), cv_total(0) + {} + + // NOTE: iv_thPolicy should never be deleted in this class so the + // default destructor will be sufficient. + + /** @fn addAddress + * Insert an address into the CE table. + * + * @param The CE address. + * @param The Service Data Collector to get the current time. + * + * @return true - if the threshold policy has been reached. + * @return false - if the threshold policy has not been reached. + */ + bool addAddress(PrdfCacheAddress, STEP_CODE_DATA_STRUCT &); + + /** @fn PrdfCacheCETable::isIntervalElapsed() + * @param STEP_CODE_DATA_STRUCT & i_sdc + * @return TRUE if the interval time has elapsed. + */ + bool isIntervalElapsed( STEP_CODE_DATA_STRUCT & i_sdc ); + + /** @fn flushTable + * Clear all CE hits from the table and reset timer to 0. + */ + void flushTable(); + + /** @fn getTotalCount + * Returns the total amount of CE hits in a table + * + * @return uint32_t - the total CE hits in a table + */ + uint32_t getTotalCount(); //zs01 + + /** @fn addToCaptureData + * Adds CE table to the capture data. + * + * @param The chip Handle. + * @param The scom id. + * @param The Service Data Collector. + */ + void addToCaptureData(TARGETING::TargetHandle_t i_pchipHandle, int32_t, CaptureData &); // zs02 + + /** @fn getLargestEntry + * @brief Will search the PrdfCacheCETable for the address with the + * largest count. + * @param The count of the highest entry (default = NULL). + * @return Address with the largest count. + */ + PrdfCacheAddress getLargestEntry( uint32_t * o_count = NULL ); + + /** @fn PrdfCacheCETable::getTableSize + * @return uint32_t - The total number of entries in the table + */ + uint32_t getTableSize(); //zs04 + + //mp26 a + /** @fn getCRCAnalysisEntries + * @brief Will search the PrdfCacheCETable for the different count + * values.. + * @param Output the highest count.. + * @param Output the second highest count.. + * @param Output the lowest count.. + * @return Address with the largest count. + */ + PrdfCacheAddress getCRCAnalysisEntries( + uint32_t & o_countHigh, + uint32_t & o_count2ndHigh, + uint32_t & o_countLow); + + private: + + const ThresholdResolution::ThresholdPolicy iv_thPolicy; + PrdfCacheAddressTable cv_ceTable; + PrdTimer cv_flushTimer; + bool cv_flushTimerInited; + uint32_t cv_total; //zs01 + + }; + +}; +#endif + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// F522128 f300 09/22/05 iawillia Initial File Creation +// zs01 F565934 f310 09/06/06 zshelle Adding getTotalCount() +// zs02 d573288 f310 10/05/06 zshelle Adding addToCaptureData() +// zs03 588751 f310 03/12/07 zshelle Adding getLargestEntry() +// zs04 633659 f340 04/11/08 zshelle Add getEntryCount() and getTableSize() +// mp26 F750906 f720 plute Add getCRCAnalysisEntries +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/plat/prdfMemoryMru.C b/src/usr/diag/prdf/common/plat/prdfMemoryMru.C new file mode 100755 index 000000000..092f1832c --- /dev/null +++ b/src/usr/diag/prdf/common/plat/prdfMemoryMru.C @@ -0,0 +1,38 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/prdfMemoryMru.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2008,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 */ + +#include <prdfMemoryMru.H> + +//------------------------------------------------------------------------------ + +#ifndef CONTEXT_x86_nfp + +TARGETING::TargetHandleList PrdfMemoryMru::getCalloutList() const +{ + TARGETING::TargetHandleList o_dimmList; + + return o_dimmList; +} + +#endif + diff --git a/src/usr/diag/prdf/common/plat/prdfMemoryMru.H b/src/usr/diag/prdf/common/plat/prdfMemoryMru.H new file mode 100755 index 000000000..c501e0939 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/prdfMemoryMru.H @@ -0,0 +1,111 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/prdfMemoryMru.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2008,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 prdfMemoryMru_H +#define prdfMemoryMru_H + +/** @file prdfMemoryMru.H + */ + +#include <stdint.h> + +#ifndef CONTEXT_x86_nfp + #include <targeting/common/target.H> +#endif + +class PrdfMemoryMru +{ + public: + + /** + * @brief Used to specify the PrdfMemoryMru type. + * + * One requirement for all memory MRUs is that it must be able to be + * converted into a 32-bit representation of the object. This number is then + * passed around is different places, one in particular is word 9 of the + * SRC. Eventually, data will need to be retrieved from the number. Since + * the structure of each memory MRU may change, bits[0:2] of the 32-bit + * number is reserved for the version type of the memory MRU. Based on the + * version a new memory MRU can be constructed. + * + * NOTE: The reason MEMMRU_ECLIPZ starts with 3 is because in the original + * P6 memory MRU there was a 4-bit field for the version type in which + * the value was 6 (for P6). To save as much space as possible the + * version field was reduced to 3 bits and the P6 version as changed + * to 3. Thus, saving a bit of space without compromising the value of + * that field. + */ + enum PrdfMemMruVersion + { + MEMMRU_INVALID = 0, ///< An invalid memory MRU + MEMMRU_ECLIPZ = 3, ///< A P6 MC memory MRU + MEMMRU_APOLLO = 5, ///< A P7 MC memory MRU + }; + + public: + + /** + * @brief Default contructor. + */ + PrdfMemoryMru() : iv_memMruUint32( 0 ) {} + + /** + * @brief Constructor from 32-bit representation of a memory MRU. + * @param i_memMruUint32 A 32-bit representation of a memory MRU. + */ + explicit PrdfMemoryMru( uint32_t i_memMruUint32 ) : + iv_memMruUint32( i_memMruUint32 ) + {} + + /** + * @brief Default destructor. + */ + virtual ~PrdfMemoryMru() {} + + /** + * @brief Returns the 32-bit representation of this memory MRU. + * @return The 32-bit representation of this memory MRU. + */ + virtual uint32_t toUint32() const + { return iv_memMruUint32; } + +#ifndef CONTEXT_x86_nfp + + /** + * @brief Returns a list of targets that are represented by this + * memory MRU. + * @return The number of targets in the callout list is returned. + */ + virtual TARGETING::TargetHandleList getCalloutList() const; + +#endif + + private: + + /** The 32-bit representation of this memory MRU. */ + uint32_t iv_memMruUint32; + +}; + +#endif /* prdfMemoryMru_H */ + diff --git a/src/usr/diag/prdf/common/plat/prdfRepairHealth.C b/src/usr/diag/prdf/common/plat/prdfRepairHealth.C new file mode 100755 index 000000000..11d244701 --- /dev/null +++ b/src/usr/diag/prdf/common/plat/prdfRepairHealth.C @@ -0,0 +1,69 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/prdfRepairHealth.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2009,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 */ + +#include <prdfRepairHealth.H> +#include <svpdextstructs.H> +#include <svpdextinterface.H> + +//#include <prdfP7McRepairHealth.H> + +tracDesc_t g_asmTracDesc; +TRAC_INIT( &g_asmTracDesc, PRDF_COMP_NAME, 4096 ); + +/* prdfGetRepairHealthStatus + * Get repair objects for FRU. + */ +errlHndl_t prdfGetRepairHealthStatus(uint32_t i_rid, + std::vector<PrdfRepairHealthStatus> & o_repairs) +{ + o_repairs.clear(); + + errlHndl_t l_errl = NULL; +/* + svpd_FruEnum l_fruType; + + do + { + + // Determine RID's FRU type. + l_errl = SVPD_get_frutype(i_rid, &l_fruType); + if (NULL != l_errl) break; + + switch(l_fruType) + { + case FRU_MS: + prdfP7McGetDimmRepairHealthStatus( i_rid, o_repairs ); + break; + + case FRU_PF: + prdfP7McGetInterfaceRepairHealthStatus( i_rid, o_repairs); + break; + + default: + break; + } + } while (false); +*/ + return l_errl; +} + diff --git a/src/usr/diag/prdf/common/plat/prdfRepairHealth.H b/src/usr/diag/prdf/common/plat/prdfRepairHealth.H new file mode 100755 index 000000000..4c3bee42c --- /dev/null +++ b/src/usr/diag/prdf/common/plat/prdfRepairHealth.H @@ -0,0 +1,216 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/prdfRepairHealth.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2009,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 prdfRepairHealth.H + * @brief Defines interfaces to get applied repairs and health for a FRU, such + * as a DIMM. + */ +#ifndef __PRDF_PRDFREPAIRHEALTH_H +#define __PRDF_PRDFREPAIRHEALTH_H + +#include <vector> +#include <algorithm> + +#include <errlentry.H> + +// NOTE: Cannot use utilities prdfTrace.H because this code is pulled into +// libprdf_asm.so which is a very limited environment. +extern tracDesc_t g_asmTracDesc; + +// Forward declaration. +class PrdfRepairHealthStatus; + +/** @fn prdfGetRepairHealthStatus + * @brief Get the repair / health information for a RID. + * + * @param i_rid - The RID to get health information on. + * @param o_repairs - Vector containing RepairHealthStatus objects found for + * the RID. + * + * @return NULL or error log. + * + * The vector returned can contain information about many repairs, each in + * their own object. These repairs may even be of the same type but will have + * a unique identifier. For instance, a DIMM RID might return a set of "Chip + * Marks" for each "Rank" in the DIMM, a set of "Symbol Marks" for each "Rank" + * in the DIMM, and a single "DRAM Steer" for the entire DIMM. + * + * RID types presently supported: + * - DIMMs. + */ +errlHndl_t prdfGetRepairHealthStatus(uint32_t i_rid, + std::vector<PrdfRepairHealthStatus> & o_repairs); + +/** @class PrdfRepairHealthStatus + * @brief Holds information about a particular repair. + * + * A particular repair contains: + * - An identifier of the type of repair this is. + * - A set of identifying information about the repair. + * - A maximum and currently applied repair count. + * + * The identifying information about a repair can be of various amounts + * depending on the type of repair. For instance, a DIMM "Chip Mark" may only + * list the DIMM "Rank" while a "Bus eRepair" might have "Bus Direction" and + * two or more associated FRU identifiers. + * + * @note The identifiers for Interface eRepair are not finalized. Support for + * this is not until 7.2. + */ +class PrdfRepairHealthStatus +{ + public: + /** Types of repairs possible. */ + enum RepairTypes + { + /** UNKNOWN / Default Repair */ + PRDF_REPAIR_UNKNOWN, + /** DIMM Chip Mark */ + PRDF_REPAIR_CHIP_MARK, + /** DIMM Symbol Mark */ + PRDF_REPAIR_SYMBOL_MARK, + /** DIMM Spare DRAM Steer - not supported on all DIMMs */ + PRDF_REPAIR_SPARE_DRAM_STEER, + /** Inter-chip Bus Repair (eRepair) */ + PRDF_REPAIR_INTERFACE_REPAIR, + }; + + /** Types of associated identifying information */ + enum RepairIdentifiers + { + /** DIMM Rank ID */ + PRDF_REPAIR_ID_RANK, + /** Inter-chip Bus Repair - Bus Direction */ + PRDF_REPAIR_ID_BUS_DIRECTION, + /** Inter-chip Bus Repair - Upstream Chip */ + PRDF_REPAIR_ID_BUS_UPSTREAM_CHIP, + //** Inter-chip Bus Repair - Memory Controller Sequence*/ + PRDF_REPAIR_ID_BUS_MC_SEQUENCE, + //** Inter-chip Bus Repair - Memory Controller Channel*/ + PRDF_REPAIR_ID_BUS_MC_CHANNEL, + //** Inter-chip Bus Repair - Bus Repair Bit*/ + PRDF_REPAIR_ID_BUS_REPAIR_BIT, + //** Inter-chip Bus Repair - Clock Repaired*/ + PRDF_REPAIR_ID_BUS_CLOCK_REPAIRED, + }; + + /** Structure to hold associated identifying information */ + struct RepairId + { + RepairIdentifiers idType; + uint32_t id; + }; + + public: + /** Default constructor */ + PrdfRepairHealthStatus() : iv_repairType(PRDF_REPAIR_UNKNOWN), + iv_repairIdsCount(0), + iv_repairIds(NULL), + iv_repairsAllowed(0), + iv_repairsPresent(0) {}; + /** Copy constructor */ + PrdfRepairHealthStatus(const PrdfRepairHealthStatus & copy) + : iv_repairType(copy.iv_repairType), + iv_repairIdsCount(copy.iv_repairIdsCount), + iv_repairsAllowed(copy.iv_repairsAllowed), + iv_repairsPresent(copy.iv_repairsPresent) + { + // Copy the identfying info array into new object. + if (NULL == copy.iv_repairIds) + iv_repairIds = NULL; + else + { + iv_repairIds = new RepairId[iv_repairIdsCount]; + + std::copy(copy.iv_repairIds, + ©.iv_repairIds[iv_repairIdsCount], + iv_repairIds); + } + } + /** Destructor */ + ~PrdfRepairHealthStatus() + { + // Clean up the identifying info array. + if (NULL != iv_repairIds) + { + delete [] iv_repairIds; + iv_repairIds = NULL; + } + } + + // ---- External interfaces ---- // + /** Return the type of repair. */ + RepairTypes getRepairType() const { return iv_repairType; } + /** Return the number of associated identifying infos. */ + size_t getRepairIdsCount() const { return iv_repairIdsCount; } + /** @fn getRepairIds + * + * @brief Return pointer to associated identifying info array. + * @note This pointer should NOT be deleted by the caller. It is + * owned by this object. */ + const RepairId * getRepairIds() const { return iv_repairIds; } + /** Return maximum number of repairs allowed of this type / id */ + size_t getRepairsAllowed() const { return iv_repairsAllowed; } + /** Return current number of repairs of this type / id */ + size_t getRepairsPresent() const { return iv_repairsPresent; } + + protected: + /* ---- Interfaces for assigning contents. ---- + * These are defined protected so that only inheriting classes can + * used these. Design is that a repair type will define a "builder" + * class that has a constructor with the parameters to complete this + * object and fill in the extra identifying information. + */ + /** Assign repair type */ + void setRepairType(RepairTypes i_repairType) + { iv_repairType = i_repairType; } + /** @fn setRepairIds + * + * @brief Assign identifying info + * @param i_repairIds - This must be allocated using the new[] and + * ownership of the memory transfers to this object. + */ + void setRepairIds(size_t i_repairIdsCount, RepairId * i_repairIds) + { iv_repairIdsCount = i_repairIdsCount; + iv_repairIds = i_repairIds; } + /** Assign max / current repair counts */ + void setRepairCounts(size_t i_allowed, size_t i_present) + { iv_repairsAllowed = i_allowed; + iv_repairsPresent = i_present; }; + + private: + /** Repair type */ + RepairTypes iv_repairType; + + /** Extra identifying info count */ + size_t iv_repairIdsCount; + /** Extra identifying info array */ + RepairId * iv_repairIds; + + /** Maximum repair count. */ + size_t iv_repairsAllowed; + /** Current repair count. */ + size_t iv_repairsPresent; +}; + +#endif diff --git a/src/usr/diag/prdf/common/plat/prdfTOD.H b/src/usr/diag/prdf/common/plat/prdfTOD.H new file mode 100755 index 000000000..de1875d5b --- /dev/null +++ b/src/usr/diag/prdf/common/plat/prdfTOD.H @@ -0,0 +1,57 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/plat/prdfTOD.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2010,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 PRDFTOD_H +#define PRDFTOD_H + + +/** @struct PrdfTodFaultData + * TOD Fault isolation information from a chip. + */ +struct PrdfTodFaultData +{ + TARGETING::TargetHandle_t source_chipHandle; + bool phyp_fault; + bool topo_fault[2]; // 0 is active, 1 is backup + bool topo_fault_clock[2]; + TARGETING::TargetHandle_t topo_fault_chip[2]; +}; + +int32_t prdfTorrent_TodCaptureRegisters(STEP_CODE_DATA_STRUCT & i_stepcode); +int32_t prdfTorrent_TodCleanUpErrors(STEP_CODE_DATA_STRUCT & i_stepcode); +int32_t prdfTorrent_TodCollectFaultDataSys(vector<PrdfTodFaultData> & o_faults, + STEP_CODE_DATA_STRUCT & i_stepcode); +int32_t prdfTorrent_TodCollectFaultDataChip(PrdfExtensibleChip * i_chip, + vector<PrdfTodFaultData> & o_faults, + STEP_CODE_DATA_STRUCT & i_stepcode); + + +int32_t prdfP7_TodCaptureRegisters(STEP_CODE_DATA_STRUCT & i_stepcode); +int32_t prdfP7_TodCleanUpErrors(STEP_CODE_DATA_STRUCT & i_stepcode); +int32_t prdfP7_TodCollectFaultDataSys(vector<PrdfTodFaultData> & o_faults, + STEP_CODE_DATA_STRUCT & i_stepcode); +int32_t prdfP7_TodCollectFaultDataChip(PrdfExtensibleChip * i_chip, + vector<PrdfTodFaultData> & o_faults, + STEP_CODE_DATA_STRUCT & i_stepcode); + +#endif //PRDFTOD_H diff --git a/src/usr/diag/prdf/common/prd_framework.mk b/src/usr/diag/prdf/common/prd_framework.mk new file mode 100755 index 000000000..efc224024 --- /dev/null +++ b/src/usr/diag/prdf/common/prd_framework.mk @@ -0,0 +1,140 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/prd_framework.mk $ +# +# IBM CONFIDENTIAL +# +# COPYRIGHT International Business Machines Corp. 2005,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 + +# Object files for prd shared library + +######## Framework ######## + +prd_framework = \ + iipTemplates.o \ + prdfTrace.o \ + prdfMain.o + +prd_framework_includes = \ + prdfMain.H \ + prdf_service_codes.H + +######## Util ######## + +prd_util = \ + prdfBitString.o \ + prdfBitKey.o \ + iipdgtb.o \ + iipdigit.o \ + prdfErrlSmartPtr.o \ + prdfFilters.o \ + prdfAssert.o + +prd_util_includes = \ + prdfCompressBuffer.H + +######## Config ######## + +prd_config = \ + iipchip.o \ + iipConfigurator.o \ + iipDomain.o \ + iipDomainContainer.o \ + prdfFabricDomain.o \ + prdfParentDomain.o \ + prdfRuleChipDomain.o \ + prdfPllDomain.o \ + iipSystem.o \ + prdfExtensibleDomain.o \ + +prd_config_FSP = \ + prdfChipPersist.o \ + prdfSystemData.o + +prd_config_includes = \ + +######## Service ######## + +prd_service = \ + prdfServiceDataCollector.o \ + prdf_ras_services.o \ + prdfTargetServices.o \ + xspprdsdbug.o + +prd_service_FSP = \ + prdfSdcFileControl.o + +prd_service_includes = \ + +######## Platform Specfic Services ######## + +prd_env_service = \ + prdfHomRegisterAccess.o \ + prdfPlatServices.o + +prd_env_service_includes = \ + +######## Chip ######## + +prd_ss = \ + prdfMemoryMru.o + +prd_ss_includes = \ + prdfMemoryMru.H \ + prdfRepairHealth.H + +######## Resolution ######## + +prd_resolution = \ + iipResolution.o \ + iipResolutionFactory.o \ + prdfResolutionMap.o \ + prdfThresholdResolutions.o \ + xspprdDumpResolution.o \ + xspprdFlagResolution.o \ + xspprdGardResolution.o \ + prdfClockResolution.o \ + prdfCaptureResolution.o + +prd_resolution_includes = \ + +######## Register ######## + +prd_register = \ + iipscr.o \ + prdfErrorRegister.o \ + prdfErrorRegisterMask.o \ + iipMopRegisterAccess.o \ + prdfResetErrorRegister.o \ + iipScanCommRegisterAccess.o \ + iipScanCommRegisterChip.o \ + prdfCaptureData.o \ + prdfScanFacility.o + +prd_register_includes = \ + +######## Threshold ######## + +prd_mnfgtools = \ + prdfMfgThresholdFile.o \ + prdfMfgThresholdMgr.o \ + prdfMesThresholds.o + +prd_mnfgtools_includes = \ + prdfMfgThresholds.H \ + prdfMesThresholds.H diff --git a/src/usr/diag/prdf/common/prd_pegasus.mk b/src/usr/diag/prdf/common/prd_pegasus.mk new file mode 100755 index 000000000..f07df82b2 --- /dev/null +++ b/src/usr/diag/prdf/common/prd_pegasus.mk @@ -0,0 +1,46 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/prd_pegasus.mk $ +# +# 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 + +# Object files for prdf rule plugins for pegasus +PRDF_RULE_PLUGINS_PEGASUS = \ + prdfP8Proc.o \ + prdfP8Mcs.o \ + prdfP8Pll.o \ + prdfCenMba.o \ + prdfCenMembuf.o \ + prdfCenPll.o + +# Object files for PRDF rule plugins, but include sim extensions. +PRDF_RULE_PLUGINS_PEGASUS_WSIM = \ + prdfP8SystemSpecific.o + +# PEGASUS specific objects, not rule related. +prd_pegasus_specific = \ + prdfCalloutUtil.o \ + prdfLineDelete.o \ + prdfMemUtil.o \ + prdfPegasusConfigurator.o \ + prdfRegisterData.o + +prd_pegasus_specific_HB = \ + prdfDramRepairs.o diff --git a/src/usr/diag/prdf/common/prd_ruletable.mk b/src/usr/diag/prdf/common/prd_ruletable.mk new file mode 100755 index 000000000..c6aa261f0 --- /dev/null +++ b/src/usr/diag/prdf/common/prd_ruletable.mk @@ -0,0 +1,40 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/common/prd_ruletable.mk $ +# +# IBM CONFIDENTIAL +# +# COPYRIGHT International Business Machines Corp. 2005,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 + +PRDR_RULE_TABLE_FILES = \ + Proc.rule \ + Ex.rule \ + Mcs.rule \ + Membuf.rule \ + Mba.rule + +PRDR_RULE_TABLE_TARGETS = ${PRDR_RULE_TABLE_FILES:.rule=.prf} + +prd_ruletable = \ + prdrLoadChip.o \ + prdrLoadChipCache.o \ + prdfRuleChip.o \ + prdfGroup.o \ + prdfPluginMap.o \ + prdfRuleFiles.o + diff --git a/src/usr/diag/prdf/common/prdfEnums.H b/src/usr/diag/prdf/common/prdfEnums.H new file mode 100755 index 000000000..697b5cca5 --- /dev/null +++ b/src/usr/diag/prdf/common/prdfEnums.H @@ -0,0 +1,115 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/prdfEnums.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 __prdfEnums_H +#define __prdfEnums_H + +/** @file prdfEnums.H */ + +#ifdef __HOSTBOOT_MODULE + + #ifndef __PRD_RULE_COMPILE + #include <hwas/common/hwasCallout.H> + + // FIXME: mapping from HWSV enums to HB ones + // eventually these HWAS will make it way to fips + #define HOM_NO_DECONFIG HWAS::NO_DECONFIG + #define HOM_DECONFIG HWAS::DECONFIG + #define HOM_DEFER_DECONFIG HWAS::DELAYED_DECONFIG + + // FIXME: remove these mapping once the enums are made common + #define EPUB_PRC_ALL_PROCS HWAS::EPUB_PRC_ALL_PROCS + #define EPUB_PRC_SP_CODE HWAS::EPUB_PRC_SP_CODE + #define EPUB_PRC_PHYP_CODE HWAS::EPUB_PRC_PHYP_CODE + #define EPUB_PRC_LVL_SUPP HWAS::EPUB_PRC_LVL_SUPP + #define EPUB_PRC_MEMBUS_ERROR HWAS::EPUB_PRC_MEMBUS_ERROR + #define EPUB_PRC_PROC_XYZ_BUS HWAS::EPUB_PRC_PROC_XYZ_BUS + #define EPUB_PRC_PROC_AB_BUS HWAS::EPUB_PRC_PROC_AB_BUS + + // FIXME: remove these mapping once the enums are made common + #define SRCI_PRIORITY_HIGH HWAS::SRCI_PRIORITY_HIGH + #define SRCI_PRIORITY_MED HWAS::SRCI_PRIORITY_MED + #define SRCI_PRIORITY_MEDA HWAS::SRCI_PRIORITY_MEDA + #define SRCI_PRIORITY_MEDB HWAS::SRCI_PRIORITY_MEDB + #define SRCI_PRIORITY_MEDC HWAS::SRCI_PRIORITY_MEDC + #define SRCI_PRIORITY_LOW HWAS::SRCI_PRIORITY_LOW + + #endif + + // FIXME: Currently hostboot errl does not support these enums. Stubbing + // them out for now. + + enum + { + #ifdef __PRD_RULE_COMPILE + //FIXME: these enum values have to match with + //what are defined in include/usr/hwas/common/hwasCallout.H + EPUB_PRC_SP_CODE = 0x04, + EPUB_PRC_PHYP_CODE = 0x05, + EPUB_PRC_ALL_PROCS = 0x08, + EPUB_PRC_LVL_SUPP = 0x10, + EPUB_PRC_PROC_AB_BUS = 0x30, + EPUB_PRC_PROC_XYZ_BUS = 0x31, + EPUB_PRC_MEMBUS_ERROR = 0x34, + + SRCI_PRIORITY_LOW = 1, + SRCI_PRIORITY_MEDC = 2, + SRCI_PRIORITY_MEDB = 3, + SRCI_PRIORITY_MEDA = 4, + SRCI_PRIORITY_MED = 5, + SRCI_PRIORITY_HIGH = 6, + #endif + + // homTermEnum + HOM_SYS_NO_TERMINATE = 0, + + // homHCDBUpdate + HOM_HCDB_DO_UPDATE = 0, + HOM_HCDB_OVERRIDE, + + // homGardEnum + HOM_NO_GARD = 0, + HOM_DECONFIG_GARD, + + //homDeconfigSchedule + HOM_DECONFIG_IMMEDIATE = 0, + HOM_DECONFIG_DEFER, + + // ERRL Action Flag + ERRL_ACTION_SA = 0, + ERRL_ACTION_REPORT, + ERRL_ACTION_CALL_HOME, + ERRL_ACTION_HIDDEN, + ERRL_ACTION_DONT_TERMINATE + + }; + +#else // if not __HOSTBOOT_MODULE + + #include <epub_service_codes.H> // for EPUB_PRC_* + #include <srci.H> // for SRCI_PRIORITY_* + +#endif // __HOSTBOOT_MODULE + +#endif /* __prdfEnums_H */ + diff --git a/src/usr/diag/prdf/common/prdfMain.C b/src/usr/diag/prdf/common/prdfMain.C new file mode 100755 index 000000000..f785134cf --- /dev/null +++ b/src/usr/diag/prdf/common/prdfMain.C @@ -0,0 +1,408 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/prdfMain.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_main.C + * @brief PRD entry points + */ + +#define PRDF_MAIN_C + +#include <prdfMain.H> +#include <prdf_types.h> +#include <iipconst.h> +#include <iipglobl.h> +#include <CcAutoDeletePointer.h> + +#include <iipSystem.h> +#include <iipScanCommRegisterAccess.h> +#include <iipstep.h> // for STEP_CODE_DATA_STRUCT +#include <iipServiceDataCollector.h> +#include <xspprdService.h> // for ServiceGenerator +#include <iipConfigurator.h> +#include <iipsdbug.h> +#include <prdf_service_codes.H> +#include <iipResolutionFactory.h> +#include <prdfSystemSpecific.H> + +#include <prdfPlatServices.H> +#include <prdf_ras_services.H> + +#include <prdfPluginDef.H> // For plugin function parameter bindings. +#include <prdrLoadChipCache.H> // To flush chip-file cache. + +#include <prdfWorkarounds.H> + +#include <UtilHash.H> + +//For some odd reason when compile in FSP, these includes have to be down here +//or there will be some weird compiling error in iipResolutionFactory.h +#ifndef __HOSTBOOT_MODULE + #include <prdfChipPersist.H> + #include <prdfMfgThresholdMgr.H> + #include <prdfSystemData.H> + #include <prdfSdcFileControl.H> +#endif + +#undef PRDF_MAIN_C + +namespace PRDF +{ + +//------------------------------------------------------------------------------ +// Global Variables +//------------------------------------------------------------------------------ + +System * systemPtr = NULL; +PrdfErrlSmartPtr g_prd_errlHndl; // inited to NULL in ctor. +bool g_initialized = false; + +//------------------------------------------------------------------------------ +// Function definitions +//------------------------------------------------------------------------------ + +void unInitialize(void) +{ + PRDF_ENTER( "PRDF::unInitialize()" ); + + delete systemPtr; + systemPtr = NULL; + g_initialized = false; + // Some Resolutions carry state and must be re-created - this call resets what it needs to. + ResolutionFactory::Access().Reset(); + +#ifndef __HOSTBOOT_MODULE + // clear the MfgThresholdMgr + PrdfMfgThresholdMgr::getInstance()->reset(); +#endif + + PRDF_EXIT( "PRDF::unInitialize()" ); +} + +//------------------------------------------------------------------------------ + +errlHndl_t initialize() +{ + PRDF_ENTER( "PRDF::initialize()" ); + + g_prd_errlHndl = NULL; // This forces any previous errls to be committed dg09a + + // Synchronize SCOM access to hardware + // Start un-synchronized so hardware is accessed + ScanCommRegisterAccess::SynchType::Advance(); + + if(g_initialized == true && systemPtr != NULL) + { + // This means we are being re-initialized (and we were in a good state) + // so Clean up in preparation for re-build + unInitialize(); + } + + if(g_initialized == false) + { + // Initialize the Service Generator + ServiceGeneratorClass & serviceGenerator = + ServiceGeneratorClass::ThisServiceGenerator(); + serviceGenerator.Initialize(); + +#ifndef __HOSTBOOT_MODULE + + //Is this the correct place to add the check for the saved SDC and the sdc errl commit, if found??? + bool isSavedSdc = false; + ServiceDataCollector thisSavedSdc; + + RestoreAnalysis(thisSavedSdc, isSavedSdc); + if (isSavedSdc) + { + PRDF_INF("PRDF::initialize() Used Saved ReSync'd SDC for an errl"); + thisSavedSdc.SetFlag(ServiceDataCollector::USING_SAVED_SDC); + errlHndl_t errl = serviceGenerator.GenerateSrcPfa(RECOVERABLE, thisSavedSdc); + if (NULL != errl) + { + PRDF_COMMIT_ERRL(errl, ERRL_ACTION_REPORT); + } + } + + // Clear out old chip persistency (for CCM). + TARGETING::TargetHandleList l_oldChips; + for(PrdfChipPersist::iterator i = PrdfChipPersist::getInstance()->begin(); + i != PrdfChipPersist::getInstance()->end(); + ++i) + { + if (!PlatServices::isFunctional(*i)) + l_oldChips.push_back(*i); + } + // This must be done afterwards otherwise the delete operation destroys + // the PrdfChipPersist::iterator. + for(TARGETING::TargetHandleList::iterator i = l_oldChips.begin(); + i != l_oldChips.end(); + ++i) + { + PrdfChipPersist::getInstance()->deleteEntry(*i); + }; + // -- finished clearing out old chip persistency (for CCM). + +#endif + + CcAutoDeletePointer<Configurator> configuratorPtr + (PrdfSystemSpecific::getConfiguratorPtr()); + + systemPtr = configuratorPtr->build(); // build PRD system model + if(systemPtr != NULL) + { + systemPtr->Initialize(); // Hardware initialization & start scrub + g_initialized = true; + } + else // something bad happend. + { + g_initialized = false; + } + + // Flush rule table cache since objects are all built. + Prdr::LoadChipCache::flushCache(); + } + + PRDF_EXIT( "PRDF::initialize()" ); + + return (g_prd_errlHndl.release()); +} + +//------------------------------------------------------------------------------ + +errlHndl_t main(ATTENTION_VALUE_TYPE i_attentionType, const AttnList & i_attnList) +{ + PRDF_ENTER( "PRDF::main() Global attnType=%04X", i_attentionType ); + using namespace TARGETING; + + g_prd_errlHndl = NULL; + + uint32_t rc = SUCCESS; + + if(( g_initialized == false)&&(NULL ==systemPtr)) + { + g_prd_errlHndl = initialize(); + if(g_prd_errlHndl != NULL) rc = PRD_NOT_INITIALIZED; + } + //FIXME enterCCMMode ,isInCCM function not available in wrapper + // if (PrdfSystemData::getInstance()->isInCCM()) + // PlatServices::enterCCMMode(); + + bool latent_check_stop = false; + ServiceDataCollector serviceData; + STEP_CODE_DATA_STRUCT sdc; + sdc.service_data = &serviceData; + SYSTEM_DEBUG_CLASS sysdebug; + + sysdebug.Reinitialize(i_attnList); //Refresh sysdebug with latest Attn data + + /////////////////////////////////////////////////////////////////////////////////// + // Normalize global attn type (ie 11,12,13,....) to (CHECKSTOP,RECOVERED,SPECIAL..) + //////////////////////////////////////////////////////////////////////////////////// + + if(i_attentionType == INVALID_ATTENTION_TYPE || i_attentionType >= END_ATTENTION_TYPE) + { + rc = PRD_INVALID_ATTENTION_TYPE; + PRDF_ERR("PrdMain: Invalid attention type! Global:%x" ,i_attentionType ); + i_attentionType = RECOVERABLE; // This will prevent RAS service problems + } + + + // link to the right service Generator + ServiceGeneratorClass & serviceGenerator = + ServiceGeneratorClass::ThisServiceGenerator(); + + // check for something wrong + if(g_initialized == false || rc != SUCCESS || systemPtr == NULL) + { + if(rc == SUCCESS) + { + rc = PRD_NOT_INITIALIZED; + } + PRDF_ERR("PrdMain: PRD failed. RC=%x",rc ); + // we are not going to do an analysis - so fill out the Service Data + (serviceData.GetErrorSignature())->setSigId(rc); + serviceData.SetCallout(SP_CODE); + serviceData.SetThresholdMaskId(0); // Sets AT_THRESHOLD, DEGRADED, SERVICE_CALL + } + else // do the analysis + { + // Advance SCR Synch so that SCR reads access hardware + ScanCommRegisterAccess::SynchType::Advance(); + + serviceData.SetAttentionType(i_attentionType); + + // Check to see if this is a latent machine check.- capture time of day + serviceGenerator.SetErrorTod(i_attentionType, &latent_check_stop,serviceData); + + if(serviceGenerator.QueryLoggingBufferFull()) + { + serviceData.SetFlooding(); + } + + // If the checkstop is latent than Service Generator Will use the scd from the last call + // to PRD - no further analysis needed. + if (!latent_check_stop) + { + int32_t analyzeRc = systemPtr->Analyze(sdc, i_attentionType); + PrdfSystemSpecific::postAnalysisWorkarounds(sdc); + if(analyzeRc != SUCCESS && g_prd_errlHndl == NULL) + { + // We have a bad RC, but no error log - Fill out SDC and have service generator make one + (serviceData.GetErrorSignature())->setErrCode((uint16_t)analyzeRc); + serviceData.SetCallout(SP_CODE); + serviceData.SetServiceCall(); + //mk438901 a We don't want to gard unless we have a good return code + serviceData.Gard(GardResolution::NoGard); + } + } + } + + if(g_prd_errlHndl != NULL) + { + PRDF_INF("PRDTRACE: PrdMain: g_prd_errlHndl != NULL"); + PRDF_ADD_PROCEDURE_CALLOUT(g_prd_errlHndl, SRCI_PRIORITY_MED, EPUB_PRC_SP_CODE); + + // This forces any previous errls to be committed + g_prd_errlHndl = NULL; + + // pw 597903 -- Don't GARD if we got a global error. + serviceData.Gard(GardResolution::NoGard); + } + + g_prd_errlHndl = serviceGenerator.GenerateSrcPfa(i_attentionType, serviceData); + + //FIXME need delay to let attention lines settle + + // mk461813 a Sleep for 20msec to let attention lines settle if we are at threshold + //if ((g_prd_errlHndl == NULL) && serviceData.IsAtThreshold()) + //{ + //may need to call some function to manage some delay + //} + + RasServices::SetTerminateOnCheckstop(true); + + PRDF_EXIT( "PRDF::main()" ); + + return(g_prd_errlHndl.release()); +} + +//------------------------------------------------------------------------------ + +void iplCleanup() +{ + PRDF_ENTER( "PRDF::iplCleanup()" ); + +#ifndef __HOSTBOOT_MODULE + + PrdfChipPersist::getInstance()->clearData(); + + if(PlatServices::isMasterFSP()) //only write registry key on primary + { + uint8_t l_allZeros = 0; + errlHndl_t errl = UtilReg::write("prdf/RasServices", + &l_allZeros, + sizeof(uint8_t)); + if (NULL != errl) + { + PRDF_COMMIT_ERRL(errl, ERRL_ACTION_REPORT); + } + } + +#endif + + PRDF_EXIT( "PRDF::iplCleanup()" ); + + return; +} + +//------------------------------------------------------------------------------ +// Hostboot specific functions +//------------------------------------------------------------------------------ + +#ifdef __HOSTBOOT_MODULE + +errlHndl_t startScrub( const TARGETING::TargetHandle_t i_pTarget ) +{ + PRDF_ENTER( "PRDF::startScrub()" ); + + errlHndl_t o_err = NULL; + + // TODO: Will be implemented later + + PRDF_EXIT( "PRDF::startScrub()" ); + + return o_err; +} + +#endif // __HOSTBOOT_MODULE + +//------------------------------------------------------------------------------ +// FSP specific functions +//------------------------------------------------------------------------------ + +#ifndef __HOSTBOOT_MODULE + +errlHndl_t failoverComplete() +{ + PRDF_ENTER( "PRDF::failoverComplete()" ); + + bool isSavedSdc = false; + ServiceDataCollector thisSavedSdc; + errlHndl_t l_errl = NULL; + + if(g_initialized == false) + { + l_errl = initialize(); + } + else + { + if(systemPtr != NULL) + { + systemPtr->RemoveNonFunctionalChips(); + } + + // link to the right service Generator + ServiceGeneratorClass & serviceGenerator = + ServiceGeneratorClass::ThisServiceGenerator(); + + RestoreAnalysis(thisSavedSdc, isSavedSdc); + if (isSavedSdc) + { + PRDF_INF("PRDF::failoverComplete() Used Saved ReSync'd SDC for an errl"); + thisSavedSdc.SetFlag(ServiceDataCollector::USING_SAVED_SDC); + errlHndl_t errl = serviceGenerator.GenerateSrcPfa(RECOVERABLE, thisSavedSdc); + if (NULL != errl) + { + PRDF_COMMIT_ERRL(errl, ERRL_ACTION_REPORT); + } + } + } + + PRDF_EXIT( "PRDF::failoverComplete()" ); + + return l_errl; +} + +#endif // not __HOSTBOOT_MODULE + +} // End namespace PRDF diff --git a/src/usr/diag/prdf/common/prdfTrace.C b/src/usr/diag/prdf/common/prdfTrace.C new file mode 100755 index 000000000..39bebe5ae --- /dev/null +++ b/src/usr/diag/prdf/common/prdfTrace.C @@ -0,0 +1,36 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/prdfTrace.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 prdfTrace.C + * @brief prdf trace descriptor + */ + +#include "prdfTrace.H" + +namespace PRDF +{ + tracDesc_t traceDesc = 0; + TRAC_INIT( &traceDesc, PRDF_COMP_NAME, 4096 ); +} + diff --git a/src/usr/diag/prdf/common/prdfTrace.H b/src/usr/diag/prdf/common/prdfTrace.H new file mode 100755 index 000000000..1a67febf2 --- /dev/null +++ b/src/usr/diag/prdf/common/prdfTrace.H @@ -0,0 +1,60 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/prdfTrace.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 PRDF_TRACE_H +#define PRDF_TRACE_H + +#include <tracinterface.H> +#include <prdf_service_codes.H> + +namespace PRDF +{ + #ifdef __HOSTBOOT_MODULE + typedef trace_desc_t* tracDesc_t; + #endif + + extern tracDesc_t traceDesc; +} + +#ifdef __HOSTBOOT_MODULE + // FIXME: Will need to make a change in hbotcompid.H later. + #define PRDF_COMP_ID HBPRDF_COMP_ID + #define PRDF_COMP_NAME HBPRDF_COMP_NAME +#endif + +// field traces ------------------- + +#define PRDF_TRAC(args...) TRACFCOMP(PRDF::traceDesc, args) +#define PRDF_ENTER(args...) TRACFCOMP(PRDF::traceDesc, ENTER_MRK"" args) +#define PRDF_EXIT(args...) TRACFCOMP(PRDF::traceDesc, EXIT_MRK"" args) +#define PRDF_ERR(args...) TRACFCOMP(PRDF::traceDesc, ERR_MRK"" args) +#define PRDF_INF(args...) TRACFCOMP(PRDF::traceDesc, INFO_MRK"" args) + +// debug traces ------------------- + +#define PRDF_DTRAC(args...) TRACDCOMP(PRDF::traceDesc, args) +#define PRDF_DENTER(args...) TRACDCOMP(PRDF::traceDesc, ENTER_MRK"" args) +#define PRDF_DEXIT(args...) TRACDCOMP(PRDF::traceDesc, EXIT_MRK"" args) + +#endif // PRDF_TRACE_H + diff --git a/src/usr/diag/prdf/common/prdf_types.h b/src/usr/diag/prdf/common/prdf_types.h new file mode 100755 index 000000000..ce103e61a --- /dev/null +++ b/src/usr/diag/prdf/common/prdf_types.h @@ -0,0 +1,40 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/prdf_types.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_TYPES_H +#define PRDF_TYPES_H + +#include <stdint.h> + +#undef NULL +#define NULL 0 + +#define BIT_LIST_CLASS prdfBitKey +#define BIT_STRING_CLASS prdfBitString +#define BIT_STRING_ADDRESS_CLASS prdfBitStringOffset +#define BIT_STRING_BUFFER_CLASS prdfBitStringBuffer +#define ResolutionMap prdfResolutionMap +#define FILTER_PRIORITY_CLASS prdfFilterPriority +#define FILTER_CLASS prdfFilter + +#endif /* prdf_types_h */ diff --git a/src/usr/diag/prdf/common/util/CcAutoDeletePointer.h b/src/usr/diag/prdf/common/util/CcAutoDeletePointer.h new file mode 100755 index 000000000..22560e0fb --- /dev/null +++ b/src/usr/diag/prdf/common/util/CcAutoDeletePointer.h @@ -0,0 +1,307 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/CcAutoDeletePointer.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1995,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 CcAutoDeletePointer_h +#define CcAutoDeletePointer_h + +// Class Specification ************************************************* +// +// Class name: CcAutoDeletePointer +// Parent class: None. +// +// Summary: This class is used to implement an automatic delete on a +// pointer to memory obtained via new for a single instance. +// Its primary purpose is for use in functions that create a +// single instance dynamically and then perform some operations +// that may throw an exception. +// +// This class should be used as a local variable so that when the +// varaible goes out of scope, the destructor is called and the +// memory pointer is deleted. Because the variable is local, if +// an exception is thrown, it is guaranteed that the destructor +// for this variable will be run and the memory pointer will be +// deleted properly. +// +// Access to the pointer is available through the pointer +// dereference operators, operator->() and +// operator*(). The normal delete syntax is used +// (i.e. "delete ptr;"). +// +// Cardinality: N +// +// Performance/Implementation: +// Space Complexity: Constant +// Time Complexity: Constant +// +// Usage Examples: +// +// struct MyType +// { +// void bar(void); +// }; +// +// void foo(void) +// { +// CcAutoDeletePointer<MyType> ptr(new MyType()); +// +// // Operations that may throw an exception +// +// ptr->bar(); // Using the pointer +// +// (*ptr).bar(); // Dereferencing +// } +// +// +// End Class Specification ********************************************* + +// Includes + +template <class T> +class CcAutoDeletePointer + { + public: // public member functions + + CcAutoDeletePointer(T * ptr); + // Function Specification ******************************************** + // + // Purpose: Initialization + // Parameters: ptr: Pointer to auto-delete + // Returns: No value returned + // Requirements: None. + // Promises: All data members are initialized. + // Exceptions: None. + // Concurrency: N/A + // + // End Function Specification **************************************** + + ~CcAutoDeletePointer(void); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: N/A + // Notes: The function deletes the data member pointer. + // + // End Function Specification **************************************** + + T * operator->(void) const; + // Function Specification ******************************************** + // + // Purpose: Provide access to pointer. + // Parameters: None. + // Returns: Pointer to template type. + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // + // End Function Specification **************************************** + + T & operator*(void) const; + // Function Specification ******************************************** + // + // Purpose: Provide access to pointer. + // Parameters: None. + // Returns: Reference to template type. + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // + // End Function Specification **************************************** + + private: + + CcAutoDeletePointer(const CcAutoDeletePointer<T> & e); + // Function Specification ******************************************** + // + // Purpose: Copy + // Parameters: e: Reference to instance to copy + // Returns: No value returned. + // Requirements: None. + // Promises: All data members are initialized. + // Exceptions: None. + // Concurrency: N/A. + // Notes: This copy constructor is declared private and not defined + // to prohibit copying. + // + // End Function Specification **************************************** + + CcAutoDeletePointer<T> & operator=(const CcAutoDeletePointer<T> & e); + // Function Specification ******************************************** + // + // Purpose: Assigment + // Parameters: e: Reference to instance to assign from + // Returns: Reference to this instance + // Requirements: None. + // Promises: All data members will be assigned. + // Exceptions: N/A. + // Concurrency: N/A. + // Notes: This assignment operator is declared private and not defined + // to prohibit copying. + // + // End Function Specification **************************************** + + T * pointer; + + }; + +// Class Specification ************************************************* +// +// Class name: CcAutoDeletePointerVector +// Parent class: None. +// +// Summary: This class is used to implement an automatic delete on a +// pointer to memory obtained via new for multiple instances. +// Its primary purpose is for use in functions that allocate +// multiple instances dynamically (e.g. "T * ptr = new T[5];") +// and then perform some operations that may throw an +// exception. +// +// This class should be used as a local variable so that when the +// varaible goes out of scope, the destructor is called and the +// memory pointer is deleted. Because the variable is local, if +// an exception is thrown, it is guaranteed that the destructor +// for this variable will be run and the memory pointer will be +// deleted properly. +// +// Access to the pointer is available through operator(). The +// vector delete syntax is used (e.g. "delete [] ptr;"). +// +// Cardinality: N +// +// Performance/Implementation: +// Space Complexity: Constant +// Time Complexity: Constant +// +// Usage Examples: +// +// void foo(void) +// { +// CcAutoDeletePointerVector<char> ptr(new char[4]); +// +// // Operations that may throw an exception +// +// strcpy(ptr(), "abc"); // Using the Pointer +// } +// +// +// End Class Specification ********************************************* + +template <class T> +class CcAutoDeletePointerVector + { + public: // public member functions + + CcAutoDeletePointerVector(T * ptr); + // Function Specification ******************************************** + // + // Purpose: Initialization + // Parameters: ptr: Pointer to auto-delete + // Returns: No value returned + // Requirements: None. + // Promises: All data members are initialized. + // Exceptions: None. + // Concurrency: N/A + // + // End Function Specification **************************************** + + ~CcAutoDeletePointerVector(void); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: N/A + // Notes: The function deletes the data member pointer. + // + // End Function Specification **************************************** + + T * operator()(void) const; + // Function Specification ******************************************** + // + // Purpose: Provide access to pointer. + // Parameters: None. + // Returns: Pointer to template type. + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // + // End Function Specification **************************************** + + private: + + CcAutoDeletePointerVector(const CcAutoDeletePointerVector<T> & e); + // Function Specification ******************************************** + // + // Purpose: Copy + // Parameters: e: Reference to instance to copy + // Returns: No value returned. + // Requirements: None. + // Promises: All data members are initialized. + // Exceptions: None. + // Concurrency: N/A. + // Notes: This copy constructor is declared private and not defined + // to prohibit copying. + // + // End Function Specification **************************************** + + CcAutoDeletePointerVector<T> & operator=( + const CcAutoDeletePointerVector<T> & e); + // Function Specification ******************************************** + // + // Purpose: Assigment + // Parameters: e: Reference to instance to assign from + // Returns: Reference to this instance + // Requirements: None. + // Promises: All data members will be assigned. + // Exceptions: N/A. + // Concurrency: N/A. + // Notes: This assignment operator is declared private and not defined + // to prohibit copying. + // + // End Function Specification **************************************** + + T * pointer; + + }; +#include <CcAutoDeletePointer.inl> + +// Change Log ********************************************************** +// +// Flag PTR/DCR# Userid Date Description +// ---- -------- -------- -------- ----------- +// n/a n/a JST 09/12/95 Created. +// +// End Change Log ****************************************************** + +#endif + diff --git a/src/usr/diag/prdf/common/util/CcAutoDeletePointer.inl b/src/usr/diag/prdf/common/util/CcAutoDeletePointer.inl new file mode 100755 index 000000000..d8b5c656e --- /dev/null +++ b/src/usr/diag/prdf/common/util/CcAutoDeletePointer.inl @@ -0,0 +1,87 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/CcAutoDeletePointer.inl $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1995,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 CcAutoDeletePointer_inl +#define CcAutoDeletePointer_inl + +// Includes + +template<class T> +inline +CcAutoDeletePointer<T>::CcAutoDeletePointer(T * ptr) : + pointer(ptr) + { + } + +template<class T> +inline +CcAutoDeletePointer<T>::~CcAutoDeletePointer(void) + { + delete pointer; + } + +template<class T> +inline +T * CcAutoDeletePointer<T>::operator->(void) const + { + return(pointer); + } + +template<class T> +inline +T & CcAutoDeletePointer<T>::operator*(void) const + { + return(*pointer); + } + +template<class T> +inline +CcAutoDeletePointerVector<T>::CcAutoDeletePointerVector(T * ptr) : + pointer(ptr) + { + } + +template<class T> +inline +CcAutoDeletePointerVector<T>::~CcAutoDeletePointerVector(void) + { + delete [] pointer; + } + +template<class T> +inline +T * CcAutoDeletePointerVector<T>::operator()(void) const + { + return(pointer); + } + +// Change Log ********************************************************** +// +// Flag PTR/DCR# Userid Date Description +// ---- -------- -------- -------- ----------- +// n/a n/a JST 09/12/95 Created. +// +// End Change Log ****************************************************** + +#endif + diff --git a/src/usr/diag/prdf/common/util/CcSynch.h b/src/usr/diag/prdf/common/util/CcSynch.h new file mode 100755 index 000000000..8be57bb65 --- /dev/null +++ b/src/usr/diag/prdf/common/util/CcSynch.h @@ -0,0 +1,202 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/CcSynch.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1995,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 CcSynch_h +#define CcSynch_h + +// Class Specification ************************************************* +// +// Class name: CcSynch +// Parent class: None. +// +// Summary: This class is used as a synchronization mechanism. A +// static step counter is maintained and incremented via the +// static member function Advance(). An internal step counter +// is also maintained. The member function IsCurrent() +// compares the two values to indicate if this instance is +// "in synch". Calling the IsCurrent() functiona also updates +// the internal counter to the static counter. +// +// The primary use is to ensure that an operation is performed +// only once over a given time interval. The time interval +// is controlled by successive calls to Advance(). If an +// instance is not current, then the operation is performed +// and the instance will then be current. +// +// The parameterized type STEP_TYPE is used for the type of +// the counters. This type should be selected according to +// the necessary granularity. For example, an 8 bit integer +// value allows for 256 unique counter values. +// +// The parameterized type ID is used to diferentiate an +// instantiation of this tmeplate from other instantiations. +// This class relies on a unique static data member which is +// generated for each unique instantiation. +// +// Cardinality: N +// +// Performance/Implementation: +// Space Complexity: Constant +// Time Complexity: Constant +// +// Usage Examples: +// +// struct mytype {}; +// +// void foo(CcSynch<int, mytpe> & synch) +// { +// synch.Advance(); +// +// if(synch.IsCurrent()) +// { +// // Operation is performed +// } +// +// if(synch.IsCurrent()) +// { +// // Operation is not performed +// } +// } +// +// +// End Class Specification ********************************************* + +// Includes + + +template <class STEP_TYPE, class ID> +class CcSynch + { + public: // public member functions + + typedef STEP_TYPE StepType; + + enum + { + STATIC_INITIAL_VALUE = 1, + INSTANCE_INITIAL_VALUE = 0 + }; + + static void Advance(void); + // Function Specification ******************************************** + // + // Purpose: Advances the static data member step. + // Parameters: None. + // Returns: No value returned. + // Requirements: None. + // Promises: Static data member step will be incremented. + // Exceptions: None. + // Concurrency: Reentrant. + // + // End Function Specification **************************************** + + CcSynch(void); + // Function Specification ******************************************** + // + // Purpose: Initialization + // Parameters: No parameters + // Returns: No value returned + // Requirements: None. + // Promises: All data members are initialized. + // Exceptions: None. + // Concurrency: N/A + // + // End Function Specification **************************************** + + // CcSynch(const CcSynch & e); + // Function Specification ******************************************** + // + // Purpose: Copy + // Parameters: e: Reference to instance to copy + // Returns: No value returned. + // Requirements: None. + // Promises: All data members are initialized. + // Exceptions: None. + // Concurrency: N/A. + // Notes: The compiler generated copy constructor is sufficient. + // + // End Function Specification **************************************** + + // ~CcSynch(void); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: N/A + // Notes: The compiler generated default destructor is sufficient. + // + // End Function Specification **************************************** + + // CcSynch & operator=(const CcSynch & e); + // Function Specification ******************************************** + // + // Purpose: Assigment + // Parameters: e: Reference to instance to assign from + // Returns: Reference to this instance + // Requirements: None. + // Promises: All data members will be assigned. + // Exceptions: N/A. + // Concurrency: N/A. + // Notes: The compiler generated default assignment operator is + // sufficient. + // + // End Function Specification **************************************** + + bool IsCurrent(void); + // Function Specification ******************************************** + // + // Purpose: Determines if myStep is current with step. + // Parameters: None. + // Returns: TRUE if myStep is current with step. Otherewise, + // FALSE. + // Requirements: None. + // Promises: myStep will be current with step. + // Exceptions: None.. + // Concurrency: Reenetrant. + // + // End Function Specification **************************************** + + private: + + static StepType step; + + StepType myStep; + }; + +#include "CcSynch.inl" + +// Change Log ********************************************************** +// +// Flag PTR/DCR# Userid Date Description +// ---- -------- -------- -------- ----------- +// n/a n/a JST 04/06/95 Created. +// D24747.4 JFP 02/23/96 Added #ifndef BOOL_H +// +// End Change Log ****************************************************** + +#endif + diff --git a/src/usr/diag/prdf/common/util/CcSynch.inl b/src/usr/diag/prdf/common/util/CcSynch.inl new file mode 100755 index 000000000..09371b95d --- /dev/null +++ b/src/usr/diag/prdf/common/util/CcSynch.inl @@ -0,0 +1,62 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/CcSynch.inl $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1995,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 CcSynch_inl +#define CcSynch_inl + +// Includes + +template <class STEP_TYPE, class ID> +inline +void CcSynch<STEP_TYPE, ID>::Advance(void) + { + step++; + } + +template <class STEP_TYPE, class ID> +inline +CcSynch<STEP_TYPE, ID>::CcSynch(void) : + myStep(INSTANCE_INITIAL_VALUE) + { + } + +template <class STEP_TYPE, class ID> +bool CcSynch<STEP_TYPE, ID>::IsCurrent(void) + { + bool rc = (step == myStep); + + myStep = step; + + return(rc); + } + +// Change Log ********************************************************** +// +// Flag PTR/DCR# Userid Date Description +// ---- -------- -------- -------- ----------- +// n/a n/a JST 04/06/95 Created. +// +// End Change Log ****************************************************** + +#endif + diff --git a/src/usr/diag/prdf/common/util/UtilFunct.H b/src/usr/diag/prdf/common/util/UtilFunct.H new file mode 100755 index 000000000..07e113326 --- /dev/null +++ b/src/usr/diag/prdf/common/util/UtilFunct.H @@ -0,0 +1,153 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/UtilFunct.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2005,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 UtilFunct.H + * Utility template classes for doing functional-style programming across + * iterators. + */ +#ifndef __UTIL_UTILFUNCT_H +#define __UTIL_UTILFUNCT_H + +#include <functional> + +namespace Util +{ + /** + * @class unary_input + * Functor that will read a value from a stream; useful for "generate" + * algorithms such as std::generate_n. + */ + template <typename Type, + typename Stream> + struct unary_input : + public std::unary_function<void, Type> + { + Stream & stream; + + /** + * @fn unary_input(Stream & i) + * Constructor + * + * @param i : The stream to read from. + */ + unary_input(Stream & i) : stream(i) {}; + + /** + * @fn operator() + * Read instance of 'Type' from stream. + * + * Overloaded () operator to implement the functor-style behavior. + */ + Type operator() () + { + Type t; + stream >> t; + return t; + }; + + }; + + /** + * @class unary_compose + * Functor that will compose two functors as in: 'f(g(x))'. + * + * This template is an SGI extension to the STL, not currently in the C++ + * standard. Since it is currently an extension, define it in our Util + * namespace for portability. + * + * Note: This is a clean implementation of the template, not a copy of the + * SGI code, based on the SGI::STL documentation. + */ + template <typename Unary1, + typename Unary2> + struct unary_compose : + public std::unary_function<typename Unary2::argument_type, + typename Unary1::result_type> + { + Unary1 u1; + Unary2 u2; + + /** + * @fn unary_compose(Unary1 & i1, Unary2 & i2) + * Constructor + * + * @param i1 : f functor in f(g(x)). + * @param i2 : g functor in f(g(x)). + */ + unary_compose(const Unary1 & i1, + const Unary2 & i2) : u1(i1), u2(i2) {}; + + /** + * @fn operator() + * Execute f(g(x)). + * + * Overloaded () operator to implement the functor-style behavior. + */ + typename Unary1::result_type + operator() (typename Unary2::argument_type x) + { + return u1(u2(x)); + }; + + }; + + /** + * @fn unary_compose + * Utility template function to automatically create a composition functor. + */ + template <typename Unary1, + typename Unary2> + inline + unary_compose<Unary1, Unary2> compose1(const Unary1 & i1, + const Unary2 & i2) + { + return unary_compose<Unary1, Unary2>(i1, i2); + }; + + /** + * @class unary_null. + * Functor that will do nothing. + * + * Useful in combination with compose for dropping a return from another + * functor. + */ + template <typename Type> + struct unary_null : + public std::unary_function<Type, void> + { + unary_null() {}; + void operator() (Type i) {}; + }; + +}; + + +#endif + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// F510901 f300 07/15/05 iawillia Initial file creation. +// End Change Log ***************************************************** + diff --git a/src/usr/diag/prdf/common/util/UtilHash.H b/src/usr/diag/prdf/common/util/UtilHash.H new file mode 100755 index 000000000..da03cf2d9 --- /dev/null +++ b/src/usr/diag/prdf/common/util/UtilHash.H @@ -0,0 +1,99 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/UtilHash.H $ */ +/* */ +/* 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 */ + +#ifndef __UTIL_UTILHASH_H +#define __UTIL_UTILHASH_H + +#include <stdint.h> + +namespace Util +{ + inline uint32_t hashString(const char * i_str) + { + // This hash is a simple "n*s[0] + (n-1)*s[1] + ... + s[n-1]" algorithm, + // where s[i] is a two byte chunk of the input string. It is currently + // intended to return a 16-bit hash of the input string. + + uint32_t sumA = 0; + uint32_t sumB = 0; + uint32_t pos = 0; + uint32_t val = 0; + + const uint32_t bytes = sizeof(uint16_t); // 16-bit hashing + + i_str--; // This looks weird but it is because of the do-while loop. We + // want it to loop through one more time when we have reached + // the end of the string (i.e. with the '\0' character). + + do + { + i_str++; + + if ('\0' != *i_str) + { + val <<= 8; + val |= (uint8_t) *i_str; + pos++; + } + else + { + while (bytes != pos) + { + val <<= 8; + pos++; + } + } + + if (bytes == pos) + { + pos = 0; + sumA += val; + sumB += sumA; + val = 0; + } + + } while ('\0' != *i_str); + + return (sumB & 0xffff); // 16-bit hashing + }; + + inline uint32_t hashAdler32(const char * i_str) + { + uint32_t sumA = 1; + uint32_t sumB = 0; + while ('\0' != *i_str) + { + sumA += *i_str; + sumB += sumA; + + sumA %= 65521; + sumB %= 65521; + + i_str++; + } + return ((sumB << 16) | sumA) & 0x7FFFFFFF; + }; +}; + +#endif + diff --git a/src/usr/diag/prdf/common/util/UtilMapX.H b/src/usr/diag/prdf/common/util/UtilMapX.H new file mode 100755 index 000000000..208d7f784 --- /dev/null +++ b/src/usr/diag/prdf/common/util/UtilMapX.H @@ -0,0 +1,197 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/UtilMapX.H $ */ +/* */ +/* 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 */ + +#ifndef __UTIL_UTILMAPX_H +#define __UTIL_UTILMAPX_H + +#include "UtilTree.H" +#include <algorithm> + +template <class _A, class _B> +class UtilMapX +{ + public: + UtilMapX(); + UtilMapX(const UtilMapX<_A,_B> &); + + + void insert(const _A &, const _B &); + void insert(const std::pair<_A,_B> &); + void remove(const _A &); + bool find(const _A &); + const std::pair<_A,_B>& peek(); + void empty() { cv_tree.empty(); }; + _B & operator[] (const _A &); + + private: + UtilTree cv_tree; + + class mapXComparator : public UtilTree::comparator + { + public: + virtual int operator() (void * _a, void * _b) const + { + std::pair<_A,_B>* a; + std::pair<_A,_B>* b; + + a = static_cast<std::pair<_A,_B>*>(_a); + b = static_cast<std::pair<_A,_B>*>(_b); + + return (a->first < b->first ? -1 : + (a->first == b->first ? 0 : 1)); + }; + }; + + class mapXCleanup : public UtilTree::cleanup + { + public: + virtual void operator() (void * _a) const + { + std::pair<_A,_B>* a = static_cast<std::pair<_A,_B>*>(_a); + delete a; + }; + }; + + class mapXCopier : public UtilTree::copier + { + public: + virtual void * operator() (void * _a) const + { + std::pair<_A,_B>* a = static_cast<std::pair<_A,_B>*>(_a); + return (void *) new std::pair<_A,_B>(*a); + }; + }; + + mapXComparator cv_compare; + mapXCleanup cv_clean; + mapXCopier cv_copy; + + public: + class iterator + { + private: + UtilTree::iterator _pos; + public: + iterator(UtilTree::iterator i) { _pos = i; }; + iterator & operator++() + { ++_pos; return *this; }; + iterator & operator--() + { --_pos; return *this; }; + bool operator==(const iterator& i) const + { return _pos == i._pos; }; + bool operator!=(const iterator& i) const + { return _pos != i._pos; }; + std::pair<_A, _B> operator*() + { + std::pair<_A, _B> * a = + static_cast<std::pair<_A, _B> *>(*_pos); + if (NULL == a) + return std::pair<_A, _B>(); + return *a; + }; + }; + iterator end() const { return iterator(cv_tree.end()); }; + iterator begin() const { return iterator(cv_tree.begin()); }; + +}; + +template <class _A, class _B> +UtilMapX<_A,_B>::UtilMapX() +{ + cv_tree.setComparator(&cv_compare); + cv_tree.setCleanup(&cv_clean); + cv_tree.setCopier(&cv_copy); +}; + +template <class _A, class _B> +UtilMapX<_A,_B>::UtilMapX(const UtilMapX<_A,_B> & i_copy) +{ + cv_tree = i_copy.cv_tree; + cv_tree.setComparator(&cv_compare); + cv_tree.setCleanup(&cv_clean); + cv_tree.setCopier(&cv_copy); +}; + +template <class _A, class _B> +void UtilMapX<_A,_B>::insert(const _A & a, const _B & b) +{ + cv_tree.insert(new std::pair<_A,_B>(a,b)); +}; + +template <class _A, class _B> +void UtilMapX<_A,_B>::insert(const std::pair<_A,_B> & i) +{ + cv_tree.insert(new std::pair<_A,_B>(i)); +}; + +template <class _A, class _B> +void UtilMapX<_A,_B>::remove(const _A & a) +{ + std::pair<_A,_B> p(a,_B()); + cv_tree.remove(&p); +}; + +template <class _A, class _B> +bool UtilMapX<_A,_B>::find(const _A & a) +{ + std::pair<_A,_B> p(a,_B()); + return (NULL != cv_tree.find(&p)); +}; + +template <class _A, class _B> +const std::pair<_A,_B> & UtilMapX<_A,_B>::peek() +{ + void * tmp = cv_tree.peek(); + if (NULL == tmp) + { + static const std::pair<_A,_B> l; + return l; + } + return *static_cast<const std::pair<_A,_B> *>(tmp); +}; + +template <class _A, class _B> +_B & UtilMapX<_A, _B>::operator[] (const _A & a) +{ + std::pair<_A,_B> p(a,_B()); + std::pair<_A, _B> * l_node = + static_cast<std::pair<_A, _B> *>(cv_tree.find(&p)); + + if (NULL == l_node) + { + this->insert(p); + l_node = static_cast<std::pair<_A, _B> *>(cv_tree.find(&p)); + } + + return l_node->second; +}; + +#endif + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// F494911 f310 03/04/05 iawillia Initial File Creation +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/util/UtilSMap.H b/src/usr/diag/prdf/common/util/UtilSMap.H new file mode 100755 index 000000000..c47f36c19 --- /dev/null +++ b/src/usr/diag/prdf/common/util/UtilSMap.H @@ -0,0 +1,181 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/UtilSMap.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 UtilSMap.H + * An optimized implementation of the STL Map meant for small maps that do not + * need to be sorted. + */ + +#ifndef __UTIL_UTILSMAP_H +#define __UTIL_UTILSMAP_H + +#include <stddef.h> +#include <stdlib.h> + +template <typename _First, typename _Second> class UtilSMap_Iterator; +template <typename _First, typename _Second> UtilSMap_Iterator<_First, _Second> + operator+(UtilSMap_Iterator<_First,_Second>& l, size_t i); + +template <typename _First, typename _Second> +class UtilSMap_Iterator +{ + protected: + char * iv_position; + public: + UtilSMap_Iterator(char * i_position) : iv_position(i_position) {}; + + bool operator==(const UtilSMap_Iterator & r) + { return iv_position == r.iv_position; }; + + bool operator!=(const UtilSMap_Iterator & r) + { return iv_position != r.iv_position; }; + + UtilSMap_Iterator<_First, _Second>& operator++(); + + _First & first() { return *(_First *) iv_position; }; + _Second & second(); + + friend UtilSMap_Iterator<_First, _Second> + operator+<>(UtilSMap_Iterator<_First,_Second>& l, + size_t i); +}; + +template <typename _First, typename _Second> +class UtilSMap +{ + public: + typedef _First key_type; + typedef _Second data_type; + typedef size_t size_type; + typedef UtilSMap_Iterator<_First,_Second> iterator; + + private: + char * iv_memblock; + size_type iv_size; + size_type iv_blockCount; + + public: + static const + size_type cv_firstSize = 4 * (sizeof(_First) / 4 + + (0 == (sizeof(_First) % 4) ? 0 : + 4 - (sizeof(_First) % 4))); + static const + size_type cv_secondSize = 4 * (sizeof(_Second) / 4 + + (0 == (sizeof(_Second) % 4) ? 0 : + 4 - (sizeof(_Second) % 4))); + + static const + size_type cv_blockSize = cv_firstSize + cv_secondSize; + + public: + UtilSMap() : iv_memblock(NULL), iv_size(0), iv_blockCount(2) {}; + ~UtilSMap() { this->clear(); }; + + inline size_type size() const { return iv_size;}; + inline bool empty() const { return 0 == iv_size;}; + inline iterator begin() const + { return UtilSMap_Iterator<_First,_Second>(iv_memblock); }; + inline iterator end() const + { return UtilSMap_Iterator<_First,_Second>( + &iv_memblock[iv_size * cv_blockSize]); + }; + + void clear() + { + if (NULL != iv_memblock) free(iv_memblock); + iv_memblock = NULL; + iv_size = 0; + iv_blockCount = 2; + }; + + data_type * insert(const key_type & k, const data_type & v) + { + if (NULL == iv_memblock) + { + iv_memblock = (char *) malloc(cv_blockSize * iv_blockCount); + } + if (iv_size == iv_blockCount) + { + iv_blockCount <<= 1; + iv_memblock = (char *) + realloc(iv_memblock, cv_blockSize * iv_blockCount); + } + (*(key_type *)&iv_memblock[cv_blockSize * iv_size]) = k; + data_type * l_rc = (data_type *) + &iv_memblock[cv_blockSize * iv_size + cv_firstSize]; + + (*l_rc) = v; + + iv_size++; + + return l_rc; + }; + data_type & operator[](const key_type & i) + { + data_type * l_rc = find(i); + + if (NULL == l_rc) + l_rc = insert(i, data_type()); + + return *l_rc; + }; + + private: + data_type * find(const key_type & k) + { + if (NULL == iv_memblock) + return NULL; + + for (size_type i = 0; i < iv_size; i++) + if ((*(key_type *)&iv_memblock[i * cv_blockSize]) == k) + return ((data_type *) + &iv_memblock[i * cv_blockSize + cv_firstSize]); + + return NULL; + }; +}; + +template <typename _First, typename _Second> +UtilSMap_Iterator<_First,_Second>& + UtilSMap_Iterator<_First,_Second>::operator++() + { + iv_position = + &iv_position[UtilSMap<_First,_Second>::cv_blockSize]; + return *this; + }; +template <typename _First, typename _Second> +_Second& UtilSMap_Iterator<_First,_Second>::second() + { + return *(_Second *) + &iv_position[UtilSMap<_First, _Second>::cv_firstSize]; + }; +template <typename _First, typename _Second> +UtilSMap_Iterator<_First,_Second> + operator+(UtilSMap_Iterator<_First, _Second>& l, size_t i) + { + return UtilSMap_Iterator<_First,_Second>(&l.iv_position[ + UtilSMap<_First,_Second>::cv_blockSize * i]); + }; + + +#endif diff --git a/src/usr/diag/prdf/common/util/UtilTree.C b/src/usr/diag/prdf/common/util/UtilTree.C new file mode 100755 index 000000000..5eeaf3e43 --- /dev/null +++ b/src/usr/diag/prdf/common/util/UtilTree.C @@ -0,0 +1,344 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/UtilTree.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 */ + +#include "UtilTree.H" +UtilTree::defaultComparator UtilTree::defComparator; +UtilTree::defaultCleanup UtilTree::defCleanup; +UtilTree::defaultCopier UtilTree::defCopy; + +void UtilTree::printTree() +{ + this->printTree(0,root); +}; + +UtilTree::UtilTree() + : root(NULL), comp(&defComparator), clean(&defCleanup), copy(&defCopy) +{ +}; + +UtilTree::~UtilTree() +{ + cleanTree(root); + root = NULL; +}; + +void UtilTree::empty() +{ + cleanTree(root); +}; + +void UtilTree::cleanTree(Node * root) +{ + if (NULL == root) + return; + + cleanTree(root->left); + cleanTree(root->right); + + (*clean)(root->value); + delete root; + + return; +}; + +void * UtilTree::peek() const +{ + if (NULL == root) + return NULL; + return root->value; +}; + +void * UtilTree::find(void * v) const +{ + return (NULL != find(v, root) ? (find(v, root)->value) : NULL); +}; + +UtilTree::Node * UtilTree::find(void * v, Node * t) const +{ + if (NULL == t) + return NULL; + + if (0 == (*comp)(v, t->value)) + return t; + + return find(v, (-1 == (*comp)(v, t->value) ? t->left : t->right)); +}; + +void UtilTree::insert(void * v) +{ + insert(v, root); + while (NULL != root->parent) + root = root->parent; + if (Node::RED == root->color) + root->color = Node::BLACK; +}; + +void UtilTree::insert(void * v, Node *& t) +{ + if (NULL == t) + { + t = new Node(v); + t->color = Node::RED; + } + else if (0 == (*comp)(v, t->value)) + { + (*clean)(t->value); + t->value = v; + } + else + { + Node *& temp = (-1 == (*comp)(v, t->value) ? t->left : t->right); + if (NULL == temp) + { + insert(v, temp); + temp->parent = t; + balance_i(temp); + } + else + { + insert(v, temp); + } + } +}; + + +void UtilTree::balance_i(Node * t) +{ + if (NULL == t) // Hmm... + ; + else if (NULL == t->parent) // root node, fix color. + t->color = Node::BLACK; + else if (Node::BLACK == t->parent->color) // parent black, leave alone. + ; + else // parent red. + { + bool parentLeft = t->parent->parent->left == t->parent; + bool meLeft = t->parent->left == t; + + if (parentLeft != meLeft) // rotate LR or RL case (from grandparent). + { + if (!meLeft) // right of parent. + { + if (t->left) + t->left->parent = t->parent; + t->parent->right = t->left; + t->left = t->parent; + t->parent->parent->left = t; + t->parent = t->parent->parent; + t->left->parent = t; + balance_i(t->left); + } + else // left of parent. + { + if (t->right) + t->right->parent = t->parent; + t->parent->left = t->right; + t->right = t->parent; + t->parent->parent->right = t; + t->parent = t->parent->parent; + t->right->parent = t; + balance_i(t->right); + } + } + else + { + bool hasRedUncle = false; + if ((parentLeft ? t->parent->parent->right + : t->parent->parent->left) != NULL) + { + if ((parentLeft ? t->parent->parent->right + : t->parent->parent->left)->color == Node::RED) + { + hasRedUncle = true; + } + } + + if (hasRedUncle) + { + t->parent->color = Node::BLACK; + (parentLeft ? t->parent->parent->right + : t->parent->parent->left)->color = Node::BLACK; + t->parent->parent->color = Node::RED; + balance_i(t->parent->parent); + } + else + { + t = t->parent; + if (NULL != t->parent->parent) + parentLeft = t->parent->parent->left == t->parent; + meLeft = t->parent->left == t; + + if (meLeft) + { + if (t->right) + t->right->parent = t->parent; + t->parent->left = t->right; + t->right = t->parent; + if (NULL != t->parent->parent) + if (parentLeft) + t->parent->parent->left = t; + else + t->parent->parent->right = t; + t->parent = t->parent->parent; + t->right->parent = t; + t->color = Node::BLACK; + t->right->color = Node::RED; + } + else + { + if (t->left) + t->left->parent = t->parent; + t->parent->right = t->left; + t->left = t->parent; + if (NULL != t->parent->parent) + if (parentLeft) + t->parent->parent->left = t; + else + t->parent->parent->right = t; + t->parent = t->parent->parent; + t->left->parent = t; + t->color = Node::BLACK; + t->left->color = Node::RED; + } + } + } + } +} + +UtilTree::UtilTree(const UtilTree & i_copy) +{ + comp = i_copy.comp; + clean = i_copy.clean; + copy = i_copy.copy; + + if (NULL == i_copy.root) + root = NULL; + else + { + root = new Node(NULL); + copyNode(root, i_copy.root, NULL); + } +}; + +void UtilTree::copyNode(Node * i_dest, Node * const i_src, Node * i_parent) +{ + i_dest->parent = i_parent; + i_dest->color = i_src->color; + i_dest->value = (*copy)(i_src->value); + if (NULL == i_src->left) + i_dest->left = NULL; + else + { + i_dest->left = new Node(NULL); + copyNode(i_dest->left, i_src->left, i_dest); + } + if (NULL == i_src->right) + i_dest->right = NULL; + else + { + i_dest->right = new Node(NULL); + copyNode(i_dest->right, i_src->right, i_dest); + }; +}; + +UtilTree::iterator & UtilTree::iterator::operator++() +{ + if (NULL == _cur) + return *(this); + + if (NULL == _cur->right) + { + while (_cur != NULL) + { + if (NULL != _cur->parent) + if (_cur == _cur->parent->right) + _cur = _cur->parent; + else + { + _cur = _cur->parent; + break; + } + else + _cur = _cur->parent; + } + } + else + { + _cur = _cur->right; + while (NULL != _cur->left) + _cur = _cur->left; + } + + return *(this); +}; + +UtilTree::iterator & UtilTree::iterator::operator--() +{ + if (NULL == _cur) + return *(this); + + if (NULL == _cur->left) + { + while (_cur != NULL) + { + if (NULL != _cur->parent) + if (_cur == _cur->parent->left) + _cur = _cur->parent; + else + { + _cur = _cur->parent; + break; + } + else + _cur = _cur->parent; + } + } + else + { + _cur = _cur->left; + while (NULL != _cur->right) + _cur = _cur->right; + } + + return *(this); +}; + +UtilTree::iterator UtilTree::begin() const +{ + if (NULL == root) + return end(); + + Node * tmp = root; + while (NULL != tmp->left) + tmp = tmp->left; + + return iterator(tmp, this); +}; + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// F494911 f310 03/04/05 iawillia Initial File Creation +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/util/UtilTree.H b/src/usr/diag/prdf/common/util/UtilTree.H new file mode 100755 index 000000000..b8c18e67e --- /dev/null +++ b/src/usr/diag/prdf/common/util/UtilTree.H @@ -0,0 +1,181 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/UtilTree.H $ */ +/* */ +/* 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 */ + +#ifndef __UTIL_UTILTREE_H +#define __UTIL_UTILTREE_H + +#include <stdint.h> +#include <stddef.h> + +#include <functional> + +#include <iostream> + +namespace UtilTreeSTD +{ + template <class _A, class _B> + class unary_operator : public std::unary_function<_A,_B> + { + public: + virtual _B operator() (_A) const { return _B(); }; + }; + + template <class _A, class _B, class _C> + class binary_operator : public std::binary_function<_A,_B,_C> + { + public: + virtual _C operator() (_A,_B) const { return _C(); }; + }; +}; + +class UtilTree +{ + public: + UtilTree(); + UtilTree(const UtilTree &); + virtual ~UtilTree(); + + void insert(void *); + void remove(void *); + void * find(void *) const; + void * peek() const; + void empty(); + + // temp... + void printTree(); + + typedef UtilTreeSTD::binary_operator<void *, void *, int> + comparator; + typedef UtilTreeSTD::unary_operator<void *, void> + cleanup; + typedef UtilTreeSTD::unary_operator<void *, void *> + copier; + + void setComparator(comparator * i) { comp = i; }; + void setCleanup(cleanup * i) { clean = i; }; + void setCopier(copier * i) { copy = i; }; + + protected: + class defaultComparator : public comparator + { + public: + virtual int operator()(void * _a, void * _b) const + { return (_a < _b ? -1 : (_a == _b ? 0 : 1)); }; + }; + + class defaultCleanup : public cleanup + { + public: + virtual void operator()(void * _a) const { return; }; + }; + + class defaultCopier : public copier + { + public: + virtual void * operator()(void * _a) const { return _a; }; + }; + + class Node; + class Node + { + public: + Node * left; + Node * right; + Node * parent; + bool color; // false = black, true = red. + static const bool BLACK = false; + static const bool RED = true; + void * value; + + // Null pointers, set to red. + Node(void * v) : + left(NULL), right(NULL), parent(NULL), color(true), + value(v) {}; + }; + + Node * root; + comparator * comp; + cleanup * clean; + copier * copy; + + private: + static defaultComparator defComparator; + static defaultCleanup defCleanup; + static defaultCopier defCopy; + + void cleanTree(Node *); + Node * find(void *, Node *) const; + void insert(void *, Node *&); + void balance_i(Node *); + + void copyNode(Node *, Node * const, Node *); + + void printTree(int d, Node *t) + { + if (NULL == t) return; + printTree(d+1, t->left); + for (int i = 0; i < d; i++) + std::cout << "\t"; + std::cout << (t->color ? "R" : "B") << *(int *)t->value << std::endl; + printTree(d+1, t->right); + }; + + public: + class iterator + { + public: + iterator() : _cur(NULL), _tree(NULL) {}; + iterator(const UtilTree * const t) + : _cur(NULL), _tree(t) {}; + iterator(Node * i, const UtilTree * const t) + : _cur(i), _tree(t) {}; + iterator & operator++(); + iterator & operator--(); + void * operator*() { return _cur->value; }; + + bool operator==(const iterator& i) const + { return _cur == i._cur; }; + bool operator!=(const iterator& i) const + { return _cur != i._cur; }; + + iterator & operator=(const iterator& i) + { _cur = i._cur; _tree = i._tree; return *this;}; + + private: + Node * _cur; + const UtilTree * _tree; + }; + + iterator end() const { return iterator(this); }; + iterator begin() const; +}; + +#endif + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// F494911 f310 03/04/05 iawillia Initial File Creation +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/util/UtilTreeX.H b/src/usr/diag/prdf/common/util/UtilTreeX.H new file mode 100755 index 000000000..820adf251 --- /dev/null +++ b/src/usr/diag/prdf/common/util/UtilTreeX.H @@ -0,0 +1,171 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/UtilTreeX.H $ */ +/* */ +/* 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 */ + +#ifndef __UTIL_UTILTREEX_H +#define __UTIL_UTILTREEX_H + +#include "UtilTree.H" + +template <class _T> +class UtilTreeX +{ + public: + UtilTreeX(); + UtilTreeX(const UtilTreeX<_T> &); + + void insert(_T &); + void remove(_T &); + bool find(_T &); + const _T & peek(); + void empty() { cv_tree.empty(); }; + + void printTree() + { + cv_tree.printTree(); + }; + + private: + UtilTree cv_tree; + + class treeXComparator : public UtilTree::comparator + { + public: + virtual int operator() (void * _a, void * _b) const + { + _T * a; + _T * b; + + a = static_cast<_T *>(_a); + b = static_cast<_T *>(_b); + + return (*a < *b ? -1 : (*a == *b ? 0 : 1)); + } + }; + + class treeXCleanup : public UtilTree::cleanup + { + public: + virtual void operator() (void * _a) const + { + _T * a = static_cast<_T *>(_a); + delete a; + }; + }; + + class treeXCopier : public UtilTree::copier + { + public: + virtual void * operator() (void * _a) const + { + _T * a = static_cast<_T *>(_a); + return (void *) new _T(*a); + }; + }; + + treeXComparator cv_compare; + treeXCleanup cv_clean; + treeXCopier cv_copy; + + public: + class iterator + { + private: + UtilTree::iterator _pos; + public: + iterator(UtilTree::iterator i) { _pos = i; }; + iterator & operator++() + { ++_pos; return *this; }; + iterator & operator--() + { --_pos; return *this; }; + bool operator==(const iterator& i) const + { return _pos == i._pos; }; + bool operator!=(const iterator& i) const + { return _pos != i._pos; }; + _T operator*() + { + _T * a = static_cast<_T *>(*_pos); + if (NULL == a) + return _T(); + return *a; + }; + }; + iterator end() const { return iterator(cv_tree.end()); }; + iterator begin() const { return iterator(cv_tree.begin()); }; +}; + +template <class _T> +UtilTreeX<_T>::UtilTreeX() +{ + cv_tree.setComparator(&cv_compare); + cv_tree.setCleanup(&cv_clean); + cv_tree.setCopier(&cv_copy); +}; + +template <class _T> +UtilTreeX<_T>::UtilTreeX(const UtilTreeX<_T> & i_copy) +{ + cv_tree = i_copy.cv_tree; + cv_tree.setComparator(&cv_compare); + cv_tree.setCleanup(&cv_clean); + cv_tree.setCopier(&cv_copy); +}; + + +template <class _T> +void UtilTreeX<_T>::insert(_T & i) +{ + cv_tree.insert((void *)new _T(i)); +}; + +template <class _T> +void UtilTreeX<_T>::remove(_T & i) +{ + cv_tree.remove((void *)&i); +}; + +template <class _T> +bool UtilTreeX<_T>::find(_T & i) +{ + return (NULL != cv_tree.find((void *)&i)); +}; + +template <class _T> +const _T & UtilTreeX<_T>::peek() +{ + static const _T l = _T(); + void * tmp = cv_tree.peek(); + if (NULL == tmp) + return l; + return *static_cast<const _T *>(tmp); +}; + + +#endif + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// F494911 f310 03/04/05 iawillia Initial File Creation +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/util/iipbits.h b/src/usr/diag/prdf/common/util/iipbits.h new file mode 100755 index 000000000..4d00b5cc3 --- /dev/null +++ b/src/usr/diag/prdf/common/util/iipbits.h @@ -0,0 +1,24 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/iipbits.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1993,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 */ + +#include<prdfBitString.H> diff --git a/src/usr/diag/prdf/common/util/iipbtlst.h b/src/usr/diag/prdf/common/util/iipbtlst.h new file mode 100755 index 000000000..6f0f5d840 --- /dev/null +++ b/src/usr/diag/prdf/common/util/iipbtlst.h @@ -0,0 +1,25 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/iipbtlst.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1993,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 */ + +#include <prdfBitKey.H> + diff --git a/src/usr/diag/prdf/common/util/iipdgtb.C b/src/usr/diag/prdf/common/util/iipdgtb.C new file mode 100755 index 000000000..c405c9adb --- /dev/null +++ b/src/usr/diag/prdf/common/util/iipdgtb.C @@ -0,0 +1,294 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/iipdgtb.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1993,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 */ + +#define IIPDGTB_CPP + +/* Module Description *************************************************/ +/* */ +/* Name: iipdgtb.cpp */ +/* */ +/* Description: This module provides the Digit String Byte class + implementation. */ +/* */ +/* End Module Description *********************************************/ + +/* Change Log *********************************************************/ +/* */ +/* Flag PTR/DCR# Userid Date Description */ +/* ---- -------- -------- -------- ----------- */ +/* JST 10/20/93 Initial Creation */ +/* */ +/* End Change Log *****************************************************/ + +/*--------------------------------------------------------------------*/ +/* Emit the virtual function tables and inline function defintions in + this translation unit. */ +/*--------------------------------------------------------------------*/ +#ifdef __GNUC__ +#endif + +/*--------------------------------------------------------------------*/ +/* Includes */ +/*--------------------------------------------------------------------*/ + +#include <string.h> // for memcpy +#include <iipdgtb.h> + +/*--------------------------------------------------------------------*/ +/* User Types */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Constants */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Macros */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Internal Function Prototypes */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Global Variables */ +/*--------------------------------------------------------------------*/ + + // Function Specification ////////////////////////////////////////// + // + // Title: Set String (Virtual) + // + // Purpose: This function allocates memory for the string + // representation. Any memory that has been previously + // allocated is deallocated. + // + // Side-effects: Memory is allocated. + // + // Dependencies: This function must be called at least once prior + // to the first DIgit read or write. + // + // End Function Specification ////////////////////////////////////// + +void DIGIT_STRING_BYTE_CLASS::SetString + ( + void + /*!i No parameters */ + ) + /*!o No value returned */ + { + delete [] xbuffer; + xbuffer = new uint8_t[GetLength()]; + } + + // Function Specification ////////////////////////////////////////// + // + // Title: DIGIT_STRING_BYTE_CLASS (Base Class Copy Constructor) + // + // Purpose: This function initializes the data members. The digit + // string values are also copied. + // + // Side-effects: This instance is initialized. + // Memory is allocated. + // + // Dependencies: All Digit String values must be less than or equal + // to 255. + // + // Time Complexity: Dominated by time complexity of the functions + // called. + // + // End Function Specification ////////////////////////////////////// + +DIGIT_STRING_BYTE_CLASS::DIGIT_STRING_BYTE_CLASS + ( + const DIGIT_STRING_CLASS & string + /*!i Digit String instance to copy */ + ) : + /*!o No value returned */ + DIGIT_STRING_CLASS(string), + xbuffer(NULL) + { + SetString(); + SetValues(string); + } + + // Function Specification ////////////////////////////////////////// + // + // Title: DIGIT_STRING_BYTE_CLASS (Copy Constructor) + // + // Purpose: This function initializes the data members. The digit + // string values are also copied. + // + // Side-effects: This instance is initialized. + // + // Dependencies: None. + // + // Time Complexity: 0(m) where m is the length of the string being + // copied. + // + // End Function Specification ////////////////////////////////////// + +DIGIT_STRING_BYTE_CLASS::DIGIT_STRING_BYTE_CLASS + ( + const DIGIT_STRING_BYTE_CLASS & string + /*!i Digit String instance to copy */ + ) : + /*!o Reference to this Digit String instance */ + DIGIT_STRING_CLASS(string), + xbuffer(NULL) + { + SetString(); + + // Use direct copy of buffer since the lengths are equal + memcpy(xbuffer, string.xbuffer, GetLength()); + } + + // Function Specification ////////////////////////////////////////// + // + // Title: ~DIGIT_STRING_BYTE_CLASS (Virtual destructor) + // + // Purpose: This function deallocates the digit string + // representation. + // + // Side-effects: Memory is deallocated. + // + // Dependencies: None. + // + // End Function Specification ////////////////////////////////////// + +DIGIT_STRING_BYTE_CLASS::~DIGIT_STRING_BYTE_CLASS + ( + void + /*!i No paramters */ + ) + /*!o No value returned */ + { + delete [] xbuffer; + } + + // Function Specification ////////////////////////////////////////// + // + // Title: Assingment operator + // + // Purpose: This function assigns the data members with the values + // from the Digit String reference. The digit string + // values are also assigned. + // + // Side-effects: Data members are modified. + // + // Dependencies: None. + // + // Time Complexity: Dominated by time complexity of the functions + // called. + // + // End Function Specification ////////////////////////////////////// + +DIGIT_STRING_BYTE_CLASS & DIGIT_STRING_BYTE_CLASS::operator= + ( + const DIGIT_STRING_CLASS & string + /*!i Digit string instance to assign from */ + ) + /*!o Reference to this Digit String instance */ + { + // Check for assignment to self + if(this != &string) + { + // Assign the base class part + DIGIT_STRING_CLASS::operator=(string); + + // Assign the derived class part + SetString(); + SetValues(string); + } + + return(*this); + } + +DIGIT_STRING_BYTE_CLASS & DIGIT_STRING_BYTE_CLASS::operator= + ( + const DIGIT_STRING_BYTE_CLASS & string + /*!i Digit string instance to assign from */ + ) + /*!o Reference to this Digit String instance */ + { + // Check for assignment to self + if(this != &string) + { + // Assign the base class part + DIGIT_STRING_CLASS::operator=(string); + + // Assign the derived class part + SetString(); + SetValues(string); + } + + return(*this); + } + // Function Specification ////////////////////////////////////////// + // + // Title: Get Value (Virtual) + // + // Purpose: This function returns the value of a digit at the + // specified position. + // + // Side-effects: None. + // + // Dependencies: Position must be in the string. + // + // End Function Specification ////////////////////////////////////// + +uint32_t DIGIT_STRING_BYTE_CLASS::GetValue + ( + uint32_t offset + /*!i Digit offset */ + ) const + /*!o Digit value */ + { + return(xbuffer[offset]); + } + + // Function Specification ////////////////////////////////////////// + // + // Title: Set Value (Pure virtual) + // + // Purpose: This function sets the value of the digit at the + // specified position. No other digits are affected. + // + // Side-effects: A digit in the string is modified. + // + // Dependencies: Position must be in the string. + // + // End Function Specification ////////////////////////////////////// + +void DIGIT_STRING_BYTE_CLASS::SetValue + ( + uint32_t offset, + /*!i Digit offset */ + uint32_t value + /*!i Digit value to set */ + ) + /*!o No value returned */ + { + xbuffer[offset] = value; + } + +#undef IIPDGTB_CPP diff --git a/src/usr/diag/prdf/common/util/iipdgtb.h b/src/usr/diag/prdf/common/util/iipdgtb.h new file mode 100755 index 000000000..94aaa6c56 --- /dev/null +++ b/src/usr/diag/prdf/common/util/iipdgtb.h @@ -0,0 +1,324 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/iipdgtb.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1993,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 IIPDGTB_H +#define IIPDGTB_H + +/* Module Description *************************************************/ +/* */ +/* Name: iipdgtb.h */ +/* */ +/* Description: This module provides the Digit String Byte class + declaration. */ +/* */ +/* End Module Description *********************************************/ + +/* Change Log *********************************************************/ +/* */ +/* Flag PTR/DCR# Userid Date Description */ +/* ---- -------- -------- -------- ----------- */ +/* JST 10/20/93 Initial Creation */ +/* */ +/* End Change Log *****************************************************/ + +/*--------------------------------------------------------------------*/ +/* Reference the virtual function tables and inline function + defintions in another translation unit. */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Includes */ +/*--------------------------------------------------------------------*/ + +#include <iipdigit.h> + +/*--------------------------------------------------------------------*/ +/* Forward References */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* User Types */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Constants */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Macros */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Global Variables */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Function Prototypes */ +/*--------------------------------------------------------------------*/ + +/* Class Specification ************************************************/ +/* */ +/* Name: DIGIT_STRING_BYTE_CLASS */ +/* */ +/* Title: Byte Digit String */ +/* */ +/* Purpose: DIGIT_STRING_BYTE_CLASS provides an efficient + representation using a byte (8 bits) for each digit in + the string. */ +/* */ +/* Usage: This is general purpose base class. */ +/* */ +/* Side-effects: Memory is allocated. */ +/* */ +/* Dependencies: None. */ +/* */ +/* Notes: The Compact Digit String represents each digit in the + string using a byte. This limits the maximum_digit_value + that can be represented to 255. If an attempt is made + to set a digit to a value greater than 255, then the + contents and behaviour of the Digit String are undefined. */ +/* */ +/* Cardinality: N */ +/* */ +/* Metaclass: None. */ +/* */ +/* Space Complexity: O(m) where m is the number of digits in the + string. */ +/* */ +/* End Class Specification ********************************************/ + +class DIGIT_STRING_BYTE_CLASS : public DIGIT_STRING_CLASS + { + private: + + // Data Specification ////////////////////////////////////////////// + // + // Purpose: This buffer is dynamically allocated for digits. + // + // End Data Specification ////////////////////////////////////////// + + uint8_t * xbuffer; + + protected: + + // Function Specification ////////////////////////////////////////// + // + // Title: Set String (Virtual) + // + // Purpose: This function allocates memory for the string + // representation. Any memory that has been previously + // allocated is deallocated. + // + // Side-effects: Memory is allocated. + // + // Dependencies: This function must be called at least once prior + // to the first Digit read or write. + // + // End Function Specification ////////////////////////////////////// + + virtual void SetString + ( + void + /*!i No parameters */ + ); + /*!o No value returned */ + + public: + + // Function Specification ////////////////////////////////////////// + // + // Title: DIGIT_STRING_BYTE_CLASS (Constructor) + // + // Purpose: This function initializes the data members. + // + // Side-effects: This instance is initialized. + // Memory is allocated. + // + // Dependencies: None. + // + // Time Complexity: Dominated by time complexity of SetString(). + // + // End Function Specification ////////////////////////////////////// + + DIGIT_STRING_BYTE_CLASS + ( + uint32_t mdv, + /*!i Maximum digit value */ + uint32_t l + /*!i String length */ + ) : + /*!o No value returned */ + DIGIT_STRING_CLASS(mdv, l), + xbuffer(NULL) + { + SetString(); + } + + // Function Specification ////////////////////////////////////////// + // + // Title: DIGIT_STRING_BYTE_CLASS (Base Class Copy Constructor) + // + // Purpose: This function initializes the data members. The digit + // string values are also copied. + // + // Side-effects: This instance is initialized. + // Memory is allocated. + // + // Dependencies: All Digit String values must be less than or equal + // to 255. + // + // Time Complexity: Dominated by time complexity of the functions + // called. + // + // End Function Specification ////////////////////////////////////// + + DIGIT_STRING_BYTE_CLASS + ( + const DIGIT_STRING_CLASS & string + /*!i Digit String reference to copy */ + ); + /*!o No value returned */ + + // Function Specification ////////////////////////////////////////// + // + // Title: DIGIT_STRING_BYTE_CLASS (Copy Constructor) + // + // Purpose: This function initializes the data members. The digit + // string values are also copied. + // + // Side-effects: This instance is initialized. + // Memory is allocated. + // + // Dependencies: None. + // + // Time Complexity: Dominated by time complexity of the functions + // called. + // + // End Function Specification ////////////////////////////////////// + + DIGIT_STRING_BYTE_CLASS + ( + const DIGIT_STRING_BYTE_CLASS & string + /*!i Digit String Compact reference to copy */ + ); + /*!o No value returned */ + + // Function Specification ////////////////////////////////////////// + // + // Title: ~DIGIT_STRING_BYTE_CLASS (Virtual destructor) + // + // Purpose: This function deallocates the digit string + // representation. + // + // Side-effects: Memory is deallocated. + // + // Dependencies: None. + // + // End Function Specification ////////////////////////////////////// + + virtual ~DIGIT_STRING_BYTE_CLASS + ( + void + /*!i No paramters */ + ); + /*!o No value returned */ + + // Function Specification ////////////////////////////////////////// + // + // Title: Assingment operator + // + // Purpose: This function assigns the data members with the values + // from the Digit String reference. The digit string + // values are also assigned. + // + // Side-effects: Data members are modified. + // Memory is reallocated. + // + // Dependencies: All Digit String values must be less than or equal + // to 255. + // + // Time Complexity: Dominated by time complexity of the functions + // called. + // + // End Function Specification ////////////////////////////////////// + + DIGIT_STRING_BYTE_CLASS & operator= + ( + const DIGIT_STRING_CLASS & string + /*!i Digit string instance to assign from */ + ); + /*!o Reference to this Digit String instance */ + + DIGIT_STRING_BYTE_CLASS & operator= + ( + const DIGIT_STRING_BYTE_CLASS & string + /*!i Digit string instance to assign from */ + ); + + // Function Specification ////////////////////////////////////////// + // + // Title: Get Value (Virtual) + // + // Purpose: This function returns the value of a digit at the + // specified position. + // + // Side-effects: None. + // + // Dependencies: Position must be in the string. + // + // End Function Specification ////////////////////////////////////// + + virtual uint32_t GetValue + ( + uint32_t offset + /*!i Digit offset */ + ) const; + /*!o Digit value */ + + // Function Specification ////////////////////////////////////////// + // + // Title: Set Value (Virtual) + // + // Purpose: This function sets the value of the digit at the + // specified position. No other digits are affected. + // + // Side-effects: A digit in the string is modified. + // + // Dependencies: Position must be in the string. + // Digit value must be less than or equal to 255. + // + // End Function Specification ////////////////////////////////////// + + virtual void SetValue + ( + uint32_t offset, + /*!i Digit offset */ + uint32_t value + /*!i Digit value to set */ + ); + /*!o No value returned */ + + }; + + +#endif diff --git a/src/usr/diag/prdf/common/util/iipdigit.C b/src/usr/diag/prdf/common/util/iipdigit.C new file mode 100755 index 000000000..5fc676844 --- /dev/null +++ b/src/usr/diag/prdf/common/util/iipdigit.C @@ -0,0 +1,181 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/iipdigit.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1993,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 */ + +#define IIPDIGIT_CPP + +/* Module Description *************************************************/ +/* */ +/* Name: iipdigit.cpp */ +/* */ +/* Description: This module provides the Digit String class + implementation. */ +/* */ +/* End Module Description *********************************************/ + +/* Change Log *********************************************************/ +/* */ +/* Flag PTR/DCR# Userid Date Description */ +/* ---- -------- -------- -------- ----------- */ +/* JST 06/07/93 Initial Creation */ +/* */ +/* End Change Log *****************************************************/ + +/*--------------------------------------------------------------------*/ +/* Emit the virtual function tables and inline function defintions in + this translation unit. */ +/*--------------------------------------------------------------------*/ +#ifdef __GNUC__ +#endif + +/*--------------------------------------------------------------------*/ +/* Includes */ +/*--------------------------------------------------------------------*/ + +#include <iipdigit.h> + +/*--------------------------------------------------------------------*/ +/* User Types */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Constants */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Macros */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Internal Function Prototypes */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Global Variables */ +/*--------------------------------------------------------------------*/ + + // Function Specification ////////////////////////////////////////// + // + // Title: Set Values + // + // Purpose: This function sets the values of the string at + // corresponding positions. If one of the Digit Strings + // is larger, than the extra digits are ignored. If a + // value from the string is larger than the + // maximum_digit_value, then the digit is set to the + // maximum_digit_value. + // + // Side-effects: Digits in string are modified. + // + // Dependencies: None. + // + // Time Complexity: O(m) where m is the length + // + // End Function Specification ////////////////////////////////////// + +void DIGIT_STRING_CLASS::SetValues + ( + const DIGIT_STRING_CLASS & string + /*!i Reference to Digit string set set values from */ + ) + /*!o No value returned */ + { + for(unsigned int i = 0;i < length;i++) + { + if(i < string.length) + { + SetValue(i, string.GetValue(i)); + } + } + } + + // Function Specification ////////////////////////////////////////// + // + // Title: Fill + // + // Purpose: This function sets the value of each digit in the + // string with the same specified value. + // + // Side-effects: All digits in the string is modified. + // + // Dependencies: None. + // + // Time Complexity: O(m) where m is the length + // + // End Function Specification ////////////////////////////////////// + +void DIGIT_STRING_CLASS::Fill + ( + uint32_t value + /*!i Digit value for each position */ + ) + /*!o No value returned */ + { + for(unsigned int i = 0;i < length;i++) + { + SetValue(i, value); + } + } + + // Function Specification ////////////////////////////////////////// + // + // Title: Equality operator + // + // Purpose: This function determines if the specified string is + // equal two this one. If the lengths are equal and the + // corresponding values at every position are equal, then + // the Digit strings are equal. + // + // Side-effects: None. + // + // Dependencies: None. + // + // Time Complexity: O(m) where m is the length + // + // End Function Specification ////////////////////////////////////// + +bool DIGIT_STRING_CLASS::operator== +( + const DIGIT_STRING_CLASS & string + /*!i Digit string instance to compare */ + ) const +/*!o Non-zero if digit strings are equal, otherwise zero */ +{ + bool rc = (length == string.length); + + if(rc) + { + for(unsigned int i = 0;i < length;i++) + { + if(GetValue(i) != string.GetValue(i)) + { + rc = false; + break; + } + } + } + + return(rc); +} + + +#undef IIPDIGIT_CPP diff --git a/src/usr/diag/prdf/common/util/iipdigit.h b/src/usr/diag/prdf/common/util/iipdigit.h new file mode 100755 index 000000000..b81d2e1a9 --- /dev/null +++ b/src/usr/diag/prdf/common/util/iipdigit.h @@ -0,0 +1,477 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/iipdigit.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1993,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 IIPDIGIT_H +#define IIPDIGIT_H + +/* Module Description *************************************************/ +/* */ +/* Name: iipdigit.h */ +/* */ +/* Description: This module provides the Digit String class + hierarchy definition. */ +/* */ +/* End Module Description *********************************************/ + +/* Change Log *********************************************************/ +/* */ +/* Flag PTR/DCR# Userid Date Description */ +/* ---- -------- -------- -------- ----------- */ +/* JST 06/04/93 Initial Creation */ +/* D24694.3 JST 06/13/94 I1 Review changes */ +/* */ +/* End Change Log *****************************************************/ + +/*--------------------------------------------------------------------*/ +/* Reference the virtual function tables and inline function + defintions in another translation unit. */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Includes */ +/*--------------------------------------------------------------------*/ + +#include <prdf_types.h> + +/*--------------------------------------------------------------------*/ +/* Forward References */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* User Types */ +/*--------------------------------------------------------------------*/ + +// Type Specification ////////////////////////////////////////////////// +// +// Title: CPU_WORD +// +// Purpose: This type is used to take advantage of the most efficient +// memory reference size for a specific CPU architecture. +// This type defintion is provided only to handle the case +// where no previous defintions exists. +// +// End Type Specification ////////////////////////////////////////////// + +#ifndef CPU_WORD + +typedef uint32_t CPU_WORD; + +#endif + +/*--------------------------------------------------------------------*/ +/* Constants */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Macros */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Global Variables */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Function Prototypes */ +/*--------------------------------------------------------------------*/ + +/* Class Specification ************************************************/ +/* */ +/* Name: DIGIT_STRING_CLASS */ +/* */ +/* Title: Digit String */ +/* */ +/* Purpose: DIGIT_STRING_CLASS provides the representation and + access to a sequence of digits in a specified range. */ +/* */ +/* Usage: This is an abstract base class. */ +/* */ +/* Side-effects: None. */ +/* */ +/* Dependencies: Access operations must specify position less than + the length. */ +/* */ +/* Notes: The Digit String maintains a sequence of digits in the + range of 0 to maximum_digit_value. If a value that is + being written is is larger than the maximum_digit_value, + then the digit is set to the maximum_digit_value. A + length of 0 is allowed, but no digits can be accessed. If + length is greater than 0, then the Digit positions are + specified 0 to (length - 1) from left to right. + + 0 1 2 3 .... (length - 1) + + D D D D .... D */ +/* */ +/* Cardinality: 0 */ +/* */ +/* Space Complexity: Constant */ +/* */ +/* End Class Specification ********************************************/ + +class DIGIT_STRING_CLASS + { + public: + + // Function Specification ////////////////////////////////////////// + // + // Title: ~DIGIT_STRING_CLASS (Virtual destructor) + // + // Purpose: This function performs no special action. + // + // Side-effects: This instance is no longer valid. + // + // Dependencies: None. + // + // Notes: This function performs the same action as a default + // defintion. It is included because the virtual + // declaration is required for this base class. + // + // End Function Specification ////////////////////////////////////// + + virtual ~DIGIT_STRING_CLASS + ( + void + /*!i No paramters */ + ) + /*!o No value returned */ + { + } + + // Function Specification ////////////////////////////////////////// + // + // Title: Assingment operator + // + // Purpose: This function assigns the data members with the values + // from the Digit String reference. + // + // Side-effects: Data members are modified. + // + // Dependencies: None. + // + // Notes: This function performs the same action as a default + // defintion. It is included here to emphasize the actions + // performed and the need for an explicit definition in each + // derived class. + // + // End Function Specification ////////////////////////////////////// + + DIGIT_STRING_CLASS & operator= + ( + const DIGIT_STRING_CLASS & string + /*!i Digit string instance to assign from */ + ) + /*!o Reference to this Digit String instance */ + { + // No check for assignment to self is required + + maximum_digit_value = string.maximum_digit_value; + length = string.length; + + return(*this); + } + + // Function Specification ////////////////////////////////////////// + // + // Title: Get Value (Pure virtual) + // + // Purpose: This function returns the value of a digit at the + // specified position. + // + // Side-effects: None. + // + // Dependencies: Position must be in the string. + // + // Notes: This function has no definition. + // + // End Function Specification ////////////////////////////////////// + + virtual uint32_t GetValue + ( + uint32_t position + /*!i Digit position */ + ) const = 0; + /*!o Digit value */ + + // Function Specification ////////////////////////////////////////// + // + // Title: Set Value (Pure virtual) + // + // Purpose: This function sets the value of the digit at the + // specified position. No other digits are affected. + // + // Side-effects: A digit in the string is modified. + // + // Dependencies: Position must be in the string. + // + // Notes: This function has no definition. + // + // End Function Specification ////////////////////////////////////// + + virtual void SetValue + ( + uint32_t position, + /*!i Digit position */ + uint32_t value + /*!i Digit value to set */ + ) = 0; + /*!o No value returned */ + + // Function Specification ////////////////////////////////////////// + // + // Title: Fill + // + // Purpose: This function sets the value of each digit in the + // string with the same specified value. + // + // Side-effects: All digits in the string is modified. + // + // Dependencies: None. + // + // Time Complexity: O(m) where m is the length + // + // End Function Specification ////////////////////////////////////// + + void Fill + ( + uint32_t value + /*!i Digit value for each position */ + ); + /*!o No value returned */ + + // Function Specification ////////////////////////////////////////// + // + // Title: Equality operator + // + // Purpose: This function determines if the specified string is + // equal two this one. If the lengths are equal and the + // corresponding values at every position are equal, then + // the Digit strings are equal. + // + // Side-effects: None. + // + // Dependencies: None. + // + // Time Complexity: O(m) where m is the length + // + // End Function Specification ////////////////////////////////////// + + bool operator== + ( + const DIGIT_STRING_CLASS & string + /*!i Digit string instance to compare */ + ) const; + /*!o Non-zero if digit strings are equal, otherwise zero */ + + // Function Specification ////////////////////////////////////////// + // + // Title: Get Maximum Digit Value + // + // Purpose: This function returns the maximum digit value. + // + // Side-effects: None. + // + // Dependencies: None. + // + // End Function Specification ////////////////////////////////////// + + uint32_t GetMaximumDigitValue + ( + void + /*!i No parameters */ + ) const + /*!o Maximum allowable digit value in the string */ + { + return(maximum_digit_value); + } + + // Function Specification ////////////////////////////////////////// + // + // Title: Get Length + // + // Purpose: This function returns the length. + // + // Side-effects: None. + // + // Dependencies: None. + // + // End Function Specification ////////////////////////////////////// + + uint32_t GetLength + ( + void + /*!i No parameters */ + ) const + /*!o Digit string length */ + { + return(length); + } + + protected: + + // Function Specification ////////////////////////////////////////// + // + // Title: DIGIT_STRING_CLASS (Constructor) + // + // Purpose: This function initializes the data members. + // + // Side-effects: This instance is initialized. + // + // Dependencies: None. + // + // End Function Specification ////////////////////////////////////// + + DIGIT_STRING_CLASS + ( + uint32_t mdv, + /*!i Maximum digit value */ + uint32_t le + /*!i Digit length */ + ) : + /*!o No value returned */ + maximum_digit_value(mdv), + length(le) + { + } + + // Function Specification ////////////////////////////////////////// + // + // Title: DIGIT_STRING_CLASS (Copy constructor) + // + // Purpose: This function initializes the data members from the + // Digit String reference. + // + // Side-effects: This instance is initialized. + // + // Dependencies: None. + // + // Notes: This function performs the same action as a default + // defintion. It is included here to emphasize the actions + // performed and the need for an explicit definition in each + // derived class. + // + // End Function Specification ////////////////////////////////////// + + DIGIT_STRING_CLASS + ( + const DIGIT_STRING_CLASS & string + /*!i Digit string reference to copy */ + ) : + /*!o No value returned */ + maximum_digit_value(string.maximum_digit_value), + length(string.length) + { + } + + // Function Specification /////////////////////////////////////////// + // + // Title: Set String (Pure virtual) + // + // Purpose: This function performs any required representation + // actions. + // + // Side-effects: The Digit String is valid. + // + // Dependencies: This function must be called at least once prior + // to the first DIgit read or write. + // + // Notes: This function has no definition. + // + // End Function Specification ////////////////////////////////////// + + virtual void SetString + ( + void + /*!i No parameters */ + ) = 0; + /*!o No value returned */ + + // Function Specification /////////////////////////////////////////// + // + // Title: Set String + // + // Purpose: This function assigns the data members and calls + // SetString() to perform any required representation + // actions. + // + // Side-effects: The Digit String is valid. + // + // Dependencies: None. + // + // End Function Specification ////////////////////////////////////// + + void SetString + ( + uint32_t mdv, + /*!i Maximum digit value */ + uint32_t le + /*!i Digit length */ + ) + /*!o No value returned */ + { + maximum_digit_value = mdv; + length = le; + + SetString(); + } + + // Function Specification ////////////////////////////////////////// + // + // Title: Set Values + // + // Purpose: This function sets the values of the string at + // corresponding positions. If one of the Digit Strings + // is larger, than the extra digits are ignored. If a + // value from the string is larger than the + // maximum_digit_value, then the digit is set to the + // maximum_digit_value. + // + // Side-effects: Digits in string are modified. + // + // Dependencies: None. + // + // Time Complexity: O(m) where m is the length + // + // End Function Specification ////////////////////////////////////// + + virtual void SetValues + ( + const DIGIT_STRING_CLASS & string + /*!i Reference to Digit string set set values from */ + ); + /*!o No value returned */ + + private: + + // Data Specification ////////////////////////////////////////////// + // + // Purpose: This data is used to maintain the Digit String. + // + // End Data Specification ////////////////////////////////////////// + + uint32_t maximum_digit_value; + uint32_t length; + + }; + + +#endif diff --git a/src/usr/diag/prdf/common/util/iipfltr.h b/src/usr/diag/prdf/common/util/iipfltr.h new file mode 100755 index 000000000..182bd4ac4 --- /dev/null +++ b/src/usr/diag/prdf/common/util/iipfltr.h @@ -0,0 +1,26 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/iipfltr.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1993,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(PRDFFILTER_H) +#include <prdfFilters.H> +#endif diff --git a/src/usr/diag/prdf/common/util/prdfAssert.C b/src/usr/diag/prdf/common/util/prdfAssert.C new file mode 100755 index 000000000..4762e11da --- /dev/null +++ b/src/usr/diag/prdf/common/util/prdfAssert.C @@ -0,0 +1,103 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/prdfAssert.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 */ + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- + +#define prdfAssert_C + +#include <prdfAssert.h> +#include <iipglobl.h> +#include <stdlib.h> +#include <errlentry.H> +#include <prdf_service_codes.H> +#include <prdfMain.H> + +#ifdef __HOSTBOOT_MODULE + #include <assert.h> + #include <stdio.h> +#else + #include <perc.H> +#endif + +#undef prdfAssert_C + +using namespace PRDF; + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +void prdfAssert( const char * i_exp, const char * i_file, int i_line ) +{ + PRDF_ERR( "prdfAssert(%s) in %s line %d", i_exp, i_file, i_line ); + + errlHndl_t errl = NULL; + + /*@ + * @errortype + * @subsys EPUB_FIRMWARE_SP + * @reasoncode PRDF_CODE_FAIL + * @moduleid PRDF_ASSERT + * @userdata1 0 + * @userdata2 Line number of the assert + * @userdata3 0 + * @userdata4 PRD Return code + * @devdesc PRD assert + * @procedure EPUB_PRC_SP_CODE + */ + PRDF_CREATE_ERRL(errl, + ERRL_SEV_PREDICTIVE, // error on diagnostic + ERRL_ETYPE_NOT_APPLICABLE, + SRCI_ERR_INFO, + SRCI_NO_ATTR, + PRDF_ASSERT, // module id + FSP_DEFAULT_REFCODE, // refcode + PRDF_CODE_FAIL, // Reason code + 0, // user data word 1 + i_line, // user data word 2 + 0, // user data word 3 + PRD_ASSERT); // user data word 4 + + PRDF_ADD_PROCEDURE_CALLOUT(errl, SRCI_PRIORITY_MED, EPUB_PRC_SP_CODE); + PRDF_SET_RC(errl, PRD_ASSERT); + PRDF_COLLECT_TRACE(errl, 256); + PRDF_COMMIT_ERRL(errl, ERRL_ACTION_SA); + + #ifdef __HOSTBOOT_MODULE + + assert(0); + + #else + + const size_t sz_msg = 160; + char msg[sz_msg]; + errlslen_t msize = snprintf( msg, sz_msg, "prdfAssert(%s) in %s line %d", + i_exp, i_file, i_line ); + + percAbend(PRDF_COMP_ID, msg, msize+1, 0, 0); + abort(); + + #endif +} diff --git a/src/usr/diag/prdf/common/util/prdfAssert.h b/src/usr/diag/prdf/common/util/prdfAssert.h new file mode 100755 index 000000000..5e5b83e15 --- /dev/null +++ b/src/usr/diag/prdf/common/util/prdfAssert.h @@ -0,0 +1,41 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/prdfAssert.h $ */ +/* */ +/* 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 */ + +#ifndef PRDFASSERT_H +#define PRDFASSERT_H + +/** + * @file prdfAssert.h + */ + +#define PRDF_ASSERT(x) { if(!(x)) { prdfAssert(#x,__FILE__,__LINE__); } } + +/** + * @brief PRD implementation of assert(). + * @param i_exp A boolean expression. + * @param i_file The file calling assert(). + * @param i_line The line of the file in which assert() is called. + */ +void prdfAssert( const char * i_exp, const char * i_file, int i_line ); + +#endif /* PRDFASSERT_H */ diff --git a/src/usr/diag/prdf/common/util/prdfBitKey.C b/src/usr/diag/prdf/common/util/prdfBitKey.C new file mode 100755 index 000000000..0245d26b3 --- /dev/null +++ b/src/usr/diag/prdf/common/util/prdfBitKey.C @@ -0,0 +1,362 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/prdfBitKey.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 */ + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define prdfBitKey_C + +//#include <prdfAssert.h> +#include <prdfBitKey.H> +#include <prdfBitString.H> +#include <string.h> + +#undef prdfBitKey_C + +//------------------------------------------------------------------------------------------------- +// Local +//------------------------------------------------------------------------------------------------- +inline uint32_t getWordSize(uint32_t bitCount) // # of bit32's needed for this bit_count +{ + return (bitCount/32) + ((bitCount%32)? 1:0); +} + +//------------------------------------------------------------------------------------------------- +// member function definitions +//------------------------------------------------------------------------------------------------- + +prdfBitKey::prdfBitKey(void) +: iv_Capacity(0), iv_storage1(0) +{ + iv_rep.storage2 = 0; +} + +//------------------------------------------------------------------------------------------------- + +prdfBitKey::prdfBitKey(uint32_t i_bitPos) +: iv_Capacity(0), iv_storage1(0) +{ + iv_rep.storage2 = 0; + setBit(i_bitPos); +} + +//------------------------------------------------------------------------------------------------- + +prdfBitKey::prdfBitKey(const uint8_t * i_array,uint8_t i_size) +: iv_Capacity(0), iv_storage1(0) +{ + iv_rep.storage2 = 0; + while(i_size) + { + setBit(*i_array); + --i_size; + ++i_array; + } +} + +//------------------------------------------------------------------------------------------------- + +prdfBitKey::prdfBitKey(const char * i_ble) +: iv_Capacity(0), iv_storage1(0) +{ + iv_rep.storage2 = 0; + while(*i_ble != 0) + { + setBit((*i_ble) - 1); + ++i_ble; + } +} + +//------------------------------------------------------------------------------------------------- + +prdfBitKey::~prdfBitKey(void) +{ + if(!IsDirect()) delete [] iv_rep.buffer; +} + +//------------------------------------------------------------------------------------------------- + +prdfBitKey::prdfBitKey (const prdfBitKey & bit_list) +: iv_Capacity(bit_list.iv_Capacity), iv_storage1(bit_list.iv_storage1) +{ + if(IsDirect()) + { + iv_rep.storage2 = bit_list.iv_rep.storage2; + } + else + { + uint32_t size = getWordSize(iv_Capacity); + iv_rep.buffer = new uint32_t[size]; + memcpy(iv_rep.buffer,bit_list.iv_rep.buffer,4*size); + } +} + +//------------------------------------------------------------------------------------------------- + +prdfBitKey & prdfBitKey::operator=(const prdfBitKey & bit_list) +{ + if(iv_Capacity) + { + prdfBitString bs(iv_Capacity,DataPtr()); + bs.Pattern(0x00000000); + } + ReAllocate(bit_list.iv_Capacity); + if(IsDirect()) // implies bit_list is also direct + { + iv_storage1 = bit_list.iv_storage1; + iv_rep.storage2 = bit_list.iv_rep.storage2; + } + else + { + const uint32_t * dataPtr = NULL; + if(bit_list.IsDirect()) + { + dataPtr = &bit_list.iv_storage1; + } else + { + dataPtr = bit_list.iv_rep.buffer; + } + memcpy(iv_rep.buffer,dataPtr,4*getWordSize(bit_list.iv_Capacity)); + } + return(*this); +} + +//------------------------------------------------------------------------------------------------- + +prdfBitKey & prdfBitKey::operator=(const prdfBitString & bit_string) +{ + if(iv_Capacity) + { + prdfBitString bs(iv_Capacity,DataPtr()); + bs.Pattern(0x00000000); + } + ReAllocate(bit_string.GetLength()); + prdfBitString dbs(iv_Capacity,DataPtr()); + dbs.SetBits(bit_string); + return(*this); +} + +//------------------------------------------------------------------------------------------------- + +prdfBitKey & prdfBitKey::operator=(const char * string_ptr) +{ + if(iv_Capacity) + { + prdfBitString bs(iv_Capacity,DataPtr()); + bs.Pattern(0x00000000); + } + + while(*string_ptr != '\0') + { + uint32_t bit_position = (uint32_t) ((*string_ptr) - 1); + setBit(bit_position); + ++string_ptr; + } + return(*this); +} + +//------------------------------------------------------------------------------------------------- + +bool prdfBitKey::operator==(const prdfBitKey & that) const +{ + bool result = true; + const uint32_t * mydata = cDataPtr(); + const uint32_t * yodata = that.cDataPtr(); + uint32_t mysize = getWordSize(iv_Capacity); + uint32_t yosize = getWordSize(that.iv_Capacity); + uint32_t smsize = (yosize < mysize)? yosize : mysize; + + // If size is different than the extra must be zero + for(uint32_t i = 0; (i < smsize) && (result == true); ++i,++mydata,++yodata) + { + result = (*mydata == *yodata); + } + if(result && (yosize > mysize)) + { + for(yosize -= mysize; yosize != 0 && result; --yosize, ++yodata) + { + result = *yodata == 0x00000000; + } + } + else if (result && (mysize > yosize)) + { + for(mysize -= yosize; mysize != 0 && result; --mysize, ++mydata) + { + result = *mydata == 0x00000000; + } + } + + return result; +} + + +//------------------------------------------------------------------------------------------------- + +// Candidate funciton for bs class +bool prdfBitKey::isSubset(const prdfBitKey & that) const +{ + bool result = true; + const uint32_t * mydata = cDataPtr(); + const uint32_t * yodata = that.cDataPtr(); + uint32_t mysize = getWordSize(iv_Capacity); + uint32_t yosize = getWordSize(that.iv_Capacity); + uint32_t smsize = (yosize < mysize)? yosize : mysize; + // size can be non-zero with no bits on - so if that has no bits than use operator== + prdfBitKey zero; + if(that == zero) result = operator==(that); // only true if both are empty - eg not bits on" + // if yosize <= mysize than just match smallest amount of data + // if yozize > mysize than extra yodata must be zero + for(uint32_t i = 0; (i < smsize) && (result == true); ++i,++mydata,++yodata) + { + result = (*mydata & *yodata) == *yodata; + } + if(result && (yosize > mysize)) + { + for(yosize -= mysize; yosize != 0 && result; --yosize, ++yodata) + { + result = *yodata == 0x00000000; + } + } + + return result; +} + +//------------------------------------------------------------------------------------------------- + +// get bit position of nth bit that is set +uint32_t prdfBitKey::getListValue(uint32_t n) const +{ + ++n; + uint32_t setCount = 0; + uint32_t bitPos = 0xffffffff; + + prdfBitString bs(iv_Capacity,(CPU_WORD *)cDataPtr()); + for(uint32_t i = 0; i < iv_Capacity; ++i) + { + if(bs.IsSet(i)) ++setCount; + if(setCount == n) + { + bitPos = i; + break; + } + } + return bitPos; +} + +//------------------------------------------------------------------------------------------------- + +uint32_t prdfBitKey::size(void) const +{ + const prdfBitString bs(iv_Capacity,(CPU_WORD *)cDataPtr()); + return bs.GetSetCount(); +} + +//------------------------------------------------------------------------------------------------- + +void prdfBitKey::removeBit(uint32_t n) +{ + if(n < size()) + { + prdfBitString bs(iv_Capacity,DataPtr()); + bs.Clear(getListValue(n)); + } +} + +//------------------------------------------------------------------------------------------------- + +void prdfBitKey::removeBit(void) +{ + prdfBitString bs(iv_Capacity,DataPtr()); + uint32_t i = iv_Capacity; + while(i != 0) + { + --i; + if(bs.IsSet(i)) + { + bs.Clear(i); + break; + } + } +} + +//------------------------------------------------------------------------------------------------- + +void prdfBitKey::removeBits(const prdfBitKey & i_bk) +{ + prdfBitString mybs(iv_Capacity,(CPU_WORD *)DataPtr()); + const prdfBitString yobs(i_bk.iv_Capacity,(CPU_WORD *)i_bk.cDataPtr()); + mybs.Mask(yobs); +} + +//------------------------------------------------------------------------------------------------- + +void prdfBitKey::setBit(uint32_t i_bitValue) +{ + if(i_bitValue >= iv_Capacity) + { + ReAllocate(i_bitValue+1); + } + prdfBitString bs(iv_Capacity,DataPtr()); + bs.Set(i_bitValue); +} + +//------------------------------------------------------------------------------------------------- + +void prdfBitKey::ReAllocate(uint32_t i_len) +{ + if(i_len > iv_Capacity) // never shrink + { + bool wasDirect = IsDirect(); + uint32_t oldSize = iv_Capacity; + uint32_t * oldPtr = DataPtr(); + + uint32_t wordsize = getWordSize(i_len); + iv_Capacity = 32*wordsize; + + bool isDirect = IsDirect(); + + if(!isDirect) // to indirect + { + uint32_t * newBuffer = new uint32_t[wordsize]; + prdfBitString dbs(iv_Capacity,newBuffer); + dbs.Pattern(0x00000000); + prdfBitString sbs(oldSize,oldPtr); + dbs.SetBits(sbs); + iv_storage1 = 0; + if(!wasDirect) // from indirect + { + delete [] iv_rep.buffer; + } + iv_rep.buffer = newBuffer; + } + } +} + + +// Change Log ************************************************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- --------------------------------------------------------- +// dgilbert Initial Creation +// +// End Change Log ********************************************************************************* diff --git a/src/usr/diag/prdf/common/util/prdfBitKey.H b/src/usr/diag/prdf/common/util/prdfBitKey.H new file mode 100755 index 000000000..de2f4b8e9 --- /dev/null +++ b/src/usr/diag/prdf/common/util/prdfBitKey.H @@ -0,0 +1,301 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/prdfBitKey.H $ */ +/* */ +/* 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 prdfBitKey.H + * /brief prdfBitKey class Declairation + * + */ +#ifndef PRDFBITLKEY_H +#define PRDFBITLKEY_H + +#include <prdf_types.h> + +/*--------------------------------------------------------------------*/ +/* Forward References */ +/*--------------------------------------------------------------------*/ + +class prdfBitString; + +//! prdfBitKey +/*! + prdfBitKey provides the representation of bit positions that are + set ('1') In a string of bits. It has the same iterface as the prdfBitList or BIT_LIST_CLASS. + +\remarks The object this class creates is meant to be used as a key in a map or table and + as such represents the "typical" key as efficiently as possible. It can, + however, represent large lists without penalizing the size of all the + keys in a map or table. This implementation assumes the standard bit string capacity + is 64 bits, but supports sized up to 2^32 bits. The size of the object is always 12 bytes. + +\notes + This class is a replacement of a BitListClass which is meant be viewed as a list of bit positions, + though BitKey is not implemented that way internally. The following shows how a BitString and a + BitList represent that same bit string. (ie BitString == BitList) +\verbatim + BitString representation -> '001011001'b + BitList representation -> {2,4,5,8} + BitList.getListValue(0) returns 2; + BitList.getListValue(1) returns 4; + BitList.getListValue(3) returns 5; etc + BitList.getListValue(n) returns the bit position of the nth bit that is set +\endverbatim + + The setBit() and/or assignment operators are used to place + values (bit positions) in the list. Values can be assigned directly from + Bit String bit positions (0 to n from left to right). The + maximum value (bit position) that can be stored in BitKey is 2^32. +\verbatim + + 0 1 2 3 .... n + + B B B B .... B +\endverbatim + + The assingment operator is overloaded to provide setting + the bit positions form a NULL terminated character + string. Since the string is NULL terminated with 0 and + this a valid bit position, each character value is + converted to an unsigned character and decremented to + obtain the actual bit position. The character string + assignment is limited to the maximum bit position (254) + that can be represented. As an example, the following + are equivalent Bit Lists. + + Bit String: 10010001 + Character String: "\x01\x04\x08" + + The equality operator and isSubset() function are used to + compare Bit Lists. An empty Bit List can be + represented and two empty Bit Lists are considered equal. + +\par Space Complexity: Linear. + K + Mn where K and M are constants and n is the + number of bit psotions in the list + +\sa prdfBitString +*/ +class prdfBitKey + { + public: + + //! Default Constructor + /*! + This function initializes the string to NULL (empty bit list) + */ + prdfBitKey(void); + + //! Constructor + /*! + This function initializes the bit list with one value; + */ + prdfBitKey(uint32_t i_bitPos); + + //! Constructor + /*! + This function initializes an bit list from an array of uint8_t + \param i_array ptr to array of bit list values + \param i_size size of the array + */ + prdfBitKey(const uint8_t * i_array,uint8_t i_size); + + /*! + Constructor - from a bit list encoding + \param i_ble ptr to Bit list encoding + */ + prdfBitKey(const char * i_ble); + + //! Copy Constructor + prdfBitKey (const prdfBitKey & bit_list); + + //! Destructor + ~prdfBitKey(void); + + //! Assignment operator from prdfBitKey + /*! + \post *this == bit_list + */ + prdfBitKey & operator=(const prdfBitKey & bit_list); + + //! Assignment operator from prdfBitString + /*! + This function assigns the specified Bit String bit + positions to this Bit List. Bit positions are set + from left to right. + */ + prdfBitKey & operator=(const prdfBitString & bit_string); + + //! Assignment operator from c string (char *) + /*! + This function assigns the specified pointer to + character string representation of a Bit List to this + Bit List. Since the string is NULL terminated with 0 + and thus a valid bit position, each character value is + decremented to obtain the actual bit position. + */ + prdfBitKey & operator=(const char * string_ptr); + + //! Equality operator + /*! + This function determines if the specified Bit List + is equal to this Bit List. The associated string + representations are tested for equality. The lists + must have the same length and corresponding bit + positions. If both Bit Lists are empty, they are + considered equal. + */ + bool operator==(const prdfBitKey & bit_list) const; + + //! Is Subset + /*! + This function determines if the specified Bit List + is a subset of this Bit List. If this Bit List + contains every bit position that is contained in the + specified Bit List, then it is a subset. + + \verbatim + Examples: + ("1") IS a subset of ("1", "5", "31"); + ("1") IS NOT a subset of ("5", "31"); + ("2", "7") IS NOT a subset of ("2", "5", "31"); + ("2", "7") IS a subset of ("2", "7", "31"); + An empty list is a subset of an empty list. + An empty list is NOT a subset of a non-empty list + A non-empty list is NOT as subset of an empty list + \endverbatim + */ + bool isSubset(const prdfBitKey & bit_list) const; + + //! Get Bit List Value + /*! + This function returns the bit position of the nth bit that is set + \pre bit_list_offset < size(), size() > 0 + \post None. + */ + uint32_t getListValue(uint32_t n) const; + + //! Get Bit List Length + /*! + \return the # of bits set (Length of list of set bits positions) + \pre None. + \post None. + */ + uint32_t size(void) const ; + + /*! + This function removes the nth set bit from the Bit List. + + \pre bit_list_offset < size() + */ + void removeBit(uint32_t n); + + /*! + Remove the highest bitpos that is set + \pre none + \post none + \ if this is already empty then nothing happens + */ + void removeBit(void); + + /*! + Remove the bit positions from this list specified in the paramter list + \pre none + \post bit list may be modified + */ + void removeBits(const prdfBitKey & i_bk); + + + /*! + Add a bit to the bit position List + */ + void setBit(uint32_t i_bitValue); + + private: // DATA + + uint32_t iv_Capacity; + uint32_t iv_storage1; + /*! + \union REPRESENTATION_UNION + Representation stored in representaion.value when IsDirect() == true + otherwise additional storage allocated and pointed to by buffer + */ + union REPRESENTATION_UNION + { + uint32_t storage2; + uint32_t * buffer; + } iv_rep; + + + + enum + { + REPRESENTATION_BIT_POSTION_COUNT = 64 + }; + + private: // Functions + //! Is Direct + /*! + This function indicates if the direct representation can be used. + */ + bool IsDirect(void) const + { + return( iv_Capacity <= REPRESENTATION_BIT_POSTION_COUNT); + } + + //! Set String + /*! + This function allocates storage for keys bigger keys (IsDirect() == false) + \return number of uint32_t words allocated + \post + If the string is NULL, then it is allocated. + If the string length is not equal to the specified + length, then the string is re-allocated. + */ + void ReAllocate(uint32_t bit_pos); + + uint32_t * DataPtr(void) + { + uint32_t * ptr = NULL; + if(IsDirect()) ptr = &iv_storage1; + else ptr = iv_rep.buffer; + return ptr; + } + + const uint32_t * cDataPtr(void) const + { + const uint32_t * ptr = NULL; + if(IsDirect()) ptr = &iv_storage1; + else ptr = iv_rep.buffer; + return ptr; + } + + }; + +#endif + +// Change Log ************************************************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- --------------------------------------------------------- +// dgilbert Initial Creation +// +// End Change Log ********************************************************************************* diff --git a/src/usr/diag/prdf/common/util/prdfBitString.C b/src/usr/diag/prdf/common/util/prdfBitString.C new file mode 100755 index 000000000..bc9fa8907 --- /dev/null +++ b/src/usr/diag/prdf/common/util/prdfBitString.C @@ -0,0 +1,899 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/prdfBitString.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 prdfBitString.C + * @brief prdfBitString and prdfBitStringBuffer class Definitions + */ + +/*--------------------------------------------------------------------*/ +/* Includes */ +/*--------------------------------------------------------------------*/ + +#define PRDFBITSTRING_CPP + +#include <prdfBitString.H> + +#undef PRDFBITSTRING_CPP + +#include <algorithm> + +/*--------------------------------------------------------------------*/ +/* User Types */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Constants */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Macros */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Internal Function Prototypes */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Global Variables */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Static Variables */ +/*--------------------------------------------------------------------*/ + + +prdfBitString::~prdfBitString(void) +{ +} + +// ------------------------------------------------------------------------------------------------ + +uint32_t prdfBitString::GetSetCount(uint32_t bit_position, + uint32_t leng + ) const +{ + uint32_t end_position = bit_position + leng; + + PRDF_ASSERT(end_position <= ivLength); + + uint32_t count = 0; + + while(bit_position < end_position) + { + if(IsSet(bit_position)) + { + count++; + } + + bit_position++; + } + + return(count); +} + +// ------------------------------------------------------------------------------------------------ + +CPU_WORD prdfBitString::GetField +( + uint32_t iBitPos, + uint32_t iLen + ) const +{ + PRDF_ASSERT((iBitPos + iLen) <= ivLength); + PRDF_ASSERT(iLen <= WORD_BIT_LENGTH); + CPU_WORD value = 0; //dg02a + if(GetMemoryAddress() != NULL) //dg02a + { //dg02a + CPU_WORD * address = GetRelativePosition(iBitPos,iBitPos); + value = *address << iBitPos; + + if(iBitPos + iLen > WORD_BIT_LENGTH) // we need the rest of the value + { + ++address; + value |= *address >> (WORD_BIT_LENGTH - iBitPos); + } + if(iLen < WORD_BIT_LENGTH) // GNUC does not handle shift overflow as expected + { // zero bits outside desired field + value &= ((((CPU_WORD) 1) << iLen) - 1) << (WORD_BIT_LENGTH - iLen); + } + } //dg02a + + return(value); +} + +// ------------------------------------------------------------------------------------------------ + +CPU_WORD prdfBitString::GetFieldJustify +( + uint32_t bit_position, + uint32_t length + ) const +{ + CPU_WORD value = GetField(bit_position, length); + + value = RIGHT_SHIFT(length, value); + + return(value); +} + +// ------------------------------------------------------------------------------------------------ + +void prdfBitString::SetField +( + uint32_t bit_position, + uint32_t iLen, + CPU_WORD value + ) +{ + PRDF_ASSERT((bit_position + iLen) <= ivLength); + PRDF_ASSERT(iLen <= WORD_BIT_LENGTH); + + if(ivBuffer != NULL || value != 0) //dg02a + { //dg02a + CPU_WORD * address = GetRelativePositionAlloc(bit_position,bit_position); // dg02c + CPU_WORD mask = (CPU_WORD) -1; + + mask <<= (WORD_BIT_LENGTH - iLen); + + value &= mask; + + *address &= ~(mask >> bit_position); // clear field + *address |= value >> bit_position; // set field + + if(bit_position + iLen > WORD_BIT_LENGTH) // we overflowed into the next CPU_WORD + { + address++; + *address &= ~(mask << (WORD_BIT_LENGTH - bit_position)); + *address |= (value << (WORD_BIT_LENGTH - bit_position)); + } + } //dg02a +} + +// ------------------------------------------------------------------------------------------------ + +void prdfBitString::SetFieldJustify +( + uint32_t bit_position, + uint32_t length, + CPU_WORD value + ) +{ + value = LEFT_SHIFT(length, value); + + SetField(bit_position, length, value); +} + +// ------------------------------------------------------------------------------------------------ + +void prdfBitString::SetBits +( + const prdfBitString & string, // source string + unsigned int iPos, // source start pos + unsigned int iLen, // length + unsigned int iDpos // dest start pos + ) +{ + const prdfBitString * source = &string; + bool copyforward = true; + + // How Much to really move + iLen = std::min(iLen,string.GetLength() - iPos); + iLen = std::min(iLen,GetLength() - iDpos); + + // copy the right direction to prevent overlapping + uint32_t sRelativeOffset = 0; + uint32_t dRelativeOffset = 0; + CPU_WORD * sourceAddress = NULL; //dg02a + CPU_WORD * destAddress = NULL; //dg02a + if(string.GetMemoryAddress() != NULL) //dg02a + { //dg02a + sourceAddress = string.GetRelativePosition(sRelativeOffset,iPos); + } // else assume source is all zeros dg02a + if(GetMemoryAddress() != NULL) //dg02a + { //dg02a + destAddress = GetRelativePosition(dRelativeOffset,iDpos); + } //dg02a + if((sourceAddress < destAddress) || + ((sourceAddress == destAddress) && (sRelativeOffset < dRelativeOffset))) + { + copyforward = false; + } + // else copyforward + + if(copyforward) + { + while(iLen) + { + uint32_t len = std::min(iLen,(uint32_t)WORD_BIT_LENGTH); + CPU_WORD value = string.GetField(iPos,len); + SetField(iDpos,len,value); + iLen -= len; + iPos += len; + iDpos += len; + } + } else + { + iPos += iLen; + iDpos += iLen; + while(iLen) + { + uint32_t len = std::min(iLen,(uint32_t)WORD_BIT_LENGTH); + iPos -= len; + iDpos -= len; + CPU_WORD value = source->GetField(iPos,len); + SetField(iDpos,len,value); + iLen -= len; + } + } +} + +// ------------------------------------------------------------------------------------------------ + +// Function Specification ////////////////////////////////////////// +// +// Title: Pattern +// +// Purpose: This function sets the the specified bits with the +// specifed pattern. The number of bits sets is +// specified by the length and begins at the specified +// offest. The pattern is repeated as often as necessary +// as specified by the pattern_bit_length. +// +// Side-effects: Bit String may be modified. +// +// Dependencies: Parameters must specifiy valid bits in both the +// bit string and the pattern. +// +// Time Complexity: O(m) where m is the number of bits to modify +// (paramter l) +// +// Examples: o(0), l(10), pattern(0xA), pattern_bit_length(4) +// Old String: 0000000000 +// New String: 1010101010 +// +// o(3), l(4), pattern(0x3), pattern_bit_length(3) +// Old String: 0001001000 +// New String: 0000110000 +// +// End Function Specification ////////////////////////////////////// + +void prdfBitString::Pattern +( + uint32_t o, + uint32_t l, + CPU_WORD pattern, + uint32_t pattern_bit_length + ) +{ + PRDF_ASSERT(((o + l) <= ivLength) && + (pattern_bit_length <= WORD_BIT_LENGTH)); + + uint32_t current_offset; + + // current_offset = offset + o; + current_offset = o; + while(true) + { + if(l > pattern_bit_length) + { + /* Set values using full CPU_WORDs */ + SetField(current_offset, pattern_bit_length, pattern); + l -= pattern_bit_length; + current_offset += pattern_bit_length; + } + else + { + /* Set value in remainder of last CPU_WORD */ + SetField(current_offset, l, pattern); + break; + } + } +} + +// Function Specification ////////////////////////////////////////// +// +// Title: Is Set +// +// Purpose: This function determines if the specified bit position +// in the string is set(1). +// +// Side-effects: None. +// +// Dependencies: bit_position must be in the string +// +// End Function Specification ////////////////////////////////////// + +bool prdfBitString::IsSet +( + uint32_t bit_position + ) const +{ + return (GetField(bit_position,1) != 0); +} + +// Function Specification ////////////////////////////////////////////// +// +// Title: Set +// +// Purpose: This function sets(1) the specified bit position in +// the string. +// +// Side-effects: Bit String may be modified. +// +// Dependencies: bit_position must be in the string +// +// End Function Specification ////////////////////////////////////////// + +void prdfBitString::Set +( + uint32_t bit_position + ) +{ + SetField(bit_position,1,(CPU_WORD)-1); +} + +// Function Specification ////////////////////////////////////////////// +// +// Title: Clear +// +// Purpose: This function clears(0) the specified bit position in +// the string. +// +// Side-effects: Bit String may be modified. +// +// Dependencies: bit_position must be in the string +// +// End Function Specification ////////////////////////////////////////// + +void prdfBitString::Clear +( + uint32_t bit_position + ) +{ + SetField(bit_position,1,0); +} + +// Function Specification ////////////////////////////////////////// +// +// Title: Is Equal +// +// Purpose: This function compares the values of the Bit String +// memory for each bit position in the string. If the +// Bit String lengths do not match, then the Bit Strings +// are not equal. +// +// Side-effects: None. +// +// Dependencies: None. +// +// Time Complexity: O(m) where m is the length +// +// End Function Specification ////////////////////////////////////// + +bool prdfBitString::IsEqual +( + const prdfBitString& string + ) const +{ + uint32_t o; + uint32_t l; + + bool equal = false; + + if(ivLength == string.ivLength) + { + o = 0; + l = ivLength; + while(true) + { + if(l < WORD_BIT_LENGTH) + { + equal = (GetField(o, l) == string.GetField(o, l)); + break; + } + + if(!(equal = (GetField(o, WORD_BIT_LENGTH) == + string.GetField(o, WORD_BIT_LENGTH)))) + { + break; + } + + o += WORD_BIT_LENGTH; + l -= WORD_BIT_LENGTH; + } + } + + return(equal); +} + +// Function Specification ////////////////////////////////////////// +// +// Title: Is Zero +// +// Purpose: This function compares the values of the Bit String +// with zero. +// +// Side-effects: None. +// +// Dependencies: None. +// +// Time Complexity: O(m) where m is the length +// +// End Function Specification ////////////////////////////////////// + +bool prdfBitString::IsZero(void) const +{ + uint32_t o = 0; + uint32_t l = ivLength; + + bool zero; + + while(true) + { + if(l < WORD_BIT_LENGTH) + { + zero = (GetField(o, l) == 0); + break; + } + + if(!(zero = (GetField(o, WORD_BIT_LENGTH) == 0))) + { + break; + } + + o += WORD_BIT_LENGTH; + l -= WORD_BIT_LENGTH; + } + + return(zero); +} + +// Function Specification ////////////////////////////////////////// +// +// Title: Mask +// +// Purpose: This function masks the bits in the string with the +// corresponding bits in the specified Bit String. For +// each corresponding position, if the bit in the +// parameter Bit String is set(1), the bit in this string +// is cleared(0). If the length of the parameter string +// is greater than the length of this string, then the +// extra bits are ignored. If the length of the +// parameter string are less than this the length of +// this string, then the extra bits in this string are +// not modified. +// +// Side-effects: Bit String may be modified. +// +// Dependencies: None. +// +// Time Complexity: O(m) where m is the length +// +// Examples: Paramter String: 1001 +// Old String: 1100 +// New String: 0100 +// +// Paramter String: 100111 +// Old String: 1100 +// New String: 0100 +// +// Paramter String: 1001 +// Old String: 110001 +// New String: 010001 +// +// End Function Specification ////////////////////////////////////// + +void prdfBitString::Mask +( + const prdfBitString & string + ) +{ + CPU_WORD value, string_value; + uint32_t current_offset; + uint32_t l; + + /* Use smaller length */ + l = std::min(ivLength, string.ivLength); + + current_offset = 0; + while(true) + { + if(l > WORD_BIT_LENGTH) + { + /* Set values using full CPU_WORDs */ + value = GetField(current_offset, WORD_BIT_LENGTH); + string_value = string.GetField(current_offset, WORD_BIT_LENGTH); + SetField(current_offset, WORD_BIT_LENGTH, + value & (~string_value)); + l -= WORD_BIT_LENGTH; + current_offset += WORD_BIT_LENGTH; + } + else + { + /* Set value in remainder of last CPU_WORD */ + value = GetField(current_offset, l); + string_value = string.GetField(current_offset, l); + SetField(current_offset, l, value & (~string_value)); + break; + } + } +} + +//------------------------------------------------------------------------------------------------- + +CPU_WORD * prdfBitString::GetRelativePosition(uint32_t & oBitOffset, uint32_t iBitPos) const +{ + PRDF_ASSERT(ivBuffer != NULL); + oBitOffset = iBitPos % WORD_BIT_LENGTH; + return ivBuffer + (iBitPos/WORD_BIT_LENGTH); +} + +//------------------------------------------------------------------------------------------------- +// dg02a - start +CPU_WORD * prdfBitStringBuffer::GetRelativePositionAlloc(uint32_t & oBitOffset, uint32_t iBitPos) +{ + // The non-constant version of GetRelativePostion + if(GetMemoryAddress() == NULL) SetBuffer(); // alocate memory + return GetRelativePosition(oBitOffset, iBitPos); +} +// dg02a - end +//------------------------------------------------------------------------------------------------- + +CPU_WORD * prdfBitStringOffset::GetRelativePosition(uint32_t & oBitOffset, uint32_t iBitPos) const +{ + iBitPos += ivOffset; + return prdfBitString::GetRelativePosition(oBitOffset,iBitPos); +} + +//dg04a -start +CPU_WORD * prdfBitStringOffset::GetRelativePositionAlloc(uint32_t & oBitOffset, uint32_t iBitPos) +{ + iBitPos += ivOffset; + return prdfBitString::GetRelativePosition(oBitOffset, iBitPos); +} +//dg04a - end + +//------------------------------------------------------------------------------------------------- + +prdfBitStringOffset::~prdfBitStringOffset(void) {} + +//------------------------------------------------------------------------------------------------- + +prdfBitStringOffset & prdfBitStringOffset::operator=(const prdfBitStringOffset & i_bs) +{ + prdfBitString::operator=(i_bs); + ivOffset = i_bs.ivOffset; + return *this; +} + +//------------------------------------------------------------------------------------------------- + +prdfBitStringOffset & prdfBitStringOffset::operator=(const prdfBitString & i_bs) +{ + prdfBitString::operator=(i_bs); + ivOffset = 0; + return *this; +} + +// Function Specification ////////////////////////////////////////// +// +// Title: Do a bitwise NOT of the bitstring +// +// Purpose: This function returns the NOT'd value of the bitstring. +// +// Side-effects: None. +// +// Dependencies: None. +// +// Time Complexity: O(m) where m is the length of Bit String +// +// End Function Specification ////////////////////////////////////// + +prdfBitStringBuffer operator~(const prdfBitString & bs) +{ + prdfBitStringBuffer bsb(bs); + for(uint32_t pos = 0; pos < bsb.GetLength(); pos += prdfBitString::WORD_BIT_LENGTH) + { + uint32_t len = bsb.GetLength() - pos; + len = std::min(len,(uint32_t)prdfBitString::WORD_BIT_LENGTH); + CPU_WORD value = ~(bsb.GetField(pos,len)); + bsb.SetField(pos,len,value); + } + + return bsb; +} + +//------------------------------------------------------------------------------------------------- + +prdfBitStringBuffer prdfBitString::operator&(const prdfBitString & bs) const +{ + prdfBitStringBuffer bsb(std::min(this->GetLength(), bs.GetLength())); + for(uint32_t pos = 0; + pos < std::min(this->GetLength(), bs.GetLength()); + pos += prdfBitString::WORD_BIT_LENGTH) + { + uint32_t len = std::min(this->GetLength(), bs.GetLength()) - pos; + len = std::min(len,(uint32_t)prdfBitStringBuffer::WORD_BIT_LENGTH); + CPU_WORD value = this->GetField(pos,len) & bs.GetField(pos,len); + bsb.SetField(pos,len,value); + } + + return bsb; +} + +//------------------------------------------------------------------------------------------------- + +prdfBitStringBuffer prdfBitString::operator|(const prdfBitString & bs) const +{ + prdfBitStringBuffer bsb(std::min(this->GetLength(), bs.GetLength())); + for(uint32_t pos = 0; + pos < std::min(this->GetLength(), bs.GetLength()); + pos += prdfBitString::WORD_BIT_LENGTH) + { + uint32_t len = std::min(this->GetLength(), bs.GetLength()) - pos; + len = std::min(len,(uint32_t)prdfBitStringBuffer::WORD_BIT_LENGTH); + CPU_WORD value = this->GetField(pos,len) | bs.GetField(pos,len); + bsb.SetField(pos,len,value); + } + + return bsb; +} + +//------------------------------------------------------------------------------------------------- + +prdfBitStringBuffer prdfBitString::operator>>(uint32_t count) const +{ + prdfBitStringBuffer l_bsb(this->GetLength()); + prdfBitString * l_bsbp = &l_bsb; // dg03a - stupid trick to get to GetRelativePositionAlloc() + // l_bsb.Clear(); + if(count < this->GetLength()) + { + //bso overlays bsb at offset = count + uint32_t l_dummy; + prdfBitStringOffset bso(count,l_bsb.GetLength() - count, + l_bsbp->GetRelativePositionAlloc(l_dummy,0)); //dg03c + bso.SetBits(*this); + } + return l_bsb; +} + +//------------------------------------------------------------------------------------------------- + +prdfBitStringBuffer prdfBitString::operator<<(uint32_t count) const +{ + prdfBitStringBuffer l_bsb(this->GetLength()); + // l_bsb.Clear(); + if(count < this->GetLength()) + { + // bso overlays *this at offset = count + prdfBitStringOffset bso(count,this->GetLength() - count,this->GetMemoryAddress()); + l_bsb.SetBits(bso); + } + return l_bsb; +} + +// Function Specification ////////////////////////////////////////// +// +// Title: prdfBitStringBuffer (Constructor) +// +// Purpose: This constuctor initializes the data members. +// +// Side-effects: This instance is initialized. +// Memory is allocated. +// Bit String values are undefined. +// +// Dependencies: None. +// +// End Function Specification ////////////////////////////////////// + +prdfBitStringBuffer::prdfBitStringBuffer +( + uint32_t iLen, + unsigned int ibc + ) +: +prdfBitString(iLen, NULL), +ivByteCapacity(ibc) +{ +// SetBuffer(); //dg02d +} + +// Function Specification /////////////////////////////////////////// +// +// Title: prdfBitStringBuffer (Copy constructor) +// +// Purpose: This constuctor initializes the data members. This copy +// constructor uses a "deep" copy. This constructor will +// also handle any class derived from the Bit String base +// class. +// +// Side-effects: This instance is initialized. +// Bit String values are are copied. +// +// Dependencies: None. +// +// Time Complexity: Dominated by the time complexity of SetBits() +// +// End Function Specification ////////////////////////////////////// + +prdfBitStringBuffer::prdfBitStringBuffer(const prdfBitString & string) +: +prdfBitString(string.GetLength(),NULL), +ivByteCapacity(0) +{ + if(!string.IsZero()) //dg02a - only allocate if bits are on + { //dg02a + SetBuffer(); + SetBits(string); + } //dg02a +} + +// The True copy constructor mk00a +prdfBitStringBuffer::prdfBitStringBuffer(const prdfBitStringBuffer & string) +: +prdfBitString(string.GetLength(),NULL), +ivByteCapacity(string.ivByteCapacity) +{ + if(!string.IsZero()) //dg02a - only allocate if bits are on + { //dg02a + SetBuffer(); + SetBits(string); + } //dg02a +} + +// Function Specification /////////////////////////////////////////// +// +// Title: ~prdfBitStringBuffer (Virtual Destructor) +// +// Purpose: This destructor deallocates the buffer memory. +// +// Side-effects: Memory is deallocated. +// +// Dependencies: None. +// +// End Function Specification ////////////////////////////////////// + +prdfBitStringBuffer::~prdfBitStringBuffer(void) +{ + delete [] GetMemoryAddress(); +} + +// Function Specification /////////////////////////////////////////// +// +// Title: operator= (Assignment operator) +// +// Purpose: This assignment operator assigns the offset and length +// data members. A new buffer is allocated for the and +// the assinged Bit String contents are assigned. +// +// Side-effects: Data members are modified. +// Memory is allocated. +// +// Dependencies: None. +// +// Time Complexity: Proportional to time complexity of SetBits() +// +// End Function Specification ////////////////////////////////////// + +prdfBitStringBuffer & prdfBitStringBuffer::operator= +( + const prdfBitStringBuffer & string + ) +{ + // Check for assignment to self + if(this != &string) + { + delete[] GetMemoryAddress(); + // Assign base class part + prdfBitString::operator=(string); + SetMemoryAddress(NULL); + + // Assign derived class part + ivByteCapacity = string.ivByteCapacity; + + // Allocate memory and copy the Bits + if(!string.IsZero()) //dg02a - only allocate if bits are on + { //dg02a + SetBuffer(); + SetBits(string); + } //dg02a + } + + return(*this); +} + +prdfBitStringBuffer & prdfBitStringBuffer::operator=(const prdfBitString & string) +{ + delete [] GetMemoryAddress(); + + // Assign base class part + prdfBitString::operator=(string); //copy it to this + SetMemoryAddress(NULL); + + // Assign derived class part + ivByteCapacity = 0; + + // Allocate memory and copy the Bits + if(!string.IsZero()) //dg02a - only allocate if bits are on + { //dg02a + SetBuffer(); + SetBits(string); + } //dg02a + + return(*this); +} +// Function Specification ////////////////////////////////////////// +// +// Title: Set Buffer +// +// Purpose: This function allocates memory for the buffer. Any +// memory that has been previously allocated is +// deallocated. +// +// Side-effects: Memory is allocated. +// +// Dependencies: This function must be called at least once prior +// to the first Bit String access. +// +// End Function Specification ////////////////////////////////////// + +void prdfBitStringBuffer::SetBuffer(void) +{ + uint32_t byte_count = GetLength() / (sizeof(CPU_WORD) * 8); + + // Account for remainder of division with an additional byte + if((GetLength() % (sizeof(CPU_WORD) * 8)) != 0) + { + byte_count++; + } + + byte_count = std::max(ivByteCapacity, byte_count); + + delete [] GetMemoryAddress(); + SetMemoryAddress(new CPU_WORD[byte_count]); + Clear(); +} +/*--------------------------------------------------------------------*/ +/* IO Stream Conditional Support */ +/*--------------------------------------------------------------------*/ + +#ifdef _USE_IOSTREAMS_ + +std::ostream & operator<<(std::ostream & out, + const prdfBitString & bit_string ) +{ + const uint32_t bit_field_length = sizeof(CPU_WORD) * 8; + out << std::hex; + for(uint32_t pos = 0; pos < bit_string.GetLength(); pos += bit_field_length) + { + uint32_t len = bit_string.GetLength() - pos; + len = std::min(len,bit_field_length); + CPU_WORD value = bit_string.GetField(pos,len); + out << std::setw(bit_field_length/4) << std::setfill('0') << value << " "; + } + + return(out); +} + +#endif + diff --git a/src/usr/diag/prdf/common/util/prdfBitString.H b/src/usr/diag/prdf/common/util/prdfBitString.H new file mode 100755 index 000000000..4062f0e8a --- /dev/null +++ b/src/usr/diag/prdf/common/util/prdfBitString.H @@ -0,0 +1,796 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/prdfBitString.H $ */ +/* */ +/* 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 */ + +#ifndef PRDFBITSTRING_H +#define PRDFBITSTRING_H + +/** @file prdBitString.H + * @brief prdfBitString and prdfBitStringBuffer class declarations + */ + +/*--------------------------------------------------------------------*/ +/* Includes */ +/*--------------------------------------------------------------------*/ + +#if !defined(PRDF_TYPES_H) +#include <prdf_types.h> +#endif + +#if defined(ESW_SIM_COMPILE) +#define _USE_IOSTREAMS_ +#endif + +#ifdef _USE_IOSTREAMS_ + #include <iostream> + #include <iomanip> +#endif + +#if defined(NO_FSP) + // Can not use PRD implementation of assert() in error log parsing code. + #include <assert.h> + #define PRDF_ASSERT(x) assert(x) +#else + #include <prdfAssert.h> +#endif + +/*--------------------------------------------------------------------*/ +/* Forward References */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* User Types */ +/*--------------------------------------------------------------------*/ + +// Type Specification ////////////////////////////////////////////////// +// +// Title: CPU_WORD +// +// Purpose: This type is used to take advantage of the most efficient +// memory reference size for a specific CPU architecture. +// This type defintion is provided only to handle the case +// where no previous defintions exists. +// +// End Type Specification ////////////////////////////////////////////// + +#ifndef CPU_WORD + +typedef uint32_t CPU_WORD; + +#endif + +/*--------------------------------------------------------------------*/ +/* Constants */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Macros */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Global Variables */ +/*--------------------------------------------------------------------*/ + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +class prdfBitStringBuffer; + +/*--------------------------------------------------------------------*/ +/* Function Prototypes */ +/*--------------------------------------------------------------------*/ + +//! prdfBitString +/*! + prdfBitString is general purpose class providing access to a bit string in memory. + \remarks + The Bit String models a contiguous sequence of bits in memory from 0 to n. + In the prdfBitString class the start of the string is aligned with the memory + address provided. The prdfBitStringOffset class allows the starting bit string + to occur on any bit in memory. The length of the bit string may be any length up to + the value a uint32_t can hold. ( the prdfBitStringOffset limits the length such that + the start bit offset + length must not exceed the max value of a uint32_t). + + The prdfBitString and prdfBitStringOffset classes do not own the memory storage used to hold + the bitstring data, it only accesses and manipulate the bits in the range specified. + The prdfBitStringBuffer is a version of the bits string class that manages its' own storage. + Operations are performed on the Bit String using either a single bit or a field. + + The CPU_WORD type is used internally to reference memory + and as the interface type for the field. This interface + allows normal interaction with the builtin types. + Accessing the Bit String is accomplished in units of n + bits where n equals (sizeof(CPU_WORD) * 8). This CPU_WORD + type is defined to take advantage of the target CPU's + most efficient memory access instructions. However, the + semantics of the Bit String class are identical + regardless of the actual type of CPU_WORD. + + \verbatim + Bit positions are specified 0 to (length - 1) from left to right. + + 0 1 2 3 .... (length - 1) + + B B B B .... B + \endverbatim + + \remarks + When the CPU_WORD is used in SetField() and GetField uses + an identical bit order. For example, if only 16 bits of + the CPU_WORD were used, then the 16 left most bits would + contain the field data and the remaining bits would be + zero. + + \verbatim + 0 1 2 3 .... 15 16 17 .... (sizeof(CPU_WORD) - 1) + + B B B B .... B 0 0 .... 0 + \endverbatim + + \remarks + A static member function RIGHT_SHIFT() is provided for + shifting the bits the apppropriate number of positions so + that the resulting value is right justified. For example, + after using RIGHT_SHIFT() on the above field the result + would be as follows. + + \verbatim + 0 1 2 3 .... .... (sizeof(CPU_WORD) - 1) + + 0 0 0 0 .... B B B B B .... B + \endverbatim + + \remarks + The static member function LEFT_SHIFT() performs the + inverse operation. The resulting value is left justified. + + \remarks + The length of a Bit String is only limited by the amount + of memory that contains the bits and the representation + of length (16-bits). +*/ +class prdfBitString +{ +public: + + /*! + Constructor + \param Length of bitstring + \param memory address of bit string storage + \pre None. + \post None. + */ + prdfBitString(uint32_t i_length, CPU_WORD * i_address) + : + ivLength(i_length), + ivBuffer(i_address) + { + } + + /*! + Destructor + \notes This destructor does nothing. It is requred for proper desctruction + of derived classes. + */ + virtual ~prdfBitString(void); + + /*! + Comparison + \remarks The bitstrings must be the same length and have the same bits set to be equal + */ + int operator==(const prdfBitString & string) const + { + return(IsEqual(string)); + } + + /*! + Get the number of bits in the bitstring + \returns length of bitstring + \pre None + \pos None + */ + uint32_t GetLength(void) const { return ivLength; } + + /*! + Get the number of bits that are set ("1") + */ + uint32_t GetSetCount(void) const; + + /*! + Get the number of bits that are set ("1") in a specific range + \param starting bit position + \param # of bits in the range + \pre bit_position + leng <= GetLength(); + \post none + */ + uint32_t GetSetCount(uint32_t bit_position, uint32_t leng) const; + + /*! + Get a copy of a subfield withing the bitstring + \param starting bit position + \param # of bits in the field + \return Returned value is left justified (See GetFieldJustified) + \pre (bit_position + length) <= GetLength(); length <= sizeof(CPU_WORD)*8 + \post none + */ + CPU_WORD GetField(uint32_t bit_position,uint32_t length) const; + + /*! + Get a copy of a subfield withing the bitstring + \param starting bit position + \param # of bits in the field + \return Returned value is right justified (See GetField) + \pre (bit_position + length) <= GetLength(); length <= sizeof(CPU_WORD)*8 + \post none + */ + CPU_WORD GetFieldJustify(uint32_t bit_position,uint32_t length) const; + + /*! + Set value into a subfield withing the bitstring + \param starting bit position + \param # of bits in the field + \pre (bit_position + length) <= GetLength(); length <= sizeof(CPU_WORD)*8 + \post The bits are set from value (value assumed left justified) + \verbatim + this -> '00100110011....'b + SetField(3,5,0xf8000000) + result -> '00111111011....'b + \endverbatim + */ + void SetField(uint32_t bit_position,uint32_t length,CPU_WORD value); + + + /*! + Set value into a subfield withing the bitstring + \param starting bit position + \param # of bits in the field + \pre (bit_position + length) <= GetLength(); length <= sizeof(CPU_WORD)*8 + \post The bits are set from value (value assumed right justified) + \verbatim + this -> '00100110011....'b + SetField(3,5,0x0000001f) + result -> '00111111011....'b + \endverbatim + */ + void SetFieldJustify(uint32_t bit_position,uint32_t length,CPU_WORD value); + + /*! + Set bits in this string based on provided string + \param source string + \post source bits are copied to this + \notes if source len > this len than extra source bits ignored. + if source len < this len than extra bits in this are uneffected + Bit strings may specify overlapping memory + */ + void SetBits(const prdfBitString & string); + + /*! + Set bits in this string based on provided string + \param string: source string + \param pos: bit pos in source to start copy from + \param len: # of bits to copy + \param dpos: start bit pos in this string to copy to (def = 0) + \post source bits in given range are copied to this starting at dpos + \notes only bit in the given range are effected. if more source bits are + given than space in this string than the extra source bit are ignored. + Bit strings may specify overlapping memory. + */ + void SetBits(const prdfBitString & string, + unsigned int pos, + unsigned int len, + unsigned int dpos = 0); + + /*! + Set bits in this string based on the range and pattern provided + \param iPos: bit pos in this string to start + \param iLen: # of bits to modify + \param iPattern: Pattern to set + \param iPatternLen: # of bit in pattern to use (right justfied) + \pre (iPos + iLen) <= GetLength() + \post Range of specified bits filled with pattern. The pattern is repeated as needed + \verbatim + Examples: iPos(0), iLen(10), iPattern(0xA), iPatternLen(4) + Old String: 0000000000 + New String: 1010101010 + + iPos(3), iLen(4), iPattern(0x3), iPatternLen(3) + Old String: 0001001000 + New String: 0000110000 + \endverbatim + */ + void Pattern(uint32_t iPos, + uint32_t iLen, + CPU_WORD iPattern, + uint32_t pattern_bit_length); + + /*! + Set entire string based on the pattern provided + \param iPattern: Pattern to set + \param iPatternLen: # of bit in pattern to use (right justfied) + \post BitString is filled with pattern. The pattern is repeated/truncated as needed + */ + void Pattern(CPU_WORD iPattern, + uint32_t iPatternLen); + + /*! + Set entire string based on the pattern provided + \param iPattern: Pattern to set + \post BitString is filled with pattern. The pattern is repeated/truncated as needed + */ + void Pattern(CPU_WORD pattern); + + /*! + Query if bit is set (1) + \returns [true|false] + \param iPos: bit position to test + */ + bool IsSet(uint32_t iPos) const; + + /*! + Set a bit (1) at the specified position + \param iPos: bit position to test + \post IsSet(iPos) == true + */ + void Set( uint32_t iPos); + + /*! + Clear or ReSet a bit (0) at the specified position + \param iPos: bit position to clear + \post IsSet(iPos) == false + */ + void Clear(uint32_t bit_position); + + /*! + Clear the entire bit string + \post IsZero() == true + */ + void Clear(void) { Pattern(0); } + + /*! + Test equivalence + \returns [true | false] + \notes Both strings must be of equal length and have same values to be equal + */ + bool IsEqual( const prdfBitString & string) const; + + /*! + Query state of no bits set(1) + \returns [true | false] + */ + bool IsZero(void) const; + + /*! + Mask off (Clear) bits positions in this string that are Set in the string provided + \param bitString containing the mask + \post Set bit positions in string provded are cleared in this string + \notes If the paramter string is longer than this string than extra bits are ignored. + If the paramter string is shorter than this string than extra bits in this string + are not modified. + \verbatim + Examples: Paramter String: 1001 + Old String: 1100 + New String: 0100 + + Paramter String: 100111 + Old String: 1100 + New String: 0100 + + Paramter String: 1001 + Old String: 110001 + New String: 010001 + + \endverbatim + */ + void Mask(const prdfBitString & string); + + /*! + Utility to Right justify a "Left-justified" value + \param iLen: length of bit field to justify + \param iValue: the value to justify + \pre iLen <= sizeof(CPU_WORD)*8 + */ + static CPU_WORD RIGHT_SHIFT(uint32_t iLen, + CPU_WORD iValue); + + /*! + Utility to Left justify a "right-justified" value + \param iLen: length of bit field to justify + \param iValue: the value to justify + \pre iLen <= sizeof(CPU_WORD)*8 + */ + static CPU_WORD LEFT_SHIFT(uint32_t l, + CPU_WORD value); + + /*! + bitwise NOT + \returns a bit-wise inverted copy of the specified bit string + */ + + friend prdfBitStringBuffer operator~(const prdfBitString & bs); + prdfBitStringBuffer operator&(const prdfBitString & bs) const; + prdfBitStringBuffer operator|(const prdfBitString & bs) const; + + /*! + Left shift + \returns bitstring left shifted by count + \note: the returned bit string is the same length as the source. + \verbatim + Example: + |---|---|---|---|---|---|---|---| + BitString content: | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | + |---|---|---|---|---|---|---|---| + bit offset 0 1 2 3 4 5 6 7 + + operator>>(5) + + |---|---|---|---|---|---|---|---| + BitString result: | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | + |---|---|---|---|---|---|---|---| + + + \endverbatim + */ + prdfBitStringBuffer operator>>(uint32_t count) const; + + /*! + Right shift + \returns a bitstring left shifted by count + \note: the returned bit string is the same length as the source. + \verbatim + Example: + |---|---|---|---|---|---|---|---| + BitString content: | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | + |---|---|---|---|---|---|---|---| + bit offset 0 1 2 3 4 5 6 7 + + operator<<(4) + + |---|---|---|---|---|---|---|---| + BitString result: | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | + |---|---|---|---|---|---|---|---| + + \endverbatim + */ + prdfBitStringBuffer operator<<(uint32_t count) const; + + +protected: + + /*! + Assignment operator + \param string Reference bit string + */ + virtual prdfBitString & operator=(const prdfBitString & string); + + /*! + Gets the CPU_WORD bounded memory address and the relative bit offset within the CPU_WORD + that corresponds to the provided bit position in the bit string. + \returns memory address of CPU_WORD + \returns relative bit offset in the CPU_WORD + \param iBitPos Bit position in the bit string + */ + virtual CPU_WORD * GetRelativePosition(uint32_t & oBitOffset, uint32_t iBitPos) const; + virtual CPU_WORD * GetRelativePositionAlloc(uint32_t & oBitOffset, uint32_t iBitPos);//dg02a + + + /*! + Proides address of the bit string storage + @NOTE: WARNING!! this may return NULL if there is no storage on a BitStringBuffer because bits + have not yet been set. - use GetRelativePositionAlloc() to force storage allocation + */ + CPU_WORD * GetMemoryAddress(void) const { return ivBuffer; } + + /*! + Set the memory address of the string representation + */ + void SetMemoryAddress(CPU_WORD *iBuffer) { ivBuffer = iBuffer; } + + // Enum Specification ////////////////////////////////////////////// + // + // Purpose: This enummerated constant is used for member function + // implementation. + // + // End Enum Specification ////////////////////////////////////////// + + enum + { + WORD_BIT_LENGTH = sizeof(CPU_WORD) * 8 + }; + +private: + + + + uint32_t ivLength; + CPU_WORD * ivBuffer; + +}; + + +//! prdfBitStringBuffer +/*! + prdfBitStringBuffer provides a Bit String in an associated buffer in memory. + \remarks + The Bit String Buffer provides all of the functionality + of the base class along with the maintenance of memory + allocated to hold the Bit String. The buffer is "owned" + by the Bit String Buffer. Sufficient memory + is allocated and deallocted in the constructor and + destructor, respectively. In addtion, the assignemnt + operator will adjust the amount of memory needed as + necessary for the assignment. A byte capacity value is also maintained. + The internal buffer is always guaranteed to have this capacity of bytes. +*/ +class prdfBitStringBuffer : public prdfBitString +{ +public: + + /*! + Constructor + \param iLen: Number of bits in the string + \param iByteCapacity: The minimum storage size to be allocated. default=0 + \notes If iByteCapcity is zero or too small than the storage size is calculated + from iLen, rounded up to the nearest CPU_WORD. + */ + prdfBitStringBuffer(uint32_t iLen, + unsigned int iByteCapacity = 0); + + /*! + Copy Constructor + \param reference bits string + */ + prdfBitStringBuffer(const prdfBitString & string); + + /*! + Copy Constructor + \param reference bits string + */ + prdfBitStringBuffer (const prdfBitStringBuffer & string); + + /*! + Destructor + */ + virtual ~prdfBitStringBuffer(void); + + /*! + Assignment + \param reference bit string + */ + prdfBitStringBuffer & operator=(const prdfBitStringBuffer & string); + + /*! + Assignment + \param reference bit string + */ + virtual prdfBitStringBuffer & operator=(const prdfBitString & string); + +protected: // functions dg02a + + virtual CPU_WORD * GetRelativePositionAlloc(uint32_t & oBitOffset, uint32_t iBitPos);//dg02a + +private: // functions + + /*! + allocate or re-allocate buffer + */ + void SetBuffer(void); + +private: // data + + unsigned int ivByteCapacity; + +}; + +//! prdfBitStringOffset +/*! + prdfBitStringOffset provides a Bit String that allows a starting position that + is not limited to a memory alligned boundary. + \remarks + The Bit String Offset provides the ability to specify a start bit offset from the + address provided as the start position of the bit string. The class will + not modify memory outside the bit string range. +*/ +class prdfBitStringOffset:public prdfBitString +{ +public: + /*! + Constructor + \param i_offset The bit offset from address of the start of the bitstring + \param i_len The number of bits in the bitstring + \param i_address The memory address to base the bitstring on + */ + prdfBitStringOffset(uint32_t i_offset, uint32_t i_len, CPU_WORD * i_address) + : prdfBitString(i_len,i_address), ivOffset(i_offset) {} + + /*! + Destructor - this class does not own it's storage + */ + virtual ~prdfBitStringOffset(void); + + /*! + Copy Constructor + */ + prdfBitStringOffset(const prdfBitStringOffset &i_bs); + + /*! + Assignment + */ + prdfBitStringOffset & operator=(const prdfBitStringOffset & i_bs); + + /*! + Assignment + */ + virtual prdfBitStringOffset & operator=(const prdfBitString & i_bs); + + +protected: // functions + + /*! + Gets the CPU_WORD bounded memory address and the relative bit offset within the CPU_WORD + that corresponds to the provided bit position in the bit string. + \returns memory address of CPU_WORD + \returns relative bit offset in the CPU_WORD + \param iBitPos Bit position in the bit string + */ + virtual CPU_WORD * GetRelativePosition(uint32_t & oBitOffset, uint32_t iBitPos) const; + virtual CPU_WORD * GetRelativePositionAlloc(uint32_t & oBitOffset, uint32_t iBitPos); //dg04a +private: // data + + uint32_t ivOffset; +}; + + +/*--------------------------------------------------------------------*/ +/* IO Stream Conditional Support */ +/*--------------------------------------------------------------------*/ + +#ifdef _USE_IOSTREAMS_ + + +std::ostream & operator<<( std::ostream & out, + const prdfBitString & bit_string); + +#endif + +/*--------------------------------------------------------------------*/ +/* Inline Member Function Definitions */ +/*--------------------------------------------------------------------*/ + +// Function Specification /////////////////////////////////////////// +// +// Title: RIGHT_SHIFT +// +// Purpose: This function shifts the bit field right so that the +// specified number of bits are contained in the right most +// bits in the value. The resulting value is right +// justified. +// +// Side-effects: None. +// +// Dependencies: Parameter length(l) must be less than +// sizeof(CPU_WORD) for proper results. +// +// End Function Specification ////////////////////////////////////// + +inline +CPU_WORD prdfBitString::RIGHT_SHIFT +( + uint32_t l, + /*!i Length of bit field */ + CPU_WORD value + /*!i Bit field value to shift */ + ) +/*!o Bit field value */ +{ + // assert(l <= WORD_BIT_LENGTH); + + return(value >> (WORD_BIT_LENGTH - l)); +} + +// Function Specification /////////////////////////////////////////// +// +// Title: LEFT_SHIFT +// +// Purpose: This function shifts the bit field left so that the +// specified number of bits are contained in the left most +// bits in the value. The resulting value is left +// justified. +// +// Side-effects: None. +// +// Dependencies: Parameter length(l) must be less than +// sizeof(CPU_WORD) for proper results. +// +// End Function Specification ////////////////////////////////////// + +inline +CPU_WORD prdfBitString::LEFT_SHIFT +( + uint32_t l, + CPU_WORD value + ) +{ + return(value << (WORD_BIT_LENGTH - l)); +} + +inline +prdfBitString & prdfBitString::operator= +( + const prdfBitString & string + ) +{ + ivLength = string.ivLength; + ivBuffer = string.ivBuffer; + return(*this); +} + +inline +CPU_WORD * prdfBitString::GetRelativePositionAlloc(uint32_t & oBitOffset, uint32_t iBitPos) +{ + return prdfBitString::GetRelativePosition(oBitOffset,iBitPos); +} + +// Function Specification ////////////////////////////////////////// +// +// Title: Pattern +// +// Purpose: This function sets this entire Bit String with the +// specifed pattern. The pattern is repeated as often as +// necessary as specified by the pattern_bit_length. +// +// Side-effects: Bit String is be modified. +// +// Dependencies: None. +// +// Time Complexity: O(m) where m is the number of bits to modify +// (paramter l) +// +// Examples: See Pattern(uint32_t, uint32_t, CPU_WORD, uint32_t) +// +// End Function Specification ////////////////////////////////////// + +inline +void prdfBitString::Pattern(CPU_WORD pattern,uint32_t pattern_bit_length) +{ + Pattern(0, GetLength(), pattern, pattern_bit_length); +} + + +inline +void prdfBitString::Pattern(CPU_WORD pattern) +{ + Pattern(0, GetLength(), pattern, sizeof(CPU_WORD)); +} + + +inline uint32_t prdfBitString::GetSetCount(void) const +{ + return(GetSetCount(0, GetLength())); +} + +inline void prdfBitString::SetBits(const prdfBitString & string) +{ + SetBits(string, 0, string.GetLength()); +} + + +#endif diff --git a/src/usr/diag/prdf/common/util/prdfErrlSmartPtr.C b/src/usr/diag/prdf/common/util/prdfErrlSmartPtr.C new file mode 100755 index 000000000..8a6e74cff --- /dev/null +++ b/src/usr/diag/prdf/common/util/prdfErrlSmartPtr.C @@ -0,0 +1,53 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/prdfErrlSmartPtr.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 */ + +#include <prdfErrlSmartPtr.H> +#include <iipglobl.h> + +/* void add_src() + * Add special SRC to error log specifying commited from smart + * pointer. + */ +void PrdfErrlSmartPtr::add_src() +{ + + if (iv_errl) + { + PRDF_ADD_SW_ERR(iv_errl, 0, PRDF_ERRLSMARTPTR, __LINE__); + PRDF_ADD_PROCEDURE_CALLOUT(iv_errl, SRCI_PRIORITY_MED, EPUB_PRC_SP_CODE); + } +}; + +/* void commit_errl() + * Commit error log and delete. + */ +void PrdfErrlSmartPtr::commit_errl() +{ + if (iv_errl) + { + this->add_src(); + + PRDF_COMMIT_ERRL(iv_errl, ERRL_ACTION_REPORT); + } +}; + diff --git a/src/usr/diag/prdf/common/util/prdfErrlSmartPtr.H b/src/usr/diag/prdf/common/util/prdfErrlSmartPtr.H new file mode 100755 index 000000000..51782117c --- /dev/null +++ b/src/usr/diag/prdf/common/util/prdfErrlSmartPtr.H @@ -0,0 +1,167 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/prdfErrlSmartPtr.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 */ + +#ifndef __PRDFERRLSMARTPTR_H +#define __PRDFERRLSMARTPTR_H + +#include <errlentry.H> +#include <prdf_service_codes.H> + +/** + * @class PrdfErrlSmartPtr + * This is a smart pointer class for errlHndl_t objects, especially for + * the g_prd_errl variable. Currently, programmers can accidentially + * overwrite g_prd_errl and we leak a error log. This class will keep + * track of the error logs and commit/delete it if it goes out of context. + */ +class PrdfErrlSmartPtr +{ + public: + + class INVALID_TYPE_CONVERSION___SEE_COMMENTS_FOR_RELEASE_FUNCTION {}; + + /* ctor - Initialize ptr to NULL */ + PrdfErrlSmartPtr() : iv_errl(NULL) {}; + /* dtor - Commit remaining error log */ + ~PrdfErrlSmartPtr() { commit_errl(); }; + + /* operator = + * Someone attempted to overwrite the error log, commit if needed. + */ + PrdfErrlSmartPtr & operator=(errlHndl_t i_errl) + { + this->commit_errl(); + iv_errl = i_errl; + + return *this; + }; + + /* operator -> + * Used to do standard errlHndl_t->func() operations: + * errl->commit(). + */ + errlHndl_t operator->() const + { + return iv_errl; + }; + + /* operator* + * Used when dereferencing the errlHndl_t, for instance to get + * at the rc value: + * (uint32_t) *errl; + */ + /* FIXME : Hostboot ErrorLog disallow this operation but it also doesn't seem to get used + ErrlEntry operator*() const + { + return *iv_errl; + }; + */ + + /* operator == + * Compare with NULL or other ptr values: + * if (errl == NULL)... + */ + bool operator==(const errlHndl_t i_errl) const + { + return iv_errl == i_errl; + }; + + /* operator != + * Compare with NULL or other ptr values: + * if (errl != NULL)... + */ + bool operator!=(const errlHndl_t i_errl) const + { + return iv_errl != i_errl; + }; + + /* friend operator == + * Compare with NULL or other ptr values: + * if (NULL == errl) + */ + friend bool operator==(const errlHndl_t i_errl, + const PrdfErrlSmartPtr & i_smrtptr) + { + return i_smrtptr == i_errl; + }; + + /* friend operator =! + * Compare with NULL or other ptr values: + * if (NULL =! errl) + */ + friend bool operator!=(const errlHndl_t i_errl, + const PrdfErrlSmartPtr & i_smrtptr) + { + return i_smrtptr != i_errl; + }; + + /* operator errlHndl_t + * Cast to errlHndl_t object. (needed?) + */ + operator errlHndl_t() + { + return iv_errl; + }; + + operator INVALID_TYPE_CONVERSION___SEE_COMMENTS_FOR_RELEASE_FUNCTION *() + { + return NULL; + }; + + /* errlHndl_t release + * Used when error log is leaving PRD's context (returned to + * cecserver): + * return errl.release(); + * instead of: + * return errl; + * + * Or, to delete the error log: + * delete errl.release(); + * + * This prevent the error log from being deleted twice or commited + * by the wrong component. + */ + errlHndl_t release() + { + errlHndl_t l_tmp = iv_errl; + iv_errl = NULL; + return l_tmp; + }; + + protected: + errlHndl_t iv_errl; + + /* void add_src() + * Add special SRC to error log specifying commited from smart + * pointer. + */ + void add_src(); + + /* void commit_errl() + * Commit error log and delete. + */ + void commit_errl(); + +}; + +#endif diff --git a/src/usr/diag/prdf/common/util/prdfErrorSignature.H b/src/usr/diag/prdf/common/util/prdfErrorSignature.H new file mode 100755 index 000000000..a0bf1bb19 --- /dev/null +++ b/src/usr/diag/prdf/common/util/prdfErrorSignature.H @@ -0,0 +1,175 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/prdfErrorSignature.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 ErrorSignature_h +#define ErrorSignature_h + +/** @file prdfErrorSignature.H + * @brief PRD error signature + */ + +#include <iipconst.h> +#include <prdfTrace.H> + +// FIXME - Should this class be scoped in PRDF namspace? + +/** @class ErrorSignature + * + * A complete error signature is a 64-bit number where: + * The 1st 32-bits is representation of a chip. + * The 2nd 32-bits is the signature ID. + * The signature ID is defined the following: + * The 1st 16-bits is the register ID. + * The 2nd 16-bits is the error code. + */ +class ErrorSignature +{ + public: + + /** + * @brief Constructor + */ + ErrorSignature() : iv_chipId(0), iv_regId(0), iv_errCode(0) {} + + /** + * @brief operator== + */ + int operator==( const ErrorSignature & r ) const + { + return ( iv_chipId == r.iv_chipId && + iv_regId == r.iv_regId && + iv_errCode == r.iv_errCode ); + } + + /** + * @brief operator!= + */ + int operator!=( const ErrorSignature & r ) const + { + return ( iv_chipId != r.iv_chipId || + iv_regId != r.iv_regId || + iv_errCode != r.iv_errCode ); + } + + /** + * @brief operator< + */ + bool operator<( const ErrorSignature & r ) const + { + if ( iv_chipId == r.iv_chipId ) + { + if ( iv_regId == r.iv_regId ) + return ( iv_errCode < r.iv_errCode ); + else + return ( iv_regId < r.iv_regId ); + } + else + return ( iv_chipId < r.iv_chipId ); + }; + + /** + * @brief Clears the signature. + */ + void clear() + { + iv_chipId = 0; + iv_regId = 0; + iv_errCode = 0; + TraceSignature(); + } + + /** + * @brief Sets the chip ID. + * @note Clears signature ID. + * @param i_chipId The chip's ID. + */ + void setChipId( uint32_t i_chipId ) + { + iv_chipId = i_chipId; + iv_regId = 0; + iv_errCode = 0; + TraceSignature(); + } + + /** + * @brief Sets the signature ID. + * @param i_sigId The signature ID. + */ + void setSigId( uint32_t i_sigId ) + { + iv_regId = (uint16_t)(i_sigId >> 16); + iv_errCode = (uint16_t)(i_sigId & 0xffff); + TraceSignature(); + } + + /** + * @brief Sets the signature's register ID. + * @param i_regId The signature's register ID. + */ + void setRegId( uint16_t i_regId ) + { + iv_regId = i_regId; + iv_errCode = 0; + TraceSignature(); + } + + /** + * @brief Sets the signature's error code. + * @param i_errCode The signature's error code. + */ + void setErrCode( uint16_t i_errCode ) + { + iv_errCode = i_errCode; + TraceSignature(); + } + + /** + * @return The chip ID. + */ + uint32_t getChipId() const { return iv_chipId; } + + /** + * @return The signature ID. + */ + uint32_t getSigId() const + { + return ((uint32_t)iv_regId << 16) | (uint32_t)iv_errCode; + } + + private: + + /** + * @brief Create a trace statement for the current signature. + */ + void TraceSignature() const + { + PRDF_INF( "PRD Signature %08X %08X", getChipId(), getSigId() ); + } + + uint32_t iv_chipId; ///< 32-bit representation of a chip + uint16_t iv_regId; ///< 16-bit register ID + uint16_t iv_errCode; ///< 16-bit error code +}; + +#endif + diff --git a/src/usr/diag/prdf/common/util/prdfFilters.C b/src/usr/diag/prdf/common/util/prdfFilters.C new file mode 100755 index 000000000..ae5b294e7 --- /dev/null +++ b/src/usr/diag/prdf/common/util/prdfFilters.C @@ -0,0 +1,218 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/prdfFilters.C $ */ +/* */ +/* 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 */ + +/** + @file iipFilters.C + @brief Definition of SingleBitFilter, PrioritySingleBitFilter, FilterLink, + and ScanCommFilter classes. +*/ + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define iipFilters_C + +#include <prdfBitKey.H> +#include <prdfFilters.H> +//#include <xspprdScanCommFilter.h> +#include <iipscr.h> +//#include <xspprdFilterLink.h> + +#undef iipFilters_C +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Member Function Specifications +//---------------------------------------------------------------------- + +prdfFilter::~prdfFilter(void) +{} + +//------------------------------------------------------------------------------------------------- + +bool prdfFilterPriority::Apply(prdfBitKey & ioBitList) +{ + bool modified = false; + if(ioBitList.isSubset(ivBitKey)) + { + ioBitList = ivBitKey; + modified = true; + } + return modified; +} + + +//------------------------------------------------------------------------------------------------- + +bool SingleBitFilter::Apply(prdfBitKey & bit_list) +{ + bool rc = false; + uint32_t list_length = bit_list.size(); + if(list_length > 1) + { + rc = true; + while(--list_length) + { + bit_list.removeBit(); + } + } + return(rc); +} + + +//------------------------------------------------------------------------------------------------- + +bool PrioritySingleBitFilter::Apply(prdfBitKey & bit_list) +{ + bool l_modified = false; + + // Do priority bit. + for (size_t i = 0; i < iv_bitList.size(); i++) + { + prdfBitKey l_key = iv_bitList[i]; + if (bit_list.isSubset(l_key)) + { + l_modified = true; + bit_list = l_key; + break; + } + } + // Do single bit filter portion. + if (!l_modified) + { + while (1 < bit_list.size()) + { + l_modified = true; + bit_list.removeBit(); + } + } + return l_modified; +} + +//------------------------------------------------------------------------------------------------- + +bool prdfFilterTranspose::Apply(prdfBitKey & iBitList) +{ + bool result = false; + if(iBitList == ivBitKey) + { + prdfBitKey bk(ivSingleBitPos); + iBitList = bk; + result = true; + } + return result; +} + +bool prdfFilterTranspose::Undo(prdfBitKey & iBitList) +{ + bool result = false; + prdfBitKey testbl(ivSingleBitPos); + if(iBitList.isSubset(testbl)) + { + iBitList = ivBitKey; + result = true; + } + + return result; +} + +//------------------------------------------------------------------------------------------------- + +bool FilterLink::Apply(prdfBitKey & bit_list) +{ + bool rc = xFilter1.Apply(bit_list); + rc = rc || xFilter2.Apply(bit_list); + return rc; +} + +bool FilterLink::Undo(prdfBitKey & bit_list) +{ + bool rc = xFilter1.Undo(bit_list); + rc = rc || xFilter2.Undo(bit_list); + return rc; +} + +//------------------------------------------------------------------------------------------------- + +bool ScanCommFilter::Apply(prdfBitKey & bitList) +{ + // Read HW register + scr.Read(); + + // local copy of bit string from scan comm register + BIT_STRING_BUFFER_CLASS bsb(*scr.GetBitString()); + prdfBitKey bl; + bool rc = false; + + // Invert if necessary + if (xInvert) + { + bsb = ~bsb; + } + + // Create bit list + bl = bsb; + uint32_t bsize = bitList.size(); + bitList.removeBits(bl); + if(bsize != bitList.size()) + { + rc = true; + } + + return(rc); +} + +// Change Log ************************************************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ------- -------- -------- ------------------------------ +// v4r1 09/05/96 DGILBERT Initial Creation +// v4r3 01/27/98 SERAFIN Add PrioritySingleBitFilter +// dg00 v4r5 06/30/99 DGILBERT fix PrioritySingleBitFilter +// mk01 P4904712 v4r5 10/21/99 mkobler really fix PrioritySingleBitFilter +// 490420.x v5r2 07/06/00 mkobler Add ScanCommFilter +// 490420.x v5r2 07/06/00 dgilbert added FilterLink +// fips 03/19/04 dgilbert rename to prdfFilters.C;rewrote PrioritySingleBitFilter +// changed to use prdfBitKey +// 558003 fips310 06/21/06 dgilbert Add Undo() +// 582595 fips310 12/12/06 iawillia Update priority sb filter to maintain bit order. +// +// End Change Log ********************************************************************************* diff --git a/src/usr/diag/prdf/common/util/prdfFilters.H b/src/usr/diag/prdf/common/util/prdfFilters.H new file mode 100755 index 000000000..3fd5da02d --- /dev/null +++ b/src/usr/diag/prdf/common/util/prdfFilters.H @@ -0,0 +1,459 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/prdfFilters.H $ */ +/* */ +/* 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 */ + +#ifndef PRDFFILTER_H +#define PRDFFILTER_H + +/** + @file prdfFilter.H + @brief FILTER_CLASSes selectivly remove bits from a prdfBitKey type object +*/ + +/*--------------------------------------------------------------------*/ +/* Includes */ +/*--------------------------------------------------------------------*/ + +#if !defined(PRDFBITLKEY_H) +#include <prdfBitKey.H> +#endif + +#include <vector> + +/*--------------------------------------------------------------------*/ +/* Forward References */ +/*--------------------------------------------------------------------*/ + +class prdfBitKey; + +/*--------------------------------------------------------------------*/ +/* User Types */ +/*--------------------------------------------------------------------*/ + +/** + prdfFilter Specifies and interface for removing unwanted bits from a prdfBitKey. + Abstract base class + @see prdfBitKey +*/ +class prdfFilter +{ +public: + + + /** + Destructor. This implementation does nothing + */ + virtual ~prdfFilter(void); + + + /** + Apply filter to the prdfBitKey. + @post bit_list may be modified + @return true if bit_list was modified, otherwise false + */ + virtual bool Apply(prdfBitKey & io_bit_list) = 0; + + /** + * Undo the filter effect (if possible) + * @post bit_list may be modified + * @Return tru if bit_list was modified, otherwise false + * @note: bit_lists are sometimes used to reset an error register based on the bit that was + * analyzed. If the Apply() function modifes the bit_list in such a way that make it unusable + * to reset the error register (eg. moves a bit to a new postition) than the Undo() function + * should put the bit_list back into a state that can be used to reset an error register. + */ + virtual bool Undo(prdfBitKey & io_bit_list) { return false; } + +protected: + + /** + Default Constructor + @note The default compiler generated copy constructor and assignment operator + are adaquate. + */ + prdfFilter(void) {} + +}; + +//! prdfFilterPriority +/*! + prdfFilterPriority maintains a "subset" BitKey or a "priority" set of bits. + When this filter is applied to a BitKey, If the "priority" BitKey is a subset of the + BitKey than the BitKey becomes the priorty BitKey. (The non-priority bits are turned off); + Otherwise the BitKey remains unchanged. + + \verbatim + Examples: + Priority BitKey: ("1") + Original BitKey: ("1", "5", "31") + Filtered BitKey: ("1") + + Priority BitKey: ("1") + Original BitKey: ("5", "31") + Filtered BitKey: ("5", "31") + + Priority BitKey: ("2", "7") + Original BitKey: ("2", "5", "31") + Filtered BitKey: ("2", "5", "31") + + Priority BitKey: ("2", "7") + Original BitKey: ("2", "7", "31") + Filtered BitKey: ("2", "7") + \endverbatim + */ +class prdfFilterPriority : public prdfFilter +{ +public: + + /*! + Constructor + \param i_bld ptr bit list string encoding + */ + prdfFilterPriority(const char * i_ble) + : ivBitKey(i_ble) + {} + + + /*! + Constructor + \param iBitList BitKey + */ + prdfFilterPriority(const prdfBitKey & iBitList) + : ivBitKey(iBitList) + {} + + /*! + Apply the filter to a bit list + \param ioBitList to apply filter to + \returns true if iBitList modified otherwise false + */ + virtual bool Apply(prdfBitKey & ioBitList); + +protected: + + + prdfBitKey ivBitKey; + +}; + +//! PrioritySingleBitFilter +/*! + PrioritySingleBitFilter removes all but one bit from a prdfBitKey object. + Priority (to not be removed) is given to the bits specified and in the order + specified. + @par Example + @code + const char * const BIT_LIST_STRING_31_26 = "\x20\x1B"; // priority bits + PrioritySingleBitFilter psbFilter(BIT_LIST_STRING_31_26); + ScanCommRegisterChip scr(...); // see iipScanCommRegisterChip.h + ResolutionMap resMap(...); // see iipResolutionMap.h + + // when the error register is read, the resulting list of bits on + // is passed to psbFilter. the result is used to look up a resolution + // in the ResultionMapa resMap and the resolution is called + ErrorRegisterMask ereg(scr,resMap,&psbFilter); + ... + rc = ereg.Analyze(serviceData); // See iipErrorRegisterMask.h + // ereg will apply filter prioritizing bit 31 then bit 26 + // and finally any remaining bits + @endcode + @par functionality + - if no priority bits exist in prdfBitKey object then + - eliminate all but first entry in list + - else if priority bits exist then + - eliminate all non-priority bit entries + - if multiple priority bit entries exist then elminate all but one, + favoring the first qualified entry found in the list. +*/ +class PrioritySingleBitFilter : public prdfFilter +{ +public: + + /** + Constructor + @param pbls Priority bit list string: list of bit positions that have priority + @note bit position priority values in pbls are the bit position + 1 of the bit list, + thus to prioritize bit positions 0,1, & 2 in the bit list, pbls would = "\x01\x02\x03"; + */ + PrioritySingleBitFilter(const char * pbls = NULL) + { + if (NULL != pbls) + { + while('\0' != pbls[0]) + { + iv_bitList.push_back(pbls[0]+1); + pbls++; + } + } + }; + + PrioritySingleBitFilter(const std::vector<uint8_t> & pbls) + { + iv_bitList = pbls; + }; + + + /** + Apply filter to bit list + @param bit_list : the bit list to filter + @pre none + @post Bit list will only have one value - the one with the highest + priority. If multiple values have equally highest priority then the first + value in the list is used. + @return true of bit list was modified otherwise false + @note If the bit list is empty then it will be left empty. + */ + virtual bool Apply(prdfBitKey & bit_list); + +private: // functions +private: // Data + + std::vector<uint8_t> iv_bitList; + +}; + +//! prdfFilterTranspose +/*! + prdfFilterTranspose transposes an exactly matching key to a single bit. If there is not an + exact match, the key is not modified. +*/ +class prdfFilterTranspose : public prdfFilterPriority +{ +public: + + /** + Constructor + \param i_bitKey bit list key + \param iBitPos bit to set if i_bitKey matches target. + */ + prdfFilterTranspose(const prdfBitKey &i_bitKey,uint32_t iBitPos) + : prdfFilterPriority(i_bitKey),ivSingleBitPos(iBitPos) + {} + + /** + Apply filter to bit list + \param bit_list : the bit list to filter + \pre none + \post If the provide BitList exactly matches the internal BitList than the provided + bitlist is modified such that all bits are cleared and ivSingleBitPos is set. + \return true of bit list was modified otherwise false + */ + virtual bool Apply(prdfBitKey & iBitList); + + /** + * Undo the filter Apply() + * @post bit_list may be modified + * @Return true if bit_list was modified, otherwise false + * @Note This function will only Undo the transposition if the transposed result bit is on + */ + virtual bool Undo(prdfBitKey & iBitList); + +private: // functions +private: // Data + + uint32_t ivSingleBitPos; + +}; + +//! SingleBitFilter +/*! + Reduces a BitKey to single bit + \code + // usually in chip class header file + SingleBitFilter sbFilter; + ScanCommRegisterChip scr; // @see iipScanCommRegisterChip.h + ResolutionMap resMap; // @see prdfResolutionMap.H + + // in ctor of chip class definition + ErrorRegisterMask ereg(scr,resMap,&sbFilter); + // ... + rc = ereg.Analyze(serviceData); // See iipErrorRegisterMask.h + // ereg will apply filter before analyzing the error + \endcode + */ +class SingleBitFilter: public prdfFilter +{ +public: + /*! + Constructor + */ + SingleBitFilter(): prdfFilter() {} + + /*! + Remove all but one bit from bit_list + \param ioBitList Target bit list + \returns true if ioBitList was modified otherwise false + */ + virtual bool Apply(prdfBitKey & ioBitList); + +private: // functions +private: // Data + +}; + + +//! FilterLink +/*! + FilterLink links two FILTER_CLASS types together allowing two filters + to act on a single prdfBitKey object. + @code + + prdfFilter * foo(prdfFilter & f1, prdfFilter & f2) + { + prdfFilter * joint = new FilterLink(f1,f2); + return joint; + } + @endcode + */ +class FilterLink: public prdfFilter +{ +public: + /** + Constructor + <ul> + <br><b>Parameters: </b> Two Filters to be linked + <br><b>Requirements:</b> parm filters objects must exist and be valid + <br><b>Promises: </b> Object created + <br><b>Exceptions: </b> N/A + <br><b>Notes: </b> + </ul><br> + */ + FilterLink(prdfFilter & f1, prdfFilter & f2); + + /* + 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> Default is sufficient + </ul><br> + */ + // ~xspprdFilterLink(); + + /** + Apply Filter(s) + <ul> + <br><b>Parameters: </b> reference to a BIT_LIST (see iipbtlst.h) + <br><b>Returns: </b> [TRUE | FALSE] - was bit list modified? + <br><b>Requirements:</b> None. + <br><b>Promises: </b> bit_list is modified (if rc == TRUE) + <br><b>Exceptions: </b> N/A + <br><b>Notes: </b> calls all the other associated filters + </ul><br> + */ + virtual bool Apply ( prdfBitKey & bit_list ); + + /** + * Undo the filter Apply() + * @post bit_list may be modified + * @Return true if bit_list was modified, otherwise false + */ + virtual bool Undo(prdfBitKey & iBitList); + +private: // functions +private: // Data + + // may be extended to use a vector if needed + prdfFilter & xFilter1; + prdfFilter & xFilter2; +}; + + +class SCAN_COMM_REGISTER_CLASS; + +//! ScanCommFilter +/*! + ScanCommFilter reads a HW scom register to determin which bits to + removes bits from a prdfBitKey object + @par Base class prdfFilter + @code + // This class is useful for Error registers whose bits can be + // configured to report different ways depending on another + // enable register. + + ScanCommRegister enableScr(...); // see iipScanCommRegisterChip.h + ScanCommFilter scfFirXstop(enableScr,INVERT); + ScanCommFilter scfFirRer(enableScr,NONINVERT); + ScanCommRegister scr(...); // see iipScanCommRegisterChip.h + ResolutionMap resMap(...); // see iipResolutionMap.h + ErrorRegisterMask eregFirXstop(scr,resMap,&scfFirXstop); + ErrorRegisterMask eregFirRer(scr,resMap,&scfFirRer); + ... + rc = eregFirXstop.Analyze(serviceData); // See iipErrorRegisterMask.h + // ereg will apply filter + @endcode + */ +class ScanCommFilter: public prdfFilter +{ +public: + + // Enum for use as the second parameter in the constructor. + enum InvertValue { + NONINVERT = 0x0, + INVERT = 0x1 + }; + + /*! + Constructor + \param r Reference to a scan comm register + \param invert whether or not to bit-wise invert the value from the scan comm read + */ + ScanCommFilter(SCAN_COMM_REGISTER_CLASS & i_r, InvertValue invert = NONINVERT) + : + prdfFilter(), + scr(i_r), + xInvert(invert) + { } + + /*! + Turn off bits in bit list based on contents of scan com register + @post bit_list may be modified + @return true if bit_list was modified, otherwise false + */ + virtual bool Apply(prdfBitKey & bit_list); + +private: // functions +private: // Data + SCAN_COMM_REGISTER_CLASS & scr; + InvertValue xInvert; +}; + + +inline FilterLink::FilterLink(prdfFilter & f1, prdfFilter & f2) +: xFilter1(f1), xFilter2(f2) {} + + +#endif +// Change Log ************************************************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ------- -------- -------- ------------------------------------------------------- +// V400 09/12/94 JST Initial Creation +// fips 03/19/04 dgilbert Rename to prdfFilter.H added doxygen comments +// 558003 fips310 06/21/06 dgilbert Add Undo() to filter +// 582595 fips310 12/12/06 iawillia Update priority sb filter to maintain bit order. +// End Change Log ******************************************************************************** + + diff --git a/src/usr/diag/prdf/common/util/prdfFlyWeight.C b/src/usr/diag/prdf/common/util/prdfFlyWeight.C new file mode 100755 index 000000000..1df6f46f5 --- /dev/null +++ b/src/usr/diag/prdf/common/util/prdfFlyWeight.C @@ -0,0 +1,151 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/prdfFlyWeight.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: +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define prdfFlyWeight_C + +#include <prdfFlyWeight.H> +#include <tracinterface.H> +#include <iipglobl.h> +#include <prdfHeapBucketSize.H> + +#undef prdfFlyWeight_C +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- +template < class T , uint32_t S > +FlyWeight<T,S>::~FlyWeight() +{ + clear(); +} + +//--------------------------------------------------------------------- + +template < class T, uint32_t S > +void FlyWeight<T,S>::clear() +{ + for(typename HeapType::const_iterator i = iv_heap.begin(); i != iv_heap.end(); ++i) + { + delete[] (T*)*i; + } + iv_heap.erase(iv_heap.begin(),iv_heap.end()); + iv_nextOpen = NULL; +} + +//--------------------------------------------------------------------- + +template < class T , uint32_t S > +T & FlyWeight<T,S>::get(const T & key) +{ + T * result = NULL; + T * current_array = NULL; + + // search to see if we already have one + for(typename HeapType::const_iterator i = iv_heap.begin(); + i != iv_heap.end() && (result == NULL); ++i) + { + current_array = (T*)*i; + for(T * p = current_array; + p != (current_array + RoundBucketSize<T,S>::value); ++p) + { + if (p == iv_nextOpen) + break; + + if(*p == key) + { + result = p; + break; + } + } + } + if(result == NULL) // didn't find it - add it + { + if(iv_nextOpen == NULL) // need a new array + { + current_array = new T[RoundBucketSize<T,S>::value]; + if(current_array == NULL) // dg00a + { // dg00a + PRDF_TRAC("PRDF Could not get requested memory"); // dg00a + } // dg00a + // if the heap of array ptrs is full(or non-existant) then increase capacity by S dg00a + if(iv_heap.size() == iv_heap.capacity()) // dg00a + { // dg00a + iv_heap.reserve(iv_heap.capacity() + RoundBucketSize<T,S>::value); // dg00a + } // dg01a + iv_heap.push_back(current_array); + iv_nextOpen = current_array; + } + + *iv_nextOpen = key; + result = iv_nextOpen; + ++iv_nextOpen; + if((current_array != NULL) && // Done to fix BEAM error + (iv_nextOpen == (current_array + RoundBucketSize<T,S>::value))) // this array is full + { + iv_nextOpen = NULL; + } + } + return *result; +} + +#if defined(ESW_SIM_COMPILE) +#include <iostream> +#include <iomanip> + +//FlyWeightBase::FlyWeightList FlyWeightBase::cv_fwlist; //mp01d + +template < class T , uint32_t S > +void FlyWeight<T,S>::printStats(void) +{ + using namespace std; + cout << "FlyWeight Memory allowcated = " << (iv_heap.size() * sizeof(T) * RoundBucketSize<T,S>::value) << endl; +} +#endif diff --git a/src/usr/diag/prdf/common/util/prdfFlyWeight.H b/src/usr/diag/prdf/common/util/prdfFlyWeight.H new file mode 100755 index 000000000..ec9eae1a6 --- /dev/null +++ b/src/usr/diag/prdf/common/util/prdfFlyWeight.H @@ -0,0 +1,138 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/prdfFlyWeight.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 PRDFFLYWEIGHT_H +#define PRDFFLYWEIGHT_H +/** + @file prdfFlyWeight.H + @brief Description +*/ + + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#include <stdint.h> +#include <vector> + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +// +// + +#if defined(ESW_SIM_COMPILE) +class FlyWeightBase +{ + public: + FlyWeightBase() { cv_fwlist.push_back(this); } + virtual ~FlyWeightBase() {} + virtual void printStats(void) = 0; + + static void report(void) + { + for(FlyWeightList::iterator i = cv_fwlist.begin(); i != cv_fwlist.end(); ++i) + { + (*i)->printStats(); + } + } + + typedef std::vector<FlyWeightBase *> FlyWeightList; + static FlyWeightList cv_fwlist; +}; +#endif + +/** + **One line Class description** + @author Doug Gilbert + @par T is the type of object to flyweight, S is the size (# of T's) in an allocation + unit (minimum number of T's to reserve space for when more storage is needed) + @code + @endcode +*/ +template <class T, uint32_t S> +class FlyWeight +#if defined(ESW_SIM_COMPILE) + : public FlyWeightBase +#endif +{ +public: + /** + Constructor + @param + @returns + @pre + @post + @see + @note + */ + FlyWeight() : iv_nextOpen(NULL) {} + + /** + Destructor + */ + ~FlyWeight(); + + /** + clear all entries + @param - none + @pre none + @post all instances of T are deleted. + @note any ponters or references to any of the instances should be reset + */ + void clear(); + + /** + Get the flyweight version of T - add it if it does not yet exist + @param key to search for + @returns Reference to T in the flyweight + @pre none + @post FlyWeight contains one instance of key + */ + T & get(const T & key); + +#if defined(ESW_SIM_COMPILE) + virtual void printStats(void); +#endif + +private: // functions +private: // Data + + typedef std::vector< void* > HeapType; + + HeapType iv_heap; // vector of arrays of T + T * iv_nextOpen; +}; + + +#endif /* PRDFFLYWEIGHT_H */ + +// Change Log ***************************************************************** +// +// Flag Reason Vers Date Coder Description +// ---- --------- ------- -------- -------- ------------------------------------ +// dgilbert Initial Creation +// fips222 09/14/04 dgilbert Add clear() +// +// End Change Log ************************************************************* diff --git a/src/usr/diag/prdf/common/util/prdfFlyWeightS.C b/src/usr/diag/prdf/common/util/prdfFlyWeightS.C new file mode 100755 index 000000000..76e001d25 --- /dev/null +++ b/src/usr/diag/prdf/common/util/prdfFlyWeightS.C @@ -0,0 +1,306 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/prdfFlyWeightS.C $ */ +/* */ +/* 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 */ + +#include <prdfFlyWeightS.H> +#include <algorithm> +#include <prdfHeapBucketSize.H> + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +template <typename T, uint32_t S> +void FlyWeightS<T,S>::clear() +{ + for (NeutralV::iterator i = iv_heaps.begin(); + i != iv_heaps.end(); + ++i) + { + delete [] static_cast<HeapType>(*i); + } + iv_heaps.clear(); + + for (NeutralV::iterator i = iv_rows.begin(); + i != iv_rows.end(); + ++i) + { + delete static_cast<RowType*>(*i); + } + iv_rows.clear(); + + iv_size = 0; + iv_nextPos = NULL; + iv_rowSize = 2; + iv_colSize = S; +} + +template <typename T, uint32_t S> +T & FlyWeightS<T,S>::get(const T & key) +{ + HintType l_hint; + T * l_val = find(key,l_hint); + return (NULL == l_val ? *insert(key,l_hint) : *l_val); +} + +template <typename T, uint32_t S> +T * FlyWeightS<T,S>::find(const T & key, HintType & o_hint) +{ + T * l_rc = NULL; + + // Check for empty case. + if (NULL == iv_nextPos) + { + return NULL; + } + + // Search rows for possible entry. + NeutralV::iterator rowBegin = iv_rows.begin(), + rowEnd = iv_rows.end() - 1; + + while (rowBegin != rowEnd) + { + size_t l_d = std::distance(rowBegin, rowEnd); + l_d /= 2; l_d += 1; // now it is the mid-point. + + if (key >= + *static_cast<T *>(*static_cast<RowType *>(rowBegin[l_d])->begin())) + { + rowBegin += l_d; + } + else + { + rowEnd = rowBegin; + rowEnd += (l_d - 1); + } + } + o_hint.row = rowEnd; + + // Search column for possible entry. + NeutralV * l_row = static_cast<NeutralV*>(*o_hint.row); + NeutralV::iterator colBegin = l_row->begin(), + colEnd = l_row->end() - 1; + + while (colBegin != colEnd) + { + size_t l_d = std::distance(colBegin, colEnd); + l_d /= 2; l_d += 1; // now it is the mid-point. + + if (key >= + *static_cast<T *>(colBegin[l_d])) + { + colBegin += l_d; + } + else + { + colEnd = colBegin; + colEnd += (l_d - 1); + } + } + o_hint.col = colBegin; + + // Check if we found one. + if (key == *static_cast<T *>(*o_hint.col)) + l_rc = static_cast<T *>(*o_hint.col); + + // Hint is now pointing to the cell either containing the key or + // immediately preceeding where this key would go... unless it is the + // first item in the column. + + return l_rc; +}; + +template <typename T, uint32_t S> +T * FlyWeightS<T,S>::insert(const T & key, HintType & i_hint) +{ + // Check for new array. + if (NULL == iv_nextPos) + { + HeapType p = this->getHeap(); + (*p) = key; + + NeutralV::iterator l_row = iv_rows.begin(); + this->insertRow(l_row, p); + + return p; + } + + // Otherwise, hint contains the position immediately preceeding + // where this key should go... unless it is the first item in the column. + + // Assign into heap, get pointer to position. + HeapType p = this->getHeap(); + (*p) = key; + + // Check if current row has enough room. + if (static_cast<NeutralV *>(*i_hint.row)->size() < iv_colSize) + { + if (*static_cast<T *>(*i_hint.col) < key) + i_hint.col++; + static_cast<NeutralV *>(*i_hint.row)->insert(i_hint.col, p); + } + else // not enough room. + { + T * l_nextElement = NULL; + // Should it go on next list? + if (*static_cast<T *>(static_cast<NeutralV *>(*i_hint.row)->back()) + < key) + { + l_nextElement = p; + } + else + { + l_nextElement = + static_cast<T *>(static_cast<NeutralV *>(*i_hint.row)->back()); + static_cast<NeutralV *>(*i_hint.row)->pop_back(); + + if (*static_cast<T *>(*i_hint.col) < key) + i_hint.col++; + static_cast<NeutralV *>(*i_hint.row)->insert(i_hint.col, p); + } + + i_hint.row++; + if (i_hint.row == iv_rows.end()) + this->insertRow(i_hint.row, l_nextElement); + else if (static_cast<NeutralV *>(*i_hint.row)->size() < iv_colSize) + static_cast<NeutralV *>(*i_hint.row)->insert( + static_cast<NeutralV *>(*i_hint.row)->begin(), l_nextElement); + else + this->insertRow(i_hint.row, l_nextElement); + + } + + return p; +}; + +template <typename T, uint32_t S> +T * FlyWeightS<T,S>::getHeap() +{ + iv_size++; + + if (NULL == iv_nextPos) + { + iv_heaps.push_back(iv_nextPos = new T[RoundBucketSize<T,S>::value]); + } + + T * l_rc = iv_nextPos; + + iv_nextPos++; + if ((static_cast<T*>(*(iv_heaps.end()-1)) + RoundBucketSize<T,S>::value) == iv_nextPos) + { + iv_heaps.push_back(iv_nextPos = new T[RoundBucketSize<T,S>::value]); + } + + return l_rc; +}; + +template <typename T, uint32_t S> +void FlyWeightS<T,S>::insertRow(FlyWeightS<T,S>::NeutralV::iterator & io_pos, + HeapType p) +{ + io_pos = iv_rows.insert(io_pos, new RowType); + //static_cast<NeutralV *>(*io_pos)->reserve(iv_colSize); + static_cast<NeutralV *>(*io_pos)->push_back(p); + + if (iv_rows.size() > iv_rowSize) + this->increaseSize(); +}; + +template <typename T, uint32_t S> +void FlyWeightS<T,S>::increaseSize() +{ + iv_rowSize *= 2; + iv_colSize += S; + + // Resize columns. + /* + for (NeutralV::iterator i = iv_rows.begin(); + i != iv_rows.end(); + i++) + { + static_cast<NeutralV *>(*i)->reserve(iv_colSize); + }*/ + + // Merge columns. + for (NeutralV::iterator i = iv_rows.begin(); + i != iv_rows.end(); + i++) + { + if (*i == NULL) + continue; + + bool l_merged = false; + NeutralV::iterator i_next = i; + + do + { + l_merged = false; + i_next++; + + while ((*i_next == NULL) && (i_next != iv_rows.end())) + i_next++; + + if (i_next == iv_rows.end()) + continue; + + // If (I0 + I1 < previousCol), merge. + if ((iv_colSize - S) >= (static_cast<NeutralV *>(*i)->size() + + static_cast<NeutralV *>(*i_next)->size())) + { + static_cast<NeutralV *>(*i)->insert( + static_cast<NeutralV *>(*i)->end(), + static_cast<NeutralV *>(*i_next)->begin(), + static_cast<NeutralV *>(*i_next)->end()); + + delete static_cast<NeutralV *>(*i_next); + *i_next = NULL; + + l_merged = true; + } + } while(l_merged); + } + + iv_rows.erase(std::remove(iv_rows.begin(), iv_rows.end(), (void *) NULL), + iv_rows.end()); + +}; + +/* +template <typename T, uint32_t S> +void FlyWeightS<T,S>::print() +{ + std::cout << "Size = " << iv_size << std::endl; + for (NeutralV::iterator i = iv_rows.begin(); + i != iv_rows.end(); + i++) + { + for (NeutralV::iterator j = static_cast<NeutralV *>(*i)->begin(); + j != static_cast<NeutralV *>(*i)->end(); + j++) + { + std::cout << *static_cast<T *>(*j) << " "; + } + std::cout << std::endl; + } + +} +*/ diff --git a/src/usr/diag/prdf/common/util/prdfFlyWeightS.H b/src/usr/diag/prdf/common/util/prdfFlyWeightS.H new file mode 100755 index 000000000..3a571e95d --- /dev/null +++ b/src/usr/diag/prdf/common/util/prdfFlyWeightS.H @@ -0,0 +1,75 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/prdfFlyWeightS.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 */ + +#ifndef __PRDF_PRDFFLYWEIGHTS_H +#define __PRDF_PRDFFLYWEIGHTS_H + +#include <stdint.h> +#include <vector> + +template<class T, uint32_t S> +class FlyWeightS +{ + public: + + FlyWeightS() : iv_rowSize(2), iv_colSize(S), iv_nextPos(NULL), + iv_size(0) + { iv_rows.reserve(iv_rowSize); iv_heaps.reserve(iv_rowSize); }; + + ~FlyWeightS() { this->clear(); }; + + void clear(); + + T & get(const T & key); + + //void print(); + + private: + + typedef std::vector<void *> NeutralV; + typedef std::vector<void *> RowType; + typedef T* ColType; + typedef T* HeapType; + + typedef struct { NeutralV::iterator row; NeutralV::iterator col;} + HintType; + + size_t iv_rowSize; + size_t iv_colSize; + NeutralV iv_rows; + NeutralV iv_heaps; + HeapType iv_nextPos; + + size_t iv_size; + + private: + + T * find(const T & key, HintType & o_hint); + T * insert(const T & key, HintType & i_hint); + T * getHeap(); + void insertRow(NeutralV::iterator & io_pos, HeapType p); + + void increaseSize(); +}; + +#endif diff --git a/src/usr/diag/prdf/common/util/prdfHeapBucketSize.H b/src/usr/diag/prdf/common/util/prdfHeapBucketSize.H new file mode 100755 index 000000000..cd66d0f72 --- /dev/null +++ b/src/usr/diag/prdf/common/util/prdfHeapBucketSize.H @@ -0,0 +1,81 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/prdfHeapBucketSize.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 PRDFHEAPBUCKETSIZE_H +#define PRDFHEAPBUCKETSIZE_H + + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#ifdef __HOSTBOOT_MODULE + #include <kernel/heapmgr.H> +#endif + + + +#ifdef __HOSTBOOT_MODULE +template <uint32_t bucket> +struct HeapBucketSize +{ + static const size_t value = HeapBucketSize<bucket-1>::value + + HeapBucketSize<bucket-2>::value; +}; + +template <> +struct HeapBucketSize<0> +{ + static const size_t value = HeapManager::BUCKET_SIZE0; +}; + +template <> +struct HeapBucketSize<1> +{ + static const size_t value = HeapManager::BUCKET_SIZE1; +}; + +template <typename T, uint32_t S, uint32_t bucket = 0> +struct RoundBucketSize +{ + static const size_t value = + (sizeof(T) * S > (HeapBucketSize<bucket>::value - sizeof(uint64_t))) ? + (RoundBucketSize<T,S, bucket+1>::value) : + ((HeapBucketSize<bucket>::value - sizeof(uint64_t)) / sizeof(T)); +}; + +template <typename T, uint32_t S> +struct RoundBucketSize<T,S,HeapManager::BUCKETS> +{ + static const size_t value = S; +}; + +#else +template <typename T, uint32_t S> +struct RoundBucketSize +{ + static const size_t value = S; +}; +#endif + + +#endif // define PRDFHEAPBUCKETSIZE_H diff --git a/src/usr/diag/prdf/common/util/prdfRegisterData.C b/src/usr/diag/prdf/common/util/prdfRegisterData.C new file mode 100755 index 000000000..04aaa6208 --- /dev/null +++ b/src/usr/diag/prdf/common/util/prdfRegisterData.C @@ -0,0 +1,37 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/prdfRegisterData.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2005,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 */ + +#include <prdfRegisterData.H> + +PrdrRegIdTable & prdfGetRegisterIdTable() +{ + static PrdrRegIdTable l_idTable = PrdrRegIdTable(); + return l_idTable; +} + +PrdrErrSigTable & prdfGetErrorSigTable() +{ + static PrdrErrSigTable l_sigTable = PrdrErrSigTable(); + return l_sigTable; +} + diff --git a/src/usr/diag/prdf/common/util/prdfRegisterData.H b/src/usr/diag/prdf/common/util/prdfRegisterData.H new file mode 100755 index 000000000..80f073384 --- /dev/null +++ b/src/usr/diag/prdf/common/util/prdfRegisterData.H @@ -0,0 +1,97 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/prdfRegisterData.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2005,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 __PRDRERRLPLUGINSUPT_H +#define __PRDRERRLPLUGINSUPT_H + +#define __PRDR_PLUGIN_HOMTYPE uint32_t +#define __PRDR_PLUGIN_IDTYPE uint32_t + +#define __PRDR_PLUGIN_XY(X,Y,Z) X##Y##_##Z +#define __PRDR_PLUGIN_MAKENAME(X,Y,Z) __PRDR_PLUGIN_XY(X,Y,Z) + +#ifndef PRDR_REGISTER_ID_TABLE_START + #define PRDR_REGISTER_ID_TABLE_START( homtype, offset) \ + class __PRDR_PLUGIN_MAKENAME(PrdrPlugin_RegTable_Reg_, homtype, offset)\ + { \ + public: \ + __PRDR_PLUGIN_MAKENAME(PrdrPlugin_RegTable_Reg_, \ + homtype, offset)(); \ + private: \ + struct __table_struct \ + { \ + uint32_t id; \ + char * name; \ + char * brief; \ + uint32_t address; \ + }; \ + static __table_struct cv_table[]; \ + }; \ + __PRDR_PLUGIN_MAKENAME(PrdrPlugin_RegTable_Reg_, homtype, offset) \ + __PRDR_PLUGIN_MAKENAME(g_PrdrPlugin_RegTable_Reg_, homtype, offset);\ + __PRDR_PLUGIN_MAKENAME(PrdrPlugin_RegTable_Reg_, homtype, offset)::\ + __PRDR_PLUGIN_MAKENAME(PrdrPlugin_RegTable_Reg_, homtype, offset)() \ + { \ + __PRDR_PLUGIN_HOMTYPE l_homtype = homtype; \ + __table_struct * l_tablePtr = cv_table; \ + while (NULL != l_tablePtr->name) \ + { \ + prdfGetRegisterIdTable()[l_homtype][l_tablePtr->id].name = \ + l_tablePtr->name; \ + prdfGetRegisterIdTable()[l_homtype][l_tablePtr->id].addr = \ + l_tablePtr->address; \ + l_tablePtr++; \ + } \ + } \ + __PRDR_PLUGIN_MAKENAME(PrdrPlugin_RegTable_Reg_, homtype, offset):: \ + __table_struct \ + __PRDR_PLUGIN_MAKENAME(PrdrPlugin_RegTable_Reg_, homtype, offset):: \ + cv_table[] = \ + { + + #define PRDR_REGISTER_ID( id , name, brief, address ) \ + { id , #name , brief, address } , + + #define PRDR_REGISTER_ID_TABLE_END \ + { 0, NULL, NULL, 0 } \ + }; +#endif + +#include <map> +#include <stdint.h> + +typedef std::map<__PRDR_PLUGIN_IDTYPE, const char *> PrdrErrSigEntries; +typedef std::map<__PRDR_PLUGIN_HOMTYPE, PrdrErrSigEntries> PrdrErrSigTable; + +struct PrdrRegIdStruct +{ + const char * name; + uint32_t addr; +}; + +typedef std::map<__PRDR_PLUGIN_IDTYPE, PrdrRegIdStruct> PrdrRegIdEntries; +typedef std::map<__PRDR_PLUGIN_HOMTYPE, PrdrRegIdEntries> PrdrRegIdTable; + +PrdrRegIdTable & prdfGetRegisterIdTable(); + +#endif diff --git a/src/usr/diag/prdf/common/util/prdfTimer.H b/src/usr/diag/prdf/common/util/prdfTimer.H new file mode 100755 index 000000000..30b369e7f --- /dev/null +++ b/src/usr/diag/prdf/common/util/prdfTimer.H @@ -0,0 +1,244 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/prdfTimer.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 PRDFTIMER_H +#define PRDFTIMER_H +/*! + @file prdfTimer.H + @brief PRD timer support +*/ + + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + + +#if !defined(__GNUC__) + typedef unsigned int uint32_t; + + #include <xsptodtypes.h> + + #if __IBMCPP__ < 500 + + #include <bool.h> + + #endif + +#endif + + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +/** + PrdTimer + @author Doug Gilbert + @par A PrdTimer holds the number of seconds since the beginning + of the year +*/ +class PrdTimer +{ +public: + enum + { + SEC_IN_DAY = 86400, + HALF_YEAR = 15768000, // + YEAR = 31536000 // except leap year - put we don't that kind of accuracy +// HALF_WEEK = 302400, // seconds in a half week +// WEEK = 604800 + }; + + struct prdftm_t + { + int sec; + int min; + int hour; + int wday; + int mday; + int yday; + int mon; + int year; + + prdftm_t() : + sec(0), min(0), hour(0), wday(0), + mday(0), yday(0), mon(0), year(0) {} + prdftm_t(int i_sec,int i_min,int i_hour,int i_wday, + int i_mday,int i_yday,int i_mon,int i_year) : + sec(i_sec), min(i_min), hour(i_hour), wday(i_wday), + mday(i_mday), yday(i_yday), mon(i_mon), year(i_year) {} + }; + + /** + Default Constructor + */ + PrdTimer() :xSec(0),ivTm() + { + } + + + /** + Ctor from uint32 seconds since the beginning of the year + @param seconds since the beginning of the year + @note If seconds > seconds_in_year then reduced by seconds_in_year + until seconds < seconds_in_year + */ + PrdTimer(unsigned int seconds) + : xSec(seconds % YEAR) {} + +#if !defined(__GNUC__) + /** + Constructor from a BIN_TIME_TYPE + @see xsptodtypes.h + */ + PrdTimer(const BIN_TIME_TYPE & b) + :xSec( b.seconds + + (b.minutes * 60) + + (b.hours * 3600) + + (b.day_of_month * SEC_IN_DAY + + month_base[b.month]) + ) + {} +#endif + + + /** + Copy Constructor + */ + PrdTimer(const PrdTimer & t) : xSec(t.xSec), ivTm(t.ivTm) {} + + /** + Assignment from another PrdTime object + */ + const PrdTimer & operator=(const PrdTimer & t) + { xSec = t.xSec; ivTm = t.ivTm; return *this; } + +#if !defined(__GNUC__) + /** + Assignment from a BIN_TIME_TYPE. + @see xsptodtypes.h + */ + const PrdTimer & operator=(const BIN_TIME_TYPE & b) + { + xSec = b.seconds + (b.minutes * 60) + + (b.hours * 3600) + (b.day_of_month*SEC_IN_DAY) + month_base[b.month]; + return *this; + } +#else + /** + Assignment from a uint64 + If seconds > seconds_in_year then reduced by seconds_in_year + until seconds < seconds_in_year + */ + const PrdTimer & operator=(const uint64_t & b) + { + xSec = b % YEAR; + return *this; + } +#endif + + /// equivalancy + bool operator==(const PrdTimer & t) const + { + return (xSec == t.xSec); + } + + + /** + Greater than + @return true if this > t2 and this - t2 < HALF_YEAR (no wrap) + OR this < t2 and t2 - xSec > HALF_YEAR (timer wrapped) + otherwise false + */ + bool operator>(const PrdTimer & t2) const + { + return ( ((xSec > t2.xSec) && (xSec - t2.xSec < HALF_YEAR)) || + ((xSec < t2.xSec) && (t2.xSec - xSec > HALF_YEAR))); + } + + + /** + Add seconds to the timer. + Internal timer value is wraped as needed + */ + PrdTimer operator+(unsigned int seconds) const + { + seconds = seconds % YEAR; + seconds += xSec; + seconds = seconds % YEAR; + return seconds; + } + + // diff time + unsigned int operator-(const PrdTimer & t) const { return (xSec - t.xSec); } + + // get seconds since the beginning of the year + unsigned int getSec() const { return xSec; } + + // get time struct + prdftm_t gettm() const { return ivTm; } + + // set time struct + void settm(prdftm_t& i_tm) + { + ivTm = i_tm; + xSec = ( ivTm.sec + + (ivTm.min * 60) + + (ivTm.hour * 3600) + + (ivTm.yday * SEC_IN_DAY) ); + } + +private: // functions +private: // Data + + uint32_t xSec; ///< Seconds since the beginning of the year (USA) + prdftm_t ivTm; + +#if !defined(__GNUC__) +static uint32_t month_base[12]; // # of seconds since start of year at start of month +#endif +}; + +#if !defined(__GNUC__) +#if defined(iipResolution_C) +uint32_t PrdTimer::month_base[12] = +{ + 0, + SEC_IN_DAY * 31, + SEC_IN_DAY * (31+28), + SEC_IN_DAY * (31+28+31), + SEC_IN_DAY * (31+28+31+30), + SEC_IN_DAY * (31+28+31+30+31), + SEC_IN_DAY * (31+28+31+30+31+30), + SEC_IN_DAY * (31+28+31+30+31+30+31), + SEC_IN_DAY * (31+28+31+30+31+30+31+31), + SEC_IN_DAY * (31+28+31+30+31+30+31+31+30), + SEC_IN_DAY * (31+28+31+30+31+30+31+31+30+31), + SEC_IN_DAY * (31+28+31+30+31+30+31+31+30+31+30) +}; +#endif +#endif + + +#endif /* PRDFTIME_H */ diff --git a/src/usr/diag/prdf/common/util/xspprdFilterLink.h b/src/usr/diag/prdf/common/util/xspprdFilterLink.h new file mode 100755 index 000000000..3fd0b91c0 --- /dev/null +++ b/src/usr/diag/prdf/common/util/xspprdFilterLink.h @@ -0,0 +1,26 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/xspprdFilterLink.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2001,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(PRDFFILTER_H) +#include <prdfFilters.H> +#endif diff --git a/src/usr/diag/prdf/common/util/xspprdScanCommFilter.h b/src/usr/diag/prdf/common/util/xspprdScanCommFilter.h new file mode 100755 index 000000000..a64820fe9 --- /dev/null +++ b/src/usr/diag/prdf/common/util/xspprdScanCommFilter.h @@ -0,0 +1,26 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/util/xspprdScanCommFilter.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2001,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(PRDFFILTER_H) +#include <prdfFilters.H> +#endif |