/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/diag/prdf/common/framework/register/iipErrorRegister.h $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* COPYRIGHT International Business Machines Corp. 1996,2014 */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
/* You may obtain a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
/* implied. See the License for the specific language governing */
/* permissions and limitations under the License. */
/* */
/* 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
//--------------------------------------------------------------------
namespace PRDF
{
class SCAN_COMM_REGISTER_CLASS;
class ResolutionMap;
class ErrorRegister : public ErrorRegisterType
{
public:
/**
Constructor
Parameter: Scan comm register
Parameter: Resolution Map
Parameter: Opt: ScrId [0 to 0xfe] - used with ErrorSignature
Notes: If no ScrId is provided then the scan
Comm register address is used
*/
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
Parameters: ServiceData object (error.service_data)
Returns: return code
Requirements: NoErrorOnZeroRead() if don't want rc == DD02 when no bits on in scr
Promises: error.service_data points to completed serviceData
Exceptions: None.
Notes: optional
*/
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
Parameters: None.
Returns: None.
Requirements: None.
Promises: Analyze() == SUCCESS when scr data has no bits on
Exceptions: None.
Notes: Normaly Anayze() returns DD02 if scr data is zero
*/
void NoErrorOnZeroScrRead(void) { xNoErrorOnZeroScr = true; }
protected:
/**
Read the scan comm register, apply any masks, and return the resulting bit string
Parameters: None
Returns: a Bit String
Requirements: None.
Promises: Bit string contains data from hardware with masked bits zeroed
Exceptions: None.
Notes: Any class that overides Read() but does not
override Analyze() should set src_rc
return code from mops scr access
*/
virtual const BIT_STRING_CLASS & Read(ATTENTION_TYPE i_attn);
/**
Filter the bit string (if a filter is provided) & convert it to a BitList
Parameters: Bit String
Returns: Bit List
Requirements: Read()
Promises: Bit list representation of the (filtered) bit string
Exceptions: None.
Notes: The default implementation does not have a filter
*/
virtual BIT_LIST_CLASS Filter(const BIT_STRING_CLASS & bs);
virtual bool FilterUndo(BitKey & i_bit_list) { return false; }
/**
Find a resolution for the Bit List
Parameters: reference to ServiceDataCollector to act on
Parameter: Bit List
Requirements: Filter()
Promises: The bit list may be modified if the search
algoithm modified it to find a match. (as in a fuzzy search)
Exceptions: None.
Notes: If no match for the Bit List is found in the
Resolution Map then the ResolutionMap default is used
*/
virtual int32_t Lookup(STEP_CODE_DATA_STRUCT & scd, BIT_LIST_CLASS & bl); // dg02c - pass bl by value
/**
Reset the hardware (if needed)
Parameters: Bit List, ServiceData (error.service_data)
Returns: return code
Requirements: LookUp()
Promises: Hardware may be modified, internal Mask may be modified
Exceptions: None.
Notes: Default implementation does nothing
*/
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;
};
} // end namespace PRDF
#endif /* iipErrorRegister_h */