diff options
Diffstat (limited to 'src/usr/diag/prdf/framework')
143 files changed, 32610 insertions, 0 deletions
diff --git a/src/usr/diag/prdf/framework/config/iipConfigurator.C b/src/usr/diag/prdf/framework/config/iipConfigurator.C new file mode 100755 index 000000000..63f50da79 --- /dev/null +++ b/src/usr/diag/prdf/framework/config/iipConfigurator.C @@ -0,0 +1,68 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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 +//--------------------------------------------------------------------- +Configurator::~Configurator() +{ +} +/*---------------------------------------------------------------------------*/ +/* Change Log */ +/*---------------------------------------------------------------------------*/ +/* Description / [Reason] Date USRID */ +// #undef syntax error, non inlined destructor /d24747.5 03/01/96 dgilbert +/* */ diff --git a/src/usr/diag/prdf/framework/config/iipConfigurator.h b/src/usr/diag/prdf/framework/config/iipConfigurator.h new file mode 100755 index 000000000..cf231a62e --- /dev/null +++ b/src/usr/diag/prdf/framework/config/iipConfigurator.h @@ -0,0 +1,206 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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; + +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 **************************************** + +}; + +#endif diff --git a/src/usr/diag/prdf/framework/config/iipDomain.C b/src/usr/diag/prdf/framework/config/iipDomain.C new file mode 100755 index 000000000..01cc4d97e --- /dev/null +++ b/src/usr/diag/prdf/framework/config/iipDomain.C @@ -0,0 +1,84 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/iipDomain.h b/src/usr/diag/prdf/framework/config/iipDomain.h new file mode 100755 index 000000000..bf1d9ed64 --- /dev/null +++ b/src/usr/diag/prdf/framework/config/iipDomain.h @@ -0,0 +1,126 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/iipDomainContainer.C b/src/usr/diag/prdf/framework/config/iipDomainContainer.C new file mode 100755 index 000000000..e952ce00d --- /dev/null +++ b/src/usr/diag/prdf/framework/config/iipDomainContainer.C @@ -0,0 +1,165 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/iipDomainContainer.h b/src/usr/diag/prdf/framework/config/iipDomainContainer.h new file mode 100755 index 000000000..0b24b2810 --- /dev/null +++ b/src/usr/diag/prdf/framework/config/iipDomainContainer.h @@ -0,0 +1,266 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/iipDomainContainer.inl b/src/usr/diag/prdf/framework/config/iipDomainContainer.inl new file mode 100755 index 000000000..6a57ac26e --- /dev/null +++ b/src/usr/diag/prdf/framework/config/iipDomainContainer.inl @@ -0,0 +1,57 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/iipSystem.C b/src/usr/diag/prdf/framework/config/iipSystem.C new file mode 100755 index 000000000..0405347b4 --- /dev/null +++ b/src/usr/diag/prdf/framework/config/iipSystem.C @@ -0,0 +1,338 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/iipSystem.h b/src/usr/diag/prdf/framework/config/iipSystem.h new file mode 100755 index 000000000..c4607d750 --- /dev/null +++ b/src/usr/diag/prdf/framework/config/iipSystem.h @@ -0,0 +1,312 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/iipchip.C b/src/usr/diag/prdf/framework/config/iipchip.C new file mode 100755 index 000000000..6d1ff4718 --- /dev/null +++ b/src/usr/diag/prdf/framework/config/iipchip.C @@ -0,0 +1,146 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/iipchip.h b/src/usr/diag/prdf/framework/config/iipchip.h new file mode 100755 index 000000000..193ed9a30 --- /dev/null +++ b/src/usr/diag/prdf/framework/config/iipchip.h @@ -0,0 +1,242 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/prdfExDomain.H b/src/usr/diag/prdf/framework/config/prdfExDomain.H new file mode 100644 index 000000000..f284a1654 --- /dev/null +++ b/src/usr/diag/prdf/framework/config/prdfExDomain.H @@ -0,0 +1,55 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/prdfExtensibleChip.H b/src/usr/diag/prdf/framework/config/prdfExtensibleChip.H new file mode 100755 index 000000000..9bd4989c3 --- /dev/null +++ b/src/usr/diag/prdf/framework/config/prdfExtensibleChip.H @@ -0,0 +1,68 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/prdfExtensibleDomain.C b/src/usr/diag/prdf/framework/config/prdfExtensibleDomain.C new file mode 100755 index 000000000..a02cfe818 --- /dev/null +++ b/src/usr/diag/prdf/framework/config/prdfExtensibleDomain.C @@ -0,0 +1,75 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/prdfExtensibleDomain.H b/src/usr/diag/prdf/framework/config/prdfExtensibleDomain.H new file mode 100755 index 000000000..cd8a7f829 --- /dev/null +++ b/src/usr/diag/prdf/framework/config/prdfExtensibleDomain.H @@ -0,0 +1,57 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/prdfFabricDomain.C b/src/usr/diag/prdf/framework/config/prdfFabricDomain.C new file mode 100755 index 000000000..1998da4c8 --- /dev/null +++ b/src/usr/diag/prdf/framework/config/prdfFabricDomain.C @@ -0,0 +1,523 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/prdfFabricDomain.H b/src/usr/diag/prdf/framework/config/prdfFabricDomain.H new file mode 100755 index 000000000..2d2af704c --- /dev/null +++ b/src/usr/diag/prdf/framework/config/prdfFabricDomain.H @@ -0,0 +1,163 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/prdfMbaDomain.H b/src/usr/diag/prdf/framework/config/prdfMbaDomain.H new file mode 100644 index 000000000..aff411447 --- /dev/null +++ b/src/usr/diag/prdf/framework/config/prdfMbaDomain.H @@ -0,0 +1,55 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/prdfMcsDomain.H b/src/usr/diag/prdf/framework/config/prdfMcsDomain.H new file mode 100644 index 000000000..a5a4ea21d --- /dev/null +++ b/src/usr/diag/prdf/framework/config/prdfMcsDomain.H @@ -0,0 +1,55 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/prdfMembufDomain.H b/src/usr/diag/prdf/framework/config/prdfMembufDomain.H new file mode 100644 index 000000000..9890cc9b9 --- /dev/null +++ b/src/usr/diag/prdf/framework/config/prdfMembufDomain.H @@ -0,0 +1,45 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/prdfParentDomain.C b/src/usr/diag/prdf/framework/config/prdfParentDomain.C new file mode 100755 index 000000000..4c265a387 --- /dev/null +++ b/src/usr/diag/prdf/framework/config/prdfParentDomain.C @@ -0,0 +1,106 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/prdfParentDomain.H b/src/usr/diag/prdf/framework/config/prdfParentDomain.H new file mode 100755 index 000000000..7ca9b3ff4 --- /dev/null +++ b/src/usr/diag/prdf/framework/config/prdfParentDomain.H @@ -0,0 +1,129 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/prdfPllDomain.C b/src/usr/diag/prdf/framework/config/prdfPllDomain.C new file mode 100755 index 000000000..464442d7e --- /dev/null +++ b/src/usr/diag/prdf/framework/config/prdfPllDomain.C @@ -0,0 +1,284 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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); + + // Set dump flag dg09a + serviceData.service_data->SetDump(iv_dumpContent,chip()[0]->GetChipHandle()); + + // 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( PllDomain * i_domain, + STEP_CODE_DATA_STRUCT i_sc ) +{ + // Clear children chips. + for ( uint32_t i = 0; i < i_domain->GetSize(); i++ ) + { + PrdfExtensibleChip * l_chip = i_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 = i_domain->getBeginIterator(); i != i_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( PllDomain * i_domain, + STEP_CODE_DATA_STRUCT i_sc ) +{ + // Mask children chips. + for ( uint32_t i = 0; i < i_domain->GetSize(); i++ ) + { + PrdfExtensibleChip * l_chip = i_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 = i_domain->getBeginIterator(); i != i_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/framework/config/prdfPllDomain.H b/src/usr/diag/prdf/framework/config/prdfPllDomain.H new file mode 100755 index 000000000..ee5fa1b05 --- /dev/null +++ b/src/usr/diag/prdf/framework/config/prdfPllDomain.H @@ -0,0 +1,224 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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 <prdfRuleChipDomain.H> +#include <prdfParentDomain.H> + +#ifndef iipResolutionFactory_h +#include <iipResolutionFactory.h> +#endif + +#include <prdfThresholdResolutions.H> +#include <hdctContent.H> // for hwTableContent + +#include <prdfExtensibleDomain.H> + +namespace PRDF +{ + +//------------------------------------------------------------------------------ + +class PllDomain : public PrdfRuleChipDomain, public PrdfExtensibleDomain, + public ParentDomain<PrdfExtensibleDomain> +{ + public: + + /** @fn PllDomain + * @brief Constructor + * @param DOMAIN_ID - the domain ID + * @param Resolution to callout the correct clock source + * @param Dump content + */ + PllDomain( DOMAIN_ID domain_id, Resolution & clockSource, + hwTableContent i_hwdc ); + + /** @fn PllDomain + * @brief Constructor + * @param DOMAIN_ID - the domain ID + * @param Resolution to callout the correct repower clock logic + * @param Resolution to callout the correct clock source + * @param Dump content + */ + PllDomain( DOMAIN_ID domain_id, Resolution & clockRpwr, + Resolution & clockSource, hwTableContent i_hwdc ); + + /** @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); + + /** @fn PllDomain + * @brief Constructor + * @param DOMAIN_ID - the domain ID + * @param Resolution to callout the correct repower clock logic + * @param Resolution to callout the correct clock source + * @param Dump content + * @param ThresholdResolution::ThresholdPolicy + */ + PllDomain( DOMAIN_ID domain_id, Resolution & clockRpwr, + Resolution & clockSource, hwTableContent i_hwdc, + const ThresholdResolution::ThresholdPolicy& i_mfgThresh); + /** + 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( PllDomain * 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( PllDomain * 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}; //dg03 + + Resolution & closeClockSource; + Resolution & farClockSource; + +// int threshold; dg05d + Resolution & iv_threshold; // dg05a dg06c + hwTableContent iv_dumpContent; //dg08a + +}; + +//------------------------------------------------------------------------------ + +inline +PllDomain::PllDomain( DOMAIN_ID domain_id, Resolution & clockSource, + hwTableContent i_hwdc ) : + PrdfRuleChipDomain( domain_id, PllDomain::CONTAINER_SIZE ), + PrdfExtensibleDomain("PllDomain"), + closeClockSource(clockSource), + farClockSource(clockSource), // dg06c + iv_threshold( ResolutionFactory::Access().GetThresholdResolution( 1, + ThresholdResolution::cv_pllDefault, + ThresholdResolution::cv_mnfgDefault ) ), + iv_dumpContent(i_hwdc) // dg08a +{ } + +inline +PllDomain::PllDomain( DOMAIN_ID domain_id, Resolution & clockRpwr, + Resolution & clockSource, hwTableContent i_hwdc ) : + PrdfRuleChipDomain( domain_id, PllDomain::CONTAINER_SIZE ), + PrdfExtensibleDomain("PllDomain"), + closeClockSource(clockRpwr), + farClockSource(clockSource), + iv_threshold( ResolutionFactory::Access().GetThresholdResolution( 1, + ThresholdResolution::cv_pllDefault, + ThresholdResolution::cv_mnfgDefault )), + iv_dumpContent(i_hwdc) //dg08a +{} + +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), // dg06c + iv_threshold( ResolutionFactory::Access().GetThresholdResolution( 1, + ThresholdResolution::cv_pllDefault, + i_mfgThresh ) ), + iv_dumpContent(i_hwdc) // dg08a +{ } + +inline +PllDomain::PllDomain( DOMAIN_ID domain_id, Resolution & clockRpwr, + Resolution & clockSource, hwTableContent i_hwdc, + const ThresholdResolution::ThresholdPolicy& i_mfgThresh) : + PrdfRuleChipDomain( domain_id, PllDomain::CONTAINER_SIZE ), + PrdfExtensibleDomain("PllDomain"), + closeClockSource(clockRpwr), + farClockSource(clockSource), + iv_threshold( ResolutionFactory::Access().GetThresholdResolution( 1, + ThresholdResolution::cv_pllDefault, + i_mfgThresh ) ), + iv_dumpContent(i_hwdc) //dg08a +{} + +//------------------------------------------------------------------------------ + +} // end namespace PRDF + +#endif /* prdfPllDomain_H */ + diff --git a/src/usr/diag/prdf/framework/config/prdfRuleChipDomain.C b/src/usr/diag/prdf/framework/config/prdfRuleChipDomain.C new file mode 100755 index 000000000..177a0182e --- /dev/null +++ b/src/usr/diag/prdf/framework/config/prdfRuleChipDomain.C @@ -0,0 +1,193 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/prdfRuleChipDomain.H b/src/usr/diag/prdf/framework/config/prdfRuleChipDomain.H new file mode 100755 index 000000000..af9cd7fa4 --- /dev/null +++ b/src/usr/diag/prdf/framework/config/prdfRuleChipDomain.H @@ -0,0 +1,77 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/prdfSystemSpecific.H b/src/usr/diag/prdf/framework/config/prdfSystemSpecific.H new file mode 100755 index 000000000..f9d9d0e1c --- /dev/null +++ b/src/usr/diag/prdf/framework/config/prdfSystemSpecific.H @@ -0,0 +1,54 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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 +{ + Configurator * getConfiguratorPtr(); + void postAnalysisWorkarounds(STEP_CODE_DATA_STRUCT & i_sdc); +}; + +#endif diff --git a/src/usr/diag/prdf/framework/config/xspprdAccessPllChip.C b/src/usr/diag/prdf/framework/config/xspprdAccessPllChip.C new file mode 100755 index 000000000..26b94d65f --- /dev/null +++ b/src/usr/diag/prdf/framework/config/xspprdAccessPllChip.C @@ -0,0 +1,206 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/config/xspprdAccessPllChip.h b/src/usr/diag/prdf/framework/config/xspprdAccessPllChip.h new file mode 100755 index 000000000..1c771330f --- /dev/null +++ b/src/usr/diag/prdf/framework/config/xspprdAccessPllChip.h @@ -0,0 +1,146 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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 +//-------------------------------------------------------------------- + +#if !defined(IIPCHIP_H) + #include <iipchip.h> +#endif + +//-------------------------------------------------------------------- +// 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/framework/makefile b/src/usr/diag/prdf/framework/makefile new file mode 100755 index 000000000..fc658e80d --- /dev/null +++ b/src/usr/diag/prdf/framework/makefile @@ -0,0 +1,29 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/framework/makefile $ +# +# 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 + +ROOTPATH = ../../../../.. + +SUBDIRS = rule.d + +include ${ROOTPATH}/config.mk + diff --git a/src/usr/diag/prdf/framework/register/iipCaptureData.h b/src/usr/diag/prdf/framework/register/iipCaptureData.h new file mode 100755 index 000000000..46601f0ca --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipCaptureData.h @@ -0,0 +1,367 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/iipErrorRegister.h b/src/usr/diag/prdf/framework/register/iipErrorRegister.h new file mode 100755 index 000000000..eaacfd893 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipErrorRegister.h @@ -0,0 +1,224 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/iipErrorRegisterFilter.h b/src/usr/diag/prdf/framework/register/iipErrorRegisterFilter.h new file mode 100755 index 000000000..fd330b852 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipErrorRegisterFilter.h @@ -0,0 +1,189 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/iipErrorRegisterMask.h b/src/usr/diag/prdf/framework/register/iipErrorRegisterMask.h new file mode 100755 index 000000000..d10ccb8d9 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipErrorRegisterMask.h @@ -0,0 +1,232 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/iipErrorRegisterSet.h b/src/usr/diag/prdf/framework/register/iipErrorRegisterSet.h new file mode 100755 index 000000000..29cb0c69b --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipErrorRegisterSet.h @@ -0,0 +1,124 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/iipErrorRegisterType.h b/src/usr/diag/prdf/framework/register/iipErrorRegisterType.h new file mode 100755 index 000000000..83325f27c --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipErrorRegisterType.h @@ -0,0 +1,180 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/iipMopRegisterAccess.C b/src/usr/diag/prdf/framework/register/iipMopRegisterAccess.C new file mode 100755 index 000000000..00a83c7d3 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipMopRegisterAccess.C @@ -0,0 +1,68 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/iipMopRegisterAccess.h b/src/usr/diag/prdf/framework/register/iipMopRegisterAccess.h new file mode 100755 index 000000000..053ff867a --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipMopRegisterAccess.h @@ -0,0 +1,189 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/iipMopRegisterAccess.inl b/src/usr/diag/prdf/framework/register/iipMopRegisterAccess.inl new file mode 100755 index 000000000..a73c5ed4e --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipMopRegisterAccess.inl @@ -0,0 +1,63 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/iipMopRegisterAccessScanComm.h b/src/usr/diag/prdf/framework/register/iipMopRegisterAccessScanComm.h new file mode 100755 index 000000000..daf257e3e --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipMopRegisterAccessScanComm.h @@ -0,0 +1,164 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/iipMopRegisterAccessScanComm.inl b/src/usr/diag/prdf/framework/register/iipMopRegisterAccessScanComm.inl new file mode 100755 index 000000000..84c99c4c0 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipMopRegisterAccessScanComm.inl @@ -0,0 +1,64 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/iipResetErrorRegister.h b/src/usr/diag/prdf/framework/register/iipResetErrorRegister.h new file mode 100755 index 000000000..89c0bea86 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipResetErrorRegister.h @@ -0,0 +1,316 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/iipScanCommRegisterAccess.C b/src/usr/diag/prdf/framework/register/iipScanCommRegisterAccess.C new file mode 100755 index 000000000..b34c4bb74 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipScanCommRegisterAccess.C @@ -0,0 +1,215 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/iipScanCommRegisterAccess.h b/src/usr/diag/prdf/framework/register/iipScanCommRegisterAccess.h new file mode 100755 index 000000000..48b849022 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipScanCommRegisterAccess.h @@ -0,0 +1,340 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/iipScanCommRegisterAccess.inl b/src/usr/diag/prdf/framework/register/iipScanCommRegisterAccess.inl new file mode 100755 index 000000000..547391a29 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipScanCommRegisterAccess.inl @@ -0,0 +1,68 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/iipScanCommRegisterChip.C b/src/usr/diag/prdf/framework/register/iipScanCommRegisterChip.C new file mode 100755 index 000000000..977cf73d0 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipScanCommRegisterChip.C @@ -0,0 +1,117 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/iipScanCommRegisterChip.h b/src/usr/diag/prdf/framework/register/iipScanCommRegisterChip.h new file mode 100755 index 000000000..a1a7c9608 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipScanCommRegisterChip.h @@ -0,0 +1,226 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/iipXorResetErrorRegister.h b/src/usr/diag/prdf/framework/register/iipXorResetErrorRegister.h new file mode 100755 index 000000000..07a0b7cd7 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipXorResetErrorRegister.h @@ -0,0 +1,143 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/iipscr.C b/src/usr/diag/prdf/framework/register/iipscr.C new file mode 100755 index 000000000..ee0166f4e --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipscr.C @@ -0,0 +1,286 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/iipscr.h b/src/usr/diag/prdf/framework/register/iipscr.h new file mode 100755 index 000000000..7fc70f9b2 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/iipscr.h @@ -0,0 +1,445 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/prdfCaptureData.C b/src/usr/diag/prdf/framework/register/prdfCaptureData.C new file mode 100755 index 000000000..715a5aec3 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/prdfCaptureData.C @@ -0,0 +1,436 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/prdfErrorRegister.C b/src/usr/diag/prdf/framework/register/prdfErrorRegister.C new file mode 100755 index 000000000..469891454 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/prdfErrorRegister.C @@ -0,0 +1,227 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/prdfErrorRegisterMask.C b/src/usr/diag/prdf/framework/register/prdfErrorRegisterMask.C new file mode 100755 index 000000000..21d5dc53b --- /dev/null +++ b/src/usr/diag/prdf/framework/register/prdfErrorRegisterMask.C @@ -0,0 +1,178 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/prdfHomRegisterAccess.C b/src/usr/diag/prdf/framework/register/prdfHomRegisterAccess.C new file mode 100755 index 000000000..b17e8f4ac --- /dev/null +++ b/src/usr/diag/prdf/framework/register/prdfHomRegisterAccess.C @@ -0,0 +1,457 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/prdfHomRegisterAccess.H b/src/usr/diag/prdf/framework/register/prdfHomRegisterAccess.H new file mode 100755 index 000000000..a0e9bca7d --- /dev/null +++ b/src/usr/diag/prdf/framework/register/prdfHomRegisterAccess.H @@ -0,0 +1,311 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/prdfOperatorRegister.H b/src/usr/diag/prdf/framework/register/prdfOperatorRegister.H new file mode 100755 index 000000000..b7bce1f55 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/prdfOperatorRegister.H @@ -0,0 +1,584 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/prdfResetErrorRegister.C b/src/usr/diag/prdf/framework/register/prdfResetErrorRegister.C new file mode 100755 index 000000000..e44d13bbe --- /dev/null +++ b/src/usr/diag/prdf/framework/register/prdfResetErrorRegister.C @@ -0,0 +1,199 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/prdfResetOperators.H b/src/usr/diag/prdf/framework/register/prdfResetOperators.H new file mode 100755 index 000000000..3538de220 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/prdfResetOperators.H @@ -0,0 +1,330 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/prdfScanFacility.C b/src/usr/diag/prdf/framework/register/prdfScanFacility.C new file mode 100755 index 000000000..2563bb0cc --- /dev/null +++ b/src/usr/diag/prdf/framework/register/prdfScanFacility.C @@ -0,0 +1,179 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/prdfScanFacility.H b/src/usr/diag/prdf/framework/register/prdfScanFacility.H new file mode 100755 index 000000000..237234e59 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/prdfScanFacility.H @@ -0,0 +1,203 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/register/xspprdAndResetErrorRegister.h b/src/usr/diag/prdf/framework/register/xspprdAndResetErrorRegister.h new file mode 100755 index 000000000..467dcb52a --- /dev/null +++ b/src/usr/diag/prdf/framework/register/xspprdAndResetErrorRegister.h @@ -0,0 +1,181 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/iipAnalyzeChipResolution.h b/src/usr/diag/prdf/framework/resolution/iipAnalyzeChipResolution.h new file mode 100755 index 000000000..bc918e1f5 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/iipAnalyzeChipResolution.h @@ -0,0 +1,112 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/iipCallAttnResolution.h b/src/usr/diag/prdf/framework/resolution/iipCallAttnResolution.h new file mode 100755 index 000000000..1501edf82 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/iipCallAttnResolution.h @@ -0,0 +1,117 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/iipCallResolutionTemplate.h b/src/usr/diag/prdf/framework/resolution/iipCallResolutionTemplate.h new file mode 100755 index 000000000..f63905caf --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/iipCallResolutionTemplate.h @@ -0,0 +1,115 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/iipCallout.h b/src/usr/diag/prdf/framework/resolution/iipCallout.h new file mode 100755 index 000000000..a0baa743e --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/iipCallout.h @@ -0,0 +1,167 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/iipCalloutMap.h b/src/usr/diag/prdf/framework/resolution/iipCalloutMap.h new file mode 100755 index 000000000..28f9fbc77 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/iipCalloutMap.h @@ -0,0 +1,152 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/iipCalloutResolution.h b/src/usr/diag/prdf/framework/resolution/iipCalloutResolution.h new file mode 100755 index 000000000..6f373ec5c --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/iipCalloutResolution.h @@ -0,0 +1,153 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/iipCaptureResolution.h b/src/usr/diag/prdf/framework/resolution/iipCaptureResolution.h new file mode 100755 index 000000000..3ce055018 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/iipCaptureResolution.h @@ -0,0 +1,138 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/iipEregResolution.h b/src/usr/diag/prdf/framework/resolution/iipEregResolution.h new file mode 100755 index 000000000..5aa3d31db --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/iipEregResolution.h @@ -0,0 +1,132 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/iipResolution.C b/src/usr/diag/prdf/framework/resolution/iipResolution.C new file mode 100755 index 000000000..c1cb0be6b --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/iipResolution.C @@ -0,0 +1,357 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/iipResolution.h b/src/usr/diag/prdf/framework/resolution/iipResolution.h new file mode 100755 index 000000000..4211d563b --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/iipResolution.h @@ -0,0 +1,161 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/iipResolutionFactory.C b/src/usr/diag/prdf/framework/resolution/iipResolutionFactory.C new file mode 100755 index 000000000..14c931db8 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/iipResolutionFactory.C @@ -0,0 +1,313 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/iipResolutionFactory.h b/src/usr/diag/prdf/framework/resolution/iipResolutionFactory.h new file mode 100755 index 000000000..e3ff286da --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/iipResolutionFactory.h @@ -0,0 +1,453 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/iipResolutionList.h b/src/usr/diag/prdf/framework/resolution/iipResolutionList.h new file mode 100755 index 000000000..96c2ad8b5 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/iipResolutionList.h @@ -0,0 +1,185 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/iipResolutionMap.h b/src/usr/diag/prdf/framework/resolution/iipResolutionMap.h new file mode 100755 index 000000000..4b1f10ebc --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/iipResolutionMap.h @@ -0,0 +1,24 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/iipTerminateResolution.h b/src/usr/diag/prdf/framework/resolution/iipTerminateResolution.h new file mode 100755 index 000000000..51843628d --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/iipTerminateResolution.h @@ -0,0 +1,139 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/iipThresholdResolution.h b/src/usr/diag/prdf/framework/resolution/iipThresholdResolution.h new file mode 100755 index 000000000..a6e9ff668 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/iipThresholdResolution.h @@ -0,0 +1,158 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/prdfAnalyzeConnected.H b/src/usr/diag/prdf/framework/resolution/prdfAnalyzeConnected.H new file mode 100755 index 000000000..18d17b13a --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/prdfAnalyzeConnected.H @@ -0,0 +1,125 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/prdfCalloutConnected.H b/src/usr/diag/prdf/framework/resolution/prdfCalloutConnected.H new file mode 100755 index 000000000..3629f2055 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/prdfCalloutConnected.H @@ -0,0 +1,139 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/prdfCalloutMap.H b/src/usr/diag/prdf/framework/resolution/prdfCalloutMap.H new file mode 100644 index 000000000..48eed6bec --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/prdfCalloutMap.H @@ -0,0 +1,140 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/prdfCallouts.H b/src/usr/diag/prdf/framework/resolution/prdfCallouts.H new file mode 100755 index 000000000..87a3fd9e5 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/prdfCallouts.H @@ -0,0 +1,198 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/prdfCaptureResolution.C b/src/usr/diag/prdf/framework/resolution/prdfCaptureResolution.C new file mode 100755 index 000000000..2c8228269 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/prdfCaptureResolution.C @@ -0,0 +1,41 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/prdfCaptureResolution.H b/src/usr/diag/prdf/framework/resolution/prdfCaptureResolution.H new file mode 100755 index 000000000..223668d64 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/prdfCaptureResolution.H @@ -0,0 +1,73 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/prdfClockResolution.C b/src/usr/diag/prdf/framework/resolution/prdfClockResolution.C new file mode 100755 index 000000000..f572b7155 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/prdfClockResolution.C @@ -0,0 +1,93 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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: The target needs to be compared with valid clock targets. + 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. + serviceData.service_data->SetCallout(l_ptargetClock); + } + // Get all connected chips for non-CLOCK_CARD types. + else + { + //Callout every device connected to this clock source. + // FIXME: Clock targets will need to be supported in getConnected(). + 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); +} + +// 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/framework/resolution/prdfClockResolution.H b/src/usr/diag/prdf/framework/resolution/prdfClockResolution.H new file mode 100755 index 000000000..fcc3d5834 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/prdfClockResolution.H @@ -0,0 +1,111 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/prdfErrorTypeResolution.H b/src/usr/diag/prdf/framework/resolution/prdfErrorTypeResolution.H new file mode 100755 index 000000000..e6cc7c493 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/prdfErrorTypeResolution.H @@ -0,0 +1,110 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/prdfIntervalThresholdResolution.H b/src/usr/diag/prdf/framework/resolution/prdfIntervalThresholdResolution.H new file mode 100755 index 000000000..072874829 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/prdfIntervalThresholdResolution.H @@ -0,0 +1,189 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/prdfPluginCallResolution.H b/src/usr/diag/prdf/framework/resolution/prdfPluginCallResolution.H new file mode 100755 index 000000000..80e1e2a1f --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/prdfPluginCallResolution.H @@ -0,0 +1,81 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/prdfResetThresholdResolution.H b/src/usr/diag/prdf/framework/resolution/prdfResetThresholdResolution.H new file mode 100755 index 000000000..1cb23d358 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/prdfResetThresholdResolution.H @@ -0,0 +1,129 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/prdfResolutionList.H b/src/usr/diag/prdf/framework/resolution/prdfResolutionList.H new file mode 100755 index 000000000..5c1901788 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/prdfResolutionList.H @@ -0,0 +1,47 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/prdfResolutionMap.C b/src/usr/diag/prdf/framework/resolution/prdfResolutionMap.C new file mode 100755 index 000000000..cb6dec7b5 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/prdfResolutionMap.C @@ -0,0 +1,381 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/prdfResolutionMap.H b/src/usr/diag/prdf/framework/resolution/prdfResolutionMap.H new file mode 100755 index 000000000..c0864d52b --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/prdfResolutionMap.H @@ -0,0 +1,258 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/prdfThresholdResolutions.C b/src/usr/diag/prdf/framework/resolution/prdfThresholdResolutions.C new file mode 100755 index 000000000..24c167c06 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/prdfThresholdResolutions.C @@ -0,0 +1,259 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/prdfThresholdResolutions.H b/src/usr/diag/prdf/framework/resolution/prdfThresholdResolutions.H new file mode 100755 index 000000000..7bccc7c62 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/prdfThresholdResolutions.H @@ -0,0 +1,278 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/xspprdDumpResolution.C b/src/usr/diag/prdf/framework/resolution/xspprdDumpResolution.C new file mode 100755 index 000000000..2e9457931 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/xspprdDumpResolution.C @@ -0,0 +1,55 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/xspprdDumpResolution.h b/src/usr/diag/prdf/framework/resolution/xspprdDumpResolution.h new file mode 100755 index 000000000..f8749f1ec --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/xspprdDumpResolution.h @@ -0,0 +1,137 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/xspprdFlagResolution.C b/src/usr/diag/prdf/framework/resolution/xspprdFlagResolution.C new file mode 100755 index 000000000..7331bf728 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/xspprdFlagResolution.C @@ -0,0 +1,57 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/xspprdFlagResolution.h b/src/usr/diag/prdf/framework/resolution/xspprdFlagResolution.h new file mode 100755 index 000000000..876b25e2f --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/xspprdFlagResolution.h @@ -0,0 +1,124 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/xspprdGardResolution.C b/src/usr/diag/prdf/framework/resolution/xspprdGardResolution.C new file mode 100755 index 000000000..483c18eb2 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/xspprdGardResolution.C @@ -0,0 +1,75 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/xspprdGardResolution.h b/src/usr/diag/prdf/framework/resolution/xspprdGardResolution.h new file mode 100755 index 000000000..70ae9d727 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/xspprdGardResolution.h @@ -0,0 +1,141 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/resolution/xspprdTryResolution.h b/src/usr/diag/prdf/framework/resolution/xspprdTryResolution.h new file mode 100755 index 000000000..c9f4dd5e1 --- /dev/null +++ b/src/usr/diag/prdf/framework/resolution/xspprdTryResolution.h @@ -0,0 +1,134 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/iipTemplates.C b/src/usr/diag/prdf/framework/rule/iipTemplates.C new file mode 100755 index 000000000..b5d7629c8 --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/iipTemplates.C @@ -0,0 +1,39 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/makefile b/src/usr/diag/prdf/framework/rule/makefile new file mode 100755 index 000000000..56846c303 --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/makefile @@ -0,0 +1,133 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/framework/rule/makefile $ +# +# 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 + +ROOTPATH = ../../../../../.. + +RULEOBJDIR = ${ROOTPATH}/obj/modules/prdf/rule + +#------------------------------------------------------------------------------ +# Generated files +#------------------------------------------------------------------------------ +PRDR_CMP = prdrCompile +PRDR_CMP_o = ${PRDR_CMP}.o +PRDR_CMP_C = ${PRDR_CMP}.C + +PRDR_CMP_YACC = ${PRDR_CMP}.y +PRDR_CMP_YACC_o = ${PRDR_CMP_YACC}.o +PRDR_CMP_YACC_C = ${PRDR_CMP_YACC}.C +PRDR_CMP_YACC_H = ${PRDR_CMP_YACC}.H + +PRDR_CMP_FLEX = ${PRDR_CMP}.lex +PRDR_CMP_FLEX_o = ${PRDR_CMP_FLEX}.o +PRDR_CMP_FLEX_C = ${PRDR_CMP_FLEX}.C + +PRDR_CMP_PATH = ${RULEOBJDIR}/${PRDR_CMP} +PRDR_CMP_o_PATH = ${RULEOBJDIR}/${PRDR_CMP_o} + +PRDR_CMP_YACC_o_PATH = ${RULEOBJDIR}/${PRDR_CMP_YACC_o} +PRDR_CMP_YACC_C_PATH = ${RULEOBJDIR}/${PRDR_CMP_YACC_C} +PRDR_CMP_YACC_H_PATH = ${RULEOBJDIR}/${PRDR_CMP_YACC_H} + +PRDR_CMP_FLEX_o_PATH = ${RULEOBJDIR}/${PRDR_CMP_FLEX_o} +PRDR_CMP_FLEX_C_PATH = ${RULEOBJDIR}/${PRDR_CMP_FLEX_C} + +include ../../prd_ruletable.mk # for PRDR_RULE_TABLE_TARGETS + +#------------------------------------------------------------------------------- +# code_pass +#------------------------------------------------------------------------------- + +# Build the .prf image files +EXTRA_PARTS = $(addprefix ${IMGDIR}/, ${PRDR_RULE_TABLE_TARGETS}) + +# Clean up the auto generate source files +EXTRA_CLEAN = ${PRDR_CMP_PATH} \ + ${PRDR_CMP_o_PATH} \ + ${PRDR_CMP_YACC_o_PATH} \ + ${PRDR_CMP_YACC_C_PATH} \ + ${PRDR_CMP_YACC_H_PATH} \ + ${PRDR_CMP_FLEX_o_PATH} \ + ${PRDR_CMP_FLEX_C_PATH} \ + $(addprefix ${RULEOBJDIR}/, ${PRDR_RULE_TABLE_TARGETS}) + +# NOTE: All rules defined in this makefile must be done after this line +# otherwise the default rule 'all' will not be called. +include ${ROOTPATH}/config.mk + +#------------------------------------------------------------------------------- +# Build the flex/yacc source code +#------------------------------------------------------------------------------- + +${PRDR_CMP_YACC_C_PATH} ${PRDR_CMP_YACC_H_PATH}: ${PRDR_CMP_YACC} + mkdir -p ${RULEOBJDIR} + bison -d -o ${PRDR_CMP_YACC_C_PATH} $^ + +PRDR_CMP_FLEX: ; # Discard implicit rule for %.lex <- %.lex.C +${PRDR_CMP_FLEX_C_PATH}: ${PRDR_CMP_FLEX} + mkdir -p ${RULEOBJDIR} + flex -o$@ $^ + +#------------------------------------------------------------------------------ +# Build the PRD rule compiler +#------------------------------------------------------------------------------ + +USERDEFINES = -D__HOSTBOOT_MODULE -O3 -pipe + +${PRDR_CMP_YACC_o_PATH}: ${PRDR_CMP_YACC_C_PATH} ${PRDR_CMP_YACC_H_PATH} + i686-mcp6-g++ -c $(USERDEFINES) $< \ + -I ./ -I ../../util -I ${RULEOBJDIR} \ + -o $@ + +${PRDR_CMP_FLEX_o_PATH}: ${PRDR_CMP_FLEX_C_PATH} ${PRDR_CMP_YACC_H_PATH} + i686-mcp6-g++ -c $(USERDEFINES) $< \ + -I ./ -I ../../util -I ${RULEOBJDIR} \ + -o $@ + +${PRDR_CMP_o_PATH}: ${PRDR_CMP_C} + i686-mcp6-g++ -c $(USERDEFINES) $< \ + -I ./ -I ../.. -I ../../util -I ${GENDIR} -I ${RULEOBJDIR} \ + -I ../resolution -I ../service \ + -o $@ + +${PRDR_CMP_PATH}: ${PRDR_CMP_YACC_o_PATH} ${PRDR_CMP_FLEX_o_PATH} \ + ${PRDR_CMP_o_PATH} + i686-mcp6-g++ $(USERDEFINES) \ + ${PRDR_CMP_YACC_o_PATH} ${PRDR_CMP_FLEX_o_PATH} ${PRDR_CMP_o_PATH} \ + -o $@ + +#------------------------------------------------------------------------------ +# Build the .prf files +#------------------------------------------------------------------------------ + +vpath %.rule ../../plat/pegasus +PRDRPP_SEARCHDIRS = -I../../plat/pegasus + +# Build .prf files from .rule files and store them in ${RULEOBJDIR} +${RULEOBJDIR}/%.prf : %.rule ${PRDR_CMP_PATH} + cat $< | ./prdrpp ${PRDRPP_SEARCHDIRS} \ + | i686-mcp6-jail ${PRDR_CMP_PATH} $@ + +# Copy all .prf files from ${RULEOBJDIR} to ${IMGDIR} +${EXTRA_PARTS}: ${IMGDIR}/% : ${RULEOBJDIR}/% + cp -f $^ $@ + diff --git a/src/usr/diag/prdf/framework/rule/prdfGroup.C b/src/usr/diag/prdf/framework/rule/prdfGroup.C new file mode 100755 index 000000000..2b10643aa --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdfGroup.C @@ -0,0 +1,279 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdfGroup.H b/src/usr/diag/prdf/framework/rule/prdfGroup.H new file mode 100755 index 000000000..4bf12ab0a --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdfGroup.H @@ -0,0 +1,113 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdfPluginDef.H b/src/usr/diag/prdf/framework/rule/prdfPluginDef.H new file mode 100755 index 000000000..3b03d01b7 --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdfPluginDef.H @@ -0,0 +1,368 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdfPluginMap.C b/src/usr/diag/prdf/framework/rule/prdfPluginMap.C new file mode 100755 index 000000000..a2dfa838e --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdfPluginMap.C @@ -0,0 +1,53 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdfPluginMap.H b/src/usr/diag/prdf/framework/rule/prdfPluginMap.H new file mode 100755 index 000000000..b9344cb1c --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdfPluginMap.H @@ -0,0 +1,75 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdfRuleChip.C b/src/usr/diag/prdf/framework/rule/prdfRuleChip.C new file mode 100755 index 000000000..5a0f1f5d1 --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdfRuleChip.C @@ -0,0 +1,1003 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdfRuleChip.H b/src/usr/diag/prdf/framework/rule/prdfRuleChip.H new file mode 100755 index 000000000..9c0b0859f --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdfRuleChip.H @@ -0,0 +1,193 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdfRuleFiles.C b/src/usr/diag/prdf/framework/rule/prdfRuleFiles.C new file mode 100755 index 000000000..4be2704ea --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdfRuleFiles.C @@ -0,0 +1,45 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdfRuleFiles.H b/src/usr/diag/prdf/framework/rule/prdfRuleFiles.H new file mode 100755 index 000000000..6515bd7df --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdfRuleFiles.H @@ -0,0 +1,47 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdrChip.H b/src/usr/diag/prdf/framework/rule/prdrChip.H new file mode 100755 index 000000000..ea1826d11 --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdrChip.H @@ -0,0 +1,189 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdrCommon.H b/src/usr/diag/prdf/framework/rule/prdrCommon.H new file mode 100755 index 000000000..46a20cd62 --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdrCommon.H @@ -0,0 +1,178 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdrCompile.C b/src/usr/diag/prdf/framework/rule/prdrCompile.C new file mode 100755 index 000000000..4f9028953 --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdrCompile.C @@ -0,0 +1,548 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdrCompile.lex b/src/usr/diag/prdf/framework/rule/prdrCompile.lex new file mode 100755 index 000000000..1c9ee1f54 --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdrCompile.lex @@ -0,0 +1,213 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdrCompile.y b/src/usr/diag/prdf/framework/rule/prdrCompile.y new file mode 100755 index 000000000..3de83cb2b --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdrCompile.y @@ -0,0 +1,999 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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: 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. (RTC: 51218) + | '/' 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/framework/rule/prdrExpr.H b/src/usr/diag/prdf/framework/rule/prdrExpr.H new file mode 100755 index 000000000..adb32fad9 --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdrExpr.H @@ -0,0 +1,1046 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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 ) + { + uint32_t seconds = iv_units * iv_base; + + 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/framework/rule/prdrGroup.H b/src/usr/diag/prdf/framework/rule/prdrGroup.H new file mode 100755 index 000000000..ee0f1026b --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdrGroup.H @@ -0,0 +1,247 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdrLoadChip.C b/src/usr/diag/prdf/framework/rule/prdrLoadChip.C new file mode 100755 index 000000000..c885c55c9 --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdrLoadChip.C @@ -0,0 +1,505 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdrLoadChip.H b/src/usr/diag/prdf/framework/rule/prdrLoadChip.H new file mode 100755 index 000000000..40b7b18c1 --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdrLoadChip.H @@ -0,0 +1,240 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdrLoadChipCache.C b/src/usr/diag/prdf/framework/rule/prdrLoadChipCache.C new file mode 100755 index 000000000..75918e4a1 --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdrLoadChipCache.C @@ -0,0 +1,170 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdrLoadChipCache.H b/src/usr/diag/prdf/framework/rule/prdrLoadChipCache.H new file mode 100755 index 000000000..6089bd426 --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdrLoadChipCache.H @@ -0,0 +1,82 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdrRegister.H b/src/usr/diag/prdf/framework/rule/prdrRegister.H new file mode 100755 index 000000000..d635652f6 --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdrRegister.H @@ -0,0 +1,300 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdrSignatures.H b/src/usr/diag/prdf/framework/rule/prdrSignatures.H new file mode 100755 index 000000000..83debdbed --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdrSignatures.H @@ -0,0 +1,36 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdrToken.H b/src/usr/diag/prdf/framework/rule/prdrToken.H new file mode 100755 index 000000000..859cacd76 --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/prdrToken.H @@ -0,0 +1,66 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/rule/prdrpp b/src/usr/diag/prdf/framework/rule/prdrpp new file mode 100755 index 000000000..bbfc5e6fa --- /dev/null +++ b/src/usr/diag/prdf/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/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/framework/rule/tables.mk b/src/usr/diag/prdf/framework/rule/tables.mk new file mode 100755 index 000000000..200fff8e4 --- /dev/null +++ b/src/usr/diag/prdf/framework/rule/tables.mk @@ -0,0 +1,57 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/diag/prdf/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: +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/framework/service/iipServiceDataCollector.h b/src/usr/diag/prdf/framework/service/iipServiceDataCollector.h new file mode 100755 index 000000000..94dbc4d27 --- /dev/null +++ b/src/usr/diag/prdf/framework/service/iipServiceDataCollector.h @@ -0,0 +1,1042 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/service/iipServiceDataCollector.inl b/src/usr/diag/prdf/framework/service/iipServiceDataCollector.inl new file mode 100755 index 000000000..956968c75 --- /dev/null +++ b/src/usr/diag/prdf/framework/service/iipServiceDataCollector.inl @@ -0,0 +1,150 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/service/iipsdbug.h b/src/usr/diag/prdf/framework/service/iipsdbug.h new file mode 100755 index 000000000..132ed2dc1 --- /dev/null +++ b/src/usr/diag/prdf/framework/service/iipsdbug.h @@ -0,0 +1,298 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/service/iipstep.h b/src/usr/diag/prdf/framework/service/iipstep.h new file mode 100755 index 000000000..ef20bcec8 --- /dev/null +++ b/src/usr/diag/prdf/framework/service/iipstep.h @@ -0,0 +1,114 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/service/prdfPfa5Data.h b/src/usr/diag/prdf/framework/service/prdfPfa5Data.h new file mode 100755 index 000000000..1ea0cc5c0 --- /dev/null +++ b/src/usr/diag/prdf/framework/service/prdfPfa5Data.h @@ -0,0 +1,433 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/service/prdfPlatServices.C b/src/usr/diag/prdf/framework/service/prdfPlatServices.C new file mode 100755 index 000000000..07ab94da3 --- /dev/null +++ b/src/usr/diag/prdf/framework/service/prdfPlatServices.C @@ -0,0 +1,413 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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> +#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, +}; + +#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 ); } + +//############################################################################## +//## 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 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; + + // TODO: Call dimmGetBadDqBitmap() 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; +} + +//------------------------------------------------------------------------------ + +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; +} + +#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/framework/service/prdfPlatServices.H b/src/usr/diag/prdf/framework/service/prdfPlatServices.H new file mode 100755 index 000000000..5ab99bb44 --- /dev/null +++ b/src/usr/diag/prdf/framework/service/prdfPlatServices.H @@ -0,0 +1,236 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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> + +//------------------------------------------------------------------------------ + +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(); + +//############################################################################## +//## 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 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. + */ +/* TODO - See .C +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] ); +*/ + +/** + * @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 ); + +#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/framework/service/prdfServiceDataCollector.C b/src/usr/diag/prdf/framework/service/prdfServiceDataCollector.C new file mode 100755 index 000000000..8374b8434 --- /dev/null +++ b/src/usr/diag/prdf/framework/service/prdfServiceDataCollector.C @@ -0,0 +1,397 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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 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) ); + + uint32_t value = buffer_get32(i_flatdata); // number of callouts + ClearCallouts(); + for(uint32_t i = 0; i < value; ++i) + { + MruType mt = (MruType) buffer_get32(i_flatdata); // callout type + if ( PRDcallout::TYPE_TARGET == mt ) + { + // Retrieving target. + TARGETING::TargetHandle_t l_pChipHandle + = buffer_getTarget(i_flatdata); + + if(NULL !=l_pChipHandle) + { + //Resurrecting prdcallout from all the data elements + PRDcallout callout((TARGETING:: + TargetHandle_t)l_pChipHandle, + mt); + xMruList.push_back( SdcCallout( callout, + (PRDpriority)buffer_get32 + (i_flatdata)) + ); // callout priority + } + + } + else + { + uint32_t mru = buffer_get32(i_flatdata); // other callouts + //Resurrecting prdcallout from all the data elements + PRDcallout callout(mru,mt); + xMruList.push_back( SdcCallout(callout, + (PRDpriority)buffer_get32(i_flatdata))); // 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/framework/service/prdfTargetServices.C b/src/usr/diag/prdf/framework/service/prdfTargetServices.C new file mode 100755 index 000000000..8958f787f --- /dev/null +++ b/src/usr/diag/prdf/framework/service/prdfTargetServices.C @@ -0,0 +1,1088 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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; +} + +//############################################################################## +//## +//## Clock specific functions +//## +//############################################################################## + +bool areClocksOn(TARGETING::TargetHandle_t i_pGivenTarget) +{ + bool o_clocksOn = false; + + #ifdef __HOSTBOOT_MODULE + + // TODO No such target or attribute available for now + o_clocksOn = true; + + #else + + if ( NULL != i_pGivenTarget ) + { + errlHndl_t errl = NULL; + // TODO: all relevant header files are not exported yet + //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; +} + +//------------------------------------------------------------------------------ + +TARGETING::TargetHandle_t getClockId(TARGETING::TargetHandle_t + i_pGivenTarget, + TARGETING ::TYPE targetype) +{ + TargetHandleList l_clockCardlist; + TargetHandle_t o_pClockCardHandle = NULL; + + // TODO Cards are not getting modeled for now + return o_pClockCardHandle ; +} + +//------------------------------------------------------------------------------ + +TARGETING::TargetHandle_t getClockMux(TARGETING::TargetHandle_t + i_pGivenTarget) +{ + //Modeling info of card and Clock mux is required + //TODO specify correct association type needs to be determined. + // PredicateCTM l_ClockMux(CLASS_UNIT,TYPE_CLOCK_MUX); + //defined for compilation + PredicateCTM l_ClockMux(CLASS_UNIT); + TargetHandle_t o_ptargetClockMux = NULL; + //TODO: Clock support for target not present yet. + #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/framework/service/prdfTargetServices.H b/src/usr/diag/prdf/framework/service/prdfTargetServices.H new file mode 100755 index 000000000..20eb9e089 --- /dev/null +++ b/src/usr/diag/prdf/framework/service/prdfTargetServices.H @@ -0,0 +1,348 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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 ); + +//############################################################################## +//## +//## 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/framework/service/prdfWorkarounds.H b/src/usr/diag/prdf/framework/service/prdfWorkarounds.H new file mode 100755 index 000000000..4ace33863 --- /dev/null +++ b/src/usr/diag/prdf/framework/service/prdfWorkarounds.H @@ -0,0 +1,44 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/service/prdf_ras_services.C b/src/usr/diag/prdf/framework/service/prdf_ras_services.C new file mode 100755 index 000000000..1e388032e --- /dev/null +++ b/src/usr/diag/prdf/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/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", (uint32_t)((*i).callout) ); + + 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/framework/service/prdf_ras_services.H b/src/usr/diag/prdf/framework/service/prdf_ras_services.H new file mode 100755 index 000000000..84455b963 --- /dev/null +++ b/src/usr/diag/prdf/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/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/framework/service/xspprdService.h b/src/usr/diag/prdf/framework/service/xspprdService.h new file mode 100755 index 000000000..bea7eb7a9 --- /dev/null +++ b/src/usr/diag/prdf/framework/service/xspprdService.h @@ -0,0 +1,193 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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/framework/service/xspprdsdbug.C b/src/usr/diag/prdf/framework/service/xspprdsdbug.C new file mode 100755 index 000000000..d2dd1f262 --- /dev/null +++ b/src/usr/diag/prdf/framework/service/xspprdsdbug.C @@ -0,0 +1,238 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/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); + } + } +} |