From 4dea56a10f144a1b0acb8aa9cc027870fd3c8d41 Mon Sep 17 00:00:00 2001 From: Zane Shelley Date: Mon, 7 Mar 2016 17:09:21 -0600 Subject: PRD: moved rule/ out of framework/ Change-Id: I4ddfa567abb576f7949bf8a9c4ab5ee530eed70e RTC: 140081 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/21860 Tested-by: Jenkins Server Reviewed-by: Caleb N. Palmer Reviewed-by: Benjamin J. Weisenbeck Reviewed-by: William G. Hoffa Reviewed-by: Zane C. Shelley Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/22137 Reviewed-by: Daniel M. Crowell --- .../diag/prdf/common/framework/rule/iipTemplates.C | 34 - .../diag/prdf/common/framework/rule/prdfGroup.C | 288 ----- .../diag/prdf/common/framework/rule/prdfGroup.H | 119 -- .../prdf/common/framework/rule/prdfPluginDef.H | 368 ------ .../prdf/common/framework/rule/prdfPluginMap.C | 58 - .../prdf/common/framework/rule/prdfPluginMap.H | 80 -- .../diag/prdf/common/framework/rule/prdfRuleChip.C | 161 --- .../diag/prdf/common/framework/rule/prdfRuleChip.H | 157 --- .../prdf/common/framework/rule/prdfRuleFiles.C | 48 - .../prdf/common/framework/rule/prdfRuleFiles.H | 50 - .../prdf/common/framework/rule/prdfRuleMetaData.C | 1182 -------------------- .../prdf/common/framework/rule/prdfRuleMetaData.H | 308 ----- .../diag/prdf/common/framework/rule/prdf_rule.mk | 38 - src/usr/diag/prdf/common/framework/rule/prdrChip.H | 186 --- .../diag/prdf/common/framework/rule/prdrCommon.H | 176 --- .../diag/prdf/common/framework/rule/prdrCompile.C | 525 --------- .../prdf/common/framework/rule/prdrCompile.lex | 227 ---- .../diag/prdf/common/framework/rule/prdrCompile.y | 1052 ----------------- src/usr/diag/prdf/common/framework/rule/prdrExpr.H | 1060 ------------------ .../diag/prdf/common/framework/rule/prdrGroup.H | 269 ----- .../diag/prdf/common/framework/rule/prdrLoadChip.C | 549 --------- .../diag/prdf/common/framework/rule/prdrLoadChip.H | 251 ----- .../prdf/common/framework/rule/prdrLoadChipCache.C | 173 --- .../prdf/common/framework/rule/prdrLoadChipCache.H | 83 -- .../diag/prdf/common/framework/rule/prdrRegister.H | 370 ------ .../prdf/common/framework/rule/prdrSignatures.H | 36 - .../diag/prdf/common/framework/rule/prdrToken.H | 64 -- src/usr/diag/prdf/common/framework/rule/prdrpp | 80 -- src/usr/diag/prdf/common/framework/rule/tables.mk | 51 - 29 files changed, 8043 deletions(-) delete mode 100755 src/usr/diag/prdf/common/framework/rule/iipTemplates.C delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdfGroup.C delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdfGroup.H delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdfPluginDef.H delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdfPluginMap.C delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdfPluginMap.H delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdfRuleChip.C delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdfRuleChip.H delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdfRuleFiles.C delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdfRuleFiles.H delete mode 100644 src/usr/diag/prdf/common/framework/rule/prdfRuleMetaData.C delete mode 100644 src/usr/diag/prdf/common/framework/rule/prdfRuleMetaData.H delete mode 100644 src/usr/diag/prdf/common/framework/rule/prdf_rule.mk delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdrChip.H delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdrCommon.H delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdrCompile.C delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdrCompile.lex delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdrCompile.y delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdrExpr.H delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdrGroup.H delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdrLoadChip.C delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdrLoadChip.H delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdrLoadChipCache.C delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdrLoadChipCache.H delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdrRegister.H delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdrSignatures.H delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdrToken.H delete mode 100755 src/usr/diag/prdf/common/framework/rule/prdrpp delete mode 100755 src/usr/diag/prdf/common/framework/rule/tables.mk (limited to 'src/usr/diag/prdf/common/framework') diff --git a/src/usr/diag/prdf/common/framework/rule/iipTemplates.C b/src/usr/diag/prdf/common/framework/rule/iipTemplates.C deleted file mode 100755 index ef42dc412..000000000 --- a/src/usr/diag/prdf/common/framework/rule/iipTemplates.C +++ /dev/null @@ -1,34 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/iipTemplates.C $ */ -/* */ -/* 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 */ - -#include -#include -#include - -namespace PRDF -{ - -template class DomainContainer; - -} // end namespace PRDF - diff --git a/src/usr/diag/prdf/common/framework/rule/prdfGroup.C b/src/usr/diag/prdf/common/framework/rule/prdfGroup.C deleted file mode 100755 index 61043540a..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdfGroup.C +++ /dev/null @@ -1,288 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdfGroup.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* 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 */ - -#include - -#include - -#include -#include -#include -#include -#include - -namespace PRDF -{ - -Group::~Group() -{ - 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 Group::Analyze(STEP_CODE_DATA_STRUCT & i_step) -{ - 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) - { - bool l_secErr = i_step.service_data->isSecondaryErrFound(); - (*i_step.service_data) = l_backupStep; - - if( l_secErr ) - { - i_step.service_data->setSecondaryErrFlag(); - } - - 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 Group::Add(SCAN_COMM_REGISTER_CLASS * i_reg, - const uint8_t * i_bits, - size_t i_bitSize, - Resolution & i_action, - ResetAndMaskPair & i_resets, - uint16_t i_scrID, - bool i_reqTranspose) -{ - FilterClass * 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 ResolutionMap(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. - BitKey l_tmpKey(i_bits, i_bitSize); - l_transposeFilter = new FilterTranspose(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 Group::Add(SCAN_COMM_REGISTER_CLASS * i_reg, - Resolution & i_action, - ResetAndMaskPair & i_resets, - uint16_t i_scrID) -{ - ResolutionMap * l_res = cv_resMaps[i_reg]; - - if (NULL == l_res) - { - l_res = cv_resMaps[i_reg] = new ResolutionMap(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 Group::AddFilter(FilterClass * i_filter, bool i_addFirst ) -{ - // 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. - FilterClass * l_bitFilter = - ((ResolutionMap *)(*i).second)->getFilter(); - - // Need new filter link? - if (NULL != l_bitFilter) - { - if( i_addFirst ) - { - l_bitFilter = new FilterLink( *i_filter, *l_bitFilter ); - } - else - { - l_bitFilter = new FilterLink( *l_bitFilter, *i_filter ); - } - - // Add to filter list, for deallocation later. - cv_filters.push_back(l_bitFilter); - } - else - { - l_bitFilter = i_filter; - } - - // Assign filter to resolution map. - ((ResolutionMap *)(*i).second)->setFilter(l_bitFilter); - } -} - - - -const BIT_STRING_CLASS & Group::Read(ATTENTION_TYPE i_attn) -{ - static BIT_STRING_BUFFER_CLASS a(64); - return a; -}; - -BIT_LIST_CLASS Group::Filter(const BIT_STRING_CLASS & i) -{ - return BIT_LIST_CLASS(); -}; - -int32_t Group::Lookup(STEP_CODE_DATA_STRUCT & i_step, BIT_LIST_CLASS & b) -{ - return -1; -}; - -int32_t Group::Reset(const BIT_LIST_CLASS & b, STEP_CODE_DATA_STRUCT & i_step) -{ - return -1; -}; - -} // end namespace PRDF - diff --git a/src/usr/diag/prdf/common/framework/rule/prdfGroup.H b/src/usr/diag/prdf/common/framework/rule/prdfGroup.H deleted file mode 100755 index de859c960..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdfGroup.H +++ /dev/null @@ -1,119 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdfGroup.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* 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 */ - -#ifndef __PRDFGROUP_H -#define __PRDFGROUP_H - -#include -#include -#include -#include // for pair - -#include -#include - -namespace PRDF -{ - -// forward decls -class Resolution; -class ResolutionMap; -class SCAN_COMM_REGISTER_CLASS; -class ErrorRegister; -// end forward decls - -typedef std::pair - ResetAndMaskPair; - -/*class ResetAndMaskPair - : public std::pair - {};*/ - -class Group : public ErrorRegisterType -{ - public: - Group(Resolution & i_default) - : cv_nextBitForTranspose(64), cv_defaultRes(i_default) {}; - - ~Group(); - - int32_t Analyze(STEP_CODE_DATA_STRUCT &); - - void Add(SCAN_COMM_REGISTER_CLASS *, - const uint8_t *, - size_t, - Resolution &, - ResetAndMaskPair &, - uint16_t, // SCRID. - bool - ); // add standard action. - - void Add(SCAN_COMM_REGISTER_CLASS * i_reg, - Resolution & i_action, - ResetAndMaskPair &, - uint16_t i_scrID); // add default action. - /** - * @brief adds filter to the group. - * @param i_filter filter to be added to the group. - * @param i_addFirst true, if filter should act ahead of filter(s) - * added previously to the group, false otherwise. - * @note In most cases, we use original filter first. It ensures - * transpose filters acts first on FIR data. However, if - * secondary filter is defined for the group, it assumes - * highest priority and should be added before any other - * filter. It's because it should be the first filter acting on - * FIR data. - */ - void AddFilter( FilterClass * i_filter, bool i_addFirst = false ); - - /** - * No Filters applied by this Error Register - so undo is no-op - */ - virtual bool FilterUndo(BitKey & 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 RegisterList_t; - typedef std::vector FilterList_t; - - typedef std::map ResMaps_t; - ResMaps_t cv_resMaps; - RegisterList_t cv_errRegs; - FilterList_t cv_filters; - uint8_t cv_nextBitForTranspose; - Resolution & cv_defaultRes; - -}; - -} // end of namespace PRDF - -#endif - diff --git a/src/usr/diag/prdf/common/framework/rule/prdfPluginDef.H b/src/usr/diag/prdf/common/framework/rule/prdfPluginDef.H deleted file mode 100755 index a3c1f7164..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdfPluginDef.H +++ /dev/null @@ -1,368 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdfPluginDef.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* 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 */ - -#ifndef __PRDFPLUGINDEF_H -#define __PRDFPLUGINDEF_H - -#include - -#ifdef __HOSTBOOT_MODULE - #include -#else - #include -#endif - -namespace PRDF -{ - -namespace PluginDef -{ - class ParameterList - { - }; - - template - class SingleParameter : public ParameterList - { - private: - _A cv_value; - - public: - SingleParameter(_A v) : cv_value(v) {}; - operator _A() { return cv_value; }; - }; - - template - inline SingleParameter<_A> * - bindParm(_A v) { return new SingleParameter<_A>(v); }; - - template - 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 - inline TwoParameter<_A, _B> * - bindParm(_A vA, _B vB) { return new TwoParameter<_A,_B>(vA,vB); }; - - template - 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 - inline ThreeParameter<_A, _B, _C> * - bindParm(_A vA, _B vB, _C vC) - { return new ThreeParameter<_A,_B,_C>(vA,vB,vC); }; - - template - 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 - 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 ExtensibleFunctionType -{ - public: - virtual ~ExtensibleFunctionType() {}; -}; - -template -class ExtensibleFunction : public ExtensibleFunctionType -{ - public: - virtual ~ExtensibleFunction() { } // zs01 - virtual int32_t operator()(_ExtensibleObject * A, - PluginDef::ParameterList * B) = 0; -}; - -class ExtensibleChip; -class ExtensibleDomain; -typedef ExtensibleFunction ExtensibleChipFunction; -typedef ExtensibleFunction - ExtensibleDomainFunction; - -template -class Plugin : public ExtensibleFunction<_ExtensibleObject> -{ - protected: - int32_t (*_func)(_ExtensibleObject *, PluginDef::ParameterList *); - public: - explicit Plugin(int32_t (*func)(_ExtensibleObject *, - PluginDef::ParameterList *)) - : _func(func) {}; - - int32_t operator()(_ExtensibleObject * A, - PluginDef::ParameterList * B) - { - int32_t i = 0; - if (NULL != _func) - { - i = _func(A,B); - } - delete B; - return i; - }; -}; - -template -class Plugin_0arg : public ExtensibleFunction<_ExtensibleObject> -{ - protected: - int32_t (*_func)(_ExtensibleObject *); - public: - explicit Plugin_0arg(int32_t (*func)(_ExtensibleObject *)) - : _func(func) {}; - - int32_t operator()(_ExtensibleObject * A, - PluginDef::ParameterList * B) - { - int32_t i = _func(A); - delete B; - return i; - }; -}; - -template -inline Plugin_0arg<_ExtensibleObject> - bind_plugin(int32_t (*func)(_ExtensibleObject *)) - { return Plugin_0arg<_ExtensibleObject>(func); }; - -template -inline Plugin_0arg<_ExtensibleObject> * - bind_plugin_ptr(int32_t (*func)(_ExtensibleObject *), void * ptr) - { return new (ptr) Plugin_0arg<_ExtensibleObject>(func); }; - -template -class Plugin_1arg : public ExtensibleFunction<_ExtensibleObject> -{ - protected: - int32_t (*_func)(_ExtensibleObject *, _A); - public: - explicit Plugin_1arg(int32_t (*func)(_ExtensibleObject *, _A)) - : _func(func) {}; - - int32_t operator()(_ExtensibleObject * A, - PluginDef::ParameterList * B) - { - int32_t i = _func(A, - (_A)static_cast &>(*B)); - delete B; - return i; - }; -}; - -template -inline Plugin_1arg<_A, _ExtensibleObject> - bind_plugin(int32_t (*func)(_ExtensibleObject *, _A)) - { return Plugin_1arg<_A, _ExtensibleObject>(func); }; - -template -inline Plugin_1arg<_A, _ExtensibleObject> * - bind_plugin_ptr(int32_t (*func)(_ExtensibleObject *, _A), void * ptr) - { return new (ptr) Plugin_1arg<_A, _ExtensibleObject>(func); }; - - -template -class Plugin_2arg : public ExtensibleFunction<_ExtensibleObject> -{ - protected: - int32_t (*_func)(_ExtensibleObject *, _A, _B); - public: - explicit Plugin_2arg(int32_t (*func)(_ExtensibleObject *, _A, _B)) - : _func(func) {}; - - int32_t operator()(_ExtensibleObject * A, - PluginDef::ParameterList * B) - { - int32_t i = _func(A, - static_cast *>(B)->getA(), - static_cast *>(B)->getB()); - delete B; - return i; - }; -}; - -template -inline Plugin_2arg<_A, _B, _ExtensibleObject> - bind_plugin(int32_t (*func)(_ExtensibleObject *, _A, _B)) - { return Plugin_2arg<_A, _B, _ExtensibleObject>(func); }; - -template -inline Plugin_2arg<_A, _B, _ExtensibleObject> * - bind_plugin_ptr(int32_t (*func)(_ExtensibleObject *, _A, _B), void * ptr) - { return new (ptr) Plugin_2arg<_A, _B, _ExtensibleObject>(func); }; - - -template -class Plugin_3arg : public ExtensibleFunction<_ExtensibleObject> -{ - protected: - int32_t (*_func)(_ExtensibleObject *, _A, _B, _C); - public: - explicit Plugin_3arg(int32_t (*func) - (_ExtensibleObject *, _A, _B, _C)) - : _func(func) {}; - - int32_t operator()(_ExtensibleObject * A, - PluginDef::ParameterList * B) - { - int32_t i = _func(A, - static_cast *> - (B)->getA(), - static_cast *> - (B)->getB(), - static_cast *> - (B)->getC() - ); - delete B; - return i; - }; -}; - -template -inline Plugin_3arg<_A, _B, _C, _ExtensibleObject> - bind_plugin(int32_t (*func)(_ExtensibleObject *, _A, _B, _C)) - { return Plugin_3arg<_A, _B, _C, _ExtensibleObject>(func); }; - -template -inline Plugin_3arg<_A, _B, _C, _ExtensibleObject> * - bind_plugin_ptr(int32_t (*func)(_ExtensibleObject *, _A, _B, _C), - void * ptr) - { return new (ptr) - Plugin_3arg<_A, _B, _C, _ExtensibleObject>(func); }; - -template -class Plugin_4arg : public ExtensibleFunction<_ExtensibleObject> -{ - protected: - int32_t (*_func)(_ExtensibleObject *, _A, _B, _C, _D); - public: - explicit Plugin_4arg(int32_t (*func) - (_ExtensibleObject *, _A, _B, _C, _D)) - : _func(func) {}; - - int32_t operator()(_ExtensibleObject * A, - PluginDef::ParameterList * B) - { - int32_t i = _func(A, - static_cast *> - (B)->getA(), - static_cast *> - (B)->getB(), - static_cast *> - (B)->getC(), - static_cast *> - (B)->getD() - ); - delete B; - return i; - }; -}; - -template -inline Plugin_4arg<_A, _B, _C, _D, _ExtensibleObject> - bind_plugin(int32_t (*func)(_ExtensibleObject *, _A, _B, _C, _D)) - { return Plugin_4arg<_A, _B, _C, _D, _ExtensibleObject>(func); }; - -template -inline Plugin_4arg<_A, _B, _C, _D, _ExtensibleObject> * - bind_plugin_ptr(int32_t (*func)(_ExtensibleObject *, _A, _B, _C, _D), - void * ptr) - { return new (ptr) - Plugin_4arg<_A, _B, _C, _D, _ExtensibleObject>(func); }; - -} // end namespace PRDF - -#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) \ - PRDF_PLUGIN_DEFINE_NS(CHIP,CHIP,PLUGIN_NAME) - -#define PRDF_PLUGIN_DEFINE_NS(CHIP,NAMESPACE,PLUGIN_NAME) \ - class __PRDF_PLUGIN_MAKENAME(Plugin_Registration_,CHIP,PLUGIN_NAME) \ - { \ - private: \ - ExtensibleFunctionType * cv_plugin; \ - PluginRegisterClass cv_registerClass; \ - char cv_plugin_space[sizeof(Plugin)]; \ - public: \ - __PRDF_PLUGIN_MAKENAME(Plugin_Registration_,CHIP,PLUGIN_NAME)() : \ - cv_plugin( bind_plugin_ptr(&NAMESPACE::PLUGIN_NAME, \ - &cv_plugin_space) ), \ - cv_registerClass(#CHIP,#PLUGIN_NAME,cv_plugin) \ - {} \ - }; \ - __PRDF_PLUGIN_MAKENAME(Plugin_Registration_,CHIP,PLUGIN_NAME) \ - __PRDF_PLUGIN_MAKENAME(g_PluginRegistration_,CHIP,PLUGIN_NAME) -#endif - -#include - diff --git a/src/usr/diag/prdf/common/framework/rule/prdfPluginMap.C b/src/usr/diag/prdf/common/framework/rule/prdfPluginMap.C deleted file mode 100755 index aeeed3ca3..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdfPluginMap.C +++ /dev/null @@ -1,58 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdfPluginMap.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2005,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 */ - -#include - -namespace PRDF -{ - -PluginGlobalMap & getPluginGlobalMap() -{ - static PluginGlobalMap g_globalPluginMap; - return g_globalPluginMap; -}; - -void PluginGlobalMap::registerPlugin(const char * i_chipName, - const char * i_pluginName, - ExtensibleFunctionType * i_plugin) -{ - this->cv_globalMap[i_chipName][i_pluginName] = i_plugin; -}; - -PluginMap & PluginGlobalMap::getPlugins(const char * i_chipName) -{ - return this->cv_globalMap[i_chipName]; -}; - -PluginRegisterClass::PluginRegisterClass( - const char * i_chipName, - const char * i_pluginName, - ExtensibleFunctionType * i_plugin) -{ - getPluginGlobalMap().registerPlugin(i_chipName, - i_pluginName, - i_plugin); -}; - -} // end namespace PRDF - diff --git a/src/usr/diag/prdf/common/framework/rule/prdfPluginMap.H b/src/usr/diag/prdf/common/framework/rule/prdfPluginMap.H deleted file mode 100755 index 0f88048f9..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdfPluginMap.H +++ /dev/null @@ -1,80 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdfPluginMap.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2005,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 */ - -#ifndef __PRDFPLUGINMAP_H -#define __PRDFPLUGINMAP_H - -#include -#include -#include -#include - -namespace PRDF -{ - -class ExtensibleChip; - -/** - * @brief custom comparison functor to pass to a map container - * that uses char* as the key - */ -struct StrCompare : public std::binary_function -{ - public: - bool operator() (const char* str1, const char* str2) const - { - return strcmp(str1, str2) < 0; - } -}; - -typedef std::map PluginMap; - -class PluginGlobalMap; -PluginGlobalMap & getPluginGlobalMap(); - -class PluginGlobalMap -{ - private: - std::map cv_globalMap; - - public: - PluginGlobalMap() : cv_globalMap() {}; - - void registerPlugin(const char * i_chipName, - const char * i_pluginName, - ExtensibleFunctionType * i_plugin); - - PluginMap & getPlugins(const char * i_chipName); -}; - -class PluginRegisterClass -{ - public: - PluginRegisterClass(const char * i_chipName, - const char * i_pluginName, - ExtensibleFunctionType * i_plugin); -}; - -} // end namespace PRDF - -#endif diff --git a/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.C b/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.C deleted file mode 100755 index 21825b065..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.C +++ /dev/null @@ -1,161 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdfRuleChip.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* 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 */ - -#include - -#ifndef __HOSTBOOT_MODULE - #include // for UtilReg - #include //for SyncAnalysis -#endif - -#include // for SystemPtr. -#include - -#include -#include -#include // for enums. -#include // for ScanFacility -#include // for ResolutionFactory -#include // for CaptureData -#include // for ServiceDataCollector -#include // for ErrorSignature -#include // for errl user data flags. -#include // for System -#include - -namespace PRDF -{ - - -RuleChip::RuleChip( const char * i_fileName , - TARGETING::TargetHandle_t i_pTargetHandle, - ScanFacility & i_scanFactory, - ResolutionFactory & i_reslFactory, - errlHndl_t & o_errl ) - : ExtensibleChip( i_pTargetHandle ),cv_dataBundle( NULL ) -{ - iv_pRuleData = NULL; - if( NULL != systemPtr ) - { - TARGETING::TYPE l_type = - PlatServices::getTargetType( i_pTargetHandle ); - iv_pRuleData = systemPtr->getChipMetaData( l_type,i_fileName, - i_scanFactory,i_reslFactory,o_errl ); - - } - - init(); - -} - -//------------------------------------------------------------------------------ - -void RuleChip::init( ) -{ - PRDF_DEFINE_CHIP_SCOPE( this ); - // Call initialize plugin. - ExtensibleChipFunction * l_init = getExtensibleFunction("Initialize", true); - if (NULL != l_init) - { - (*l_init)( this,PluginDef::bindParm(NULL) ); - } - -}; - -//------------------------------------------------------------------------------ - -RuleChip::~RuleChip() -{ - if (NULL != cv_dataBundle) - { - delete cv_dataBundle; - } -}; - -//------------------------------------------------------------------------------ - -int32_t RuleChip::Analyze( STEP_CODE_DATA_STRUCT & i_serviceData, - ATTENTION_TYPE i_attnType ) -{ - //this pointer is retained in stack just for the scope of this function - PRDF_DEFINE_CHIP_SCOPE( this ); - int32_t l_rc = SUCCESS; - ServiceDataCollector & i_sdc = *(i_serviceData.service_data); - ErrorSignature & l_errSig = *(i_sdc.GetErrorSignature()); - - // Set current ATTN type to input value. - // If we don't do this, then the AttnRegisters don't work. - i_sdc.setSecondaryAttnType(i_attnType); - // Set Signature Chip Id. - l_errSig.setChipId( GetId() ); - l_rc = iv_pRuleData->Analyze( i_serviceData, i_attnType ); - - return l_rc; -}; - -//------------------------------------------------------------------------------ - -ExtensibleChipFunction * - RuleChip::getExtensibleFunction( const char * i_func, bool i_expectNull ) -{ - //this pointer is retained in stack just for the scope of this function - PRDF_DEFINE_CHIP_SCOPE( this ); - ExtensibleChipFunction * l_ptr = NULL ; - l_ptr = iv_pRuleData->getExtensibleFunction( i_func , i_expectNull ); - return l_ptr ; -} - -//------------------------------------------------------------------------------ - -SCAN_COMM_REGISTER_CLASS * RuleChip::getRegister(const char * i_reg, - bool i_expectNull) -{ - //this pointer is retained in stack just for the scope of this function - PRDF_DEFINE_CHIP_SCOPE( this ); - SCAN_COMM_REGISTER_CLASS * l_ptr = iv_pRuleData->getRegister( i_reg, - i_expectNull,this ); - return l_ptr ; -} - - -//------------------------------------------------------------------------------ -int32_t RuleChip::CaptureErrorData( CaptureData & io_cap,int i_group ) -{ - //this pointer is retained in stack just for the scope of this function - PRDF_DEFINE_CHIP_SCOPE( this ); - return iv_pRuleData->CaptureErrorData( io_cap ,i_group ); -} - -//------------------------------------------------------------------------------ - -uint32_t RuleChip::getSignatureOffset() -{ - //this pointer is retained in stack just for the scope of this function - PRDF_DEFINE_CHIP_SCOPE( this ); - return iv_pRuleData->getSignatureOffset(); -} - -} // end namespace PRDF - diff --git a/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.H b/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.H deleted file mode 100755 index 5eb661925..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.H +++ /dev/null @@ -1,157 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdfRuleChip.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* 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 prdfRuleChip.H - * @brief Models a physical target say a Proc or Ex - * - * Each instance of RuleChip is associated with a particular target.As - * an example, all the procs in the system are modeled by PRD with a - * unique instance of RuleChip object.Design of class is based on - * following two facts about all the RuleChips modelling target of same - * type - * - contain an identical set of registers and resolutions - * - share a common mechansim to analyze attention - * Based on above two facts, all RuleChips modelling target of same - * type, share a common instance of RuleMetaData. RuleMetaData models - * all the regisers and resolutions associated with a RuleChip of - * particular type. - * Sharing of RuleMetaData instance reduces the memory usage - * and is key to address the scaling issue. - */ -#ifndef __PRDFRULECHIP_H -#define __PRDFRULECHIP_H - -#include -#include -#include -#include -#include -#include -#include -#include "prdrCommon.H" -#include -#include - -namespace PRDF -{ - -class RuleChip : public ExtensibleChip -{ - - public: - - /*Note: - At the beginning of all the public function of this class,'this' pointer - should be pushed to stack maintained in service data collector.Also, at - the end of same function,it should be popped.It is accomplished by just - instantiating ChipScopeLock at the beginning of the function.This is - encapsulated by PRDF_LOCK_CHIP_SCOPE */ - - /** - * @brief constructor - * @param[in] i_fileName name of Rule file - * @param[in] i_pTargetHandle Target associated with RuleChip - * @param[in] i_scanFactory instance of register factory - * @param[in] i_reslFactory instance of resolution factory - * @param[o] o_errl error log handle - */ - RuleChip( const char * i_fileName , - TARGETING::TargetHandle_t i_pTargetHandle, - ScanFacility & i_scanFactory, - ResolutionFactory & i_reslFactory, - errlHndl_t & o_errl ); - /** - * @brief Destructor - */ - - ~RuleChip(); - /** - * @brief Analyzes attention in a RuleChip - * @param[io] io_serviceData Reference to STEP_CODE_DATA_STRUCT - * @param[in] i_attn attention reported by RuleChip - * @return returns SUCCESS or FAIL - */ - - int32_t Analyze( STEP_CODE_DATA_STRUCT & io_serviceData, - ATTENTION_TYPE i_attn ); - - /** - * @brief Masks error - * @return returns SUCCESS or FAIL - */ - int32_t MaskError(uint32_t i) { return SUCCESS; }; - /** - * @brief Returns plugin function pointer - * @param[in] i_func name of plugin function - * @param[in] i_expectNull availability status of plugin function - * @return returns pointer to plugin function - */ - - ExtensibleChipFunction *getExtensibleFunction( - const char * i_func, bool i_expectNull = false ); - /** - * @brief Returns register instance - * @param[in] i_func name of plugin function - * @param[in] i_expectNull availability status of plugin function - * @return returns pointer to plugin function - */ - SCAN_COMM_REGISTER_CLASS * getRegister( - const char * i_func, bool i_expectNull = false ); - - /** - * @brief Returns data bundle instance - * @return returns DataBundle& - */ - DataBundle *& getDataBundle() { return cv_dataBundle; }; - - /** - * @brief Returns signature offset associated with registes of a - * RuleChip. - * @return Error signature offset - */ - uint32_t getSignatureOffset(); - - /** - * @brief Captures register data - * @param[io] io_cap reference to instance of CaptureData - * @param[in] i_group group id for register capture group - * @return returns capture status ( SUCCESS|FAIL) - */ - virtual int32_t CaptureErrorData( - CaptureData& io_cap , int i_group = 1 ) ; - /** - * @brief Initializes the RuleChip instance - */ - void init( ); - - private: //data - RuleMetaData * iv_pRuleData ; - DataBundle * cv_dataBundle; -}; - -} // end namespace PRDF - -#endif diff --git a/src/usr/diag/prdf/common/framework/rule/prdfRuleFiles.C b/src/usr/diag/prdf/common/framework/rule/prdfRuleFiles.C deleted file mode 100755 index dfe079d0b..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdfRuleFiles.C +++ /dev/null @@ -1,48 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdfRuleFiles.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* 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 */ - -#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 * MuranoVeniceProc = "MuranoVeniceProc"; - const char * NaplesProc = "NaplesProc"; - const char * Ex = "Ex"; - const char * Mcs = "Mcs"; - - // Pegasus Centaur Chip - const char * Membuf = "Membuf"; - const char * Mba = "Mba"; - -} // end namespace PRDF - -#endif diff --git a/src/usr/diag/prdf/common/framework/rule/prdfRuleFiles.H b/src/usr/diag/prdf/common/framework/rule/prdfRuleFiles.H deleted file mode 100755 index a30aad875..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdfRuleFiles.H +++ /dev/null @@ -1,50 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdfRuleFiles.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* 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 */ - -#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 * MuranoVeniceProc; - extern const char * NaplesProc; - extern const char * Ex; - extern const char * Mcs; - - // Pegasus Centaur Chip - extern const char * Membuf; - extern const char * Mba; - -} // end namespace PRDF - -#endif - diff --git a/src/usr/diag/prdf/common/framework/rule/prdfRuleMetaData.C b/src/usr/diag/prdf/common/framework/rule/prdfRuleMetaData.C deleted file mode 100644 index 5b69db665..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdfRuleMetaData.C +++ /dev/null @@ -1,1182 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdfRuleMetaData.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2013,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* 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 */ - -#include - -#ifndef __HOSTBOOT_MODULE - #include // for UtilReg - #include //for SyncAnalysis -#endif -#include -#include // for EregResolution -#include // for ServiceDataCollector -#include -#include -#include -#include -#include // for ScanFacility -#include // for ResolutionFactory -#include // for ErrorSignature -#include // for UtilFile -#include // for Util::hashString -#include -#include - -namespace PRDF -{ - -template -struct ResetAndMaskTransformer - : public std::unary_function -{ - ResetAndMaskTransformer( ScanFacility & i_scanFactory,size_t i_scomlen , - TARGETING::TYPE i_type ) - :cv_scanFactory( i_scanFactory ), - cv_scomlen( i_scomlen ), - iv_chipType( i_type ) - { }; - - virtual ~ResetAndMaskTransformer() {}; - - virtual ResetAndMaskErrorRegister::ResetRegisterStruct - operator()( const Prdr::Register::ResetOrMaskStruct & i ) - { - /* - These reset and mask registers, which are associated with a FIR, are - created along with the FIR. They are needed to clear/mask FIR bits at - the end of analysis. Let us call it scenario X. - - There are situations where we need a separate instance of an AND - register. These are used in plugins to do some special analysis which - is not possible through framework code. Let us call it scenario Y. - - Since, factory actually doesn't use operations (e.g. READ or WRITE) - supported to determine whether a register instance is new or already - available it shall return us the AND register instance created in - scenario X. - - AND registers are write only. If we don't specify WRITE here, even in - scenario Y, we shall get object created during scenario X, which may - not be write-only. - */ - ResetAndMaskErrorRegister::ResetRegisterStruct o; - SCAN_COMM_REGISTER_CLASS::AccessLevel l_readRegAccess = - SCAN_COMM_REGISTER_CLASS::ACCESS_WO; - - - switch ( i.op ) - { - case Prdr::OR: - o.op = getStaticResetOperator >(); - break; - - case Prdr::AND: - o.op = getStaticResetOperator >(); - break; - - case Prdr::XOR: - o.op = getStaticResetOperator >(); - l_readRegAccess = SCAN_COMM_REGISTER_CLASS::ACCESS_RW; - break; - - case Prdr::NOT: - o.op = getStaticResetOperator >(); - break; - - default: - o.op = NULL; - break; - } - - o.read = & cv_scanFactory.GetScanCommRegister( i.addr_r, cv_scomlen, - iv_chipType, - l_readRegAccess ); - - o.write = & cv_scanFactory.GetScanCommRegister( i.addr_w, cv_scomlen, - iv_chipType, - SCAN_COMM_REGISTER_CLASS::ACCESS_WO ); - - return o; - }; - - private: - ScanFacility & cv_scanFactory; - size_t cv_scomlen; - TARGETING::TYPE iv_chipType; -}; - - -//------------------------------------------------------------------------------ - - RuleMetaData::RuleMetaData( const char * i_fileName, - ScanFacility & i_scanFactory, - ResolutionFactory & i_reslFactory, - TARGETING::TYPE i_type, - errlHndl_t & o_errl ) - : cv_fileName( i_fileName ),cv_dumpType( 0 ),iv_sigOff(0) -{ - o_errl = this->loadRuleFile( i_scanFactory, i_reslFactory,i_type ) ; -} - - -//------------------------------------------------------------------------------ -RuleMetaData::~RuleMetaData() -{ - uint32_t l_size = iv_groupList.size(); - for( uint32_t i = 0; i < l_size; i++ ) - { - delete iv_groupList[i]; - } - iv_groupList.clear(); - cv_hwCaptureGroups.clear(); - cv_hwCaptureReq.clear(); - cv_hwCaptureType.clear(); -} -//------------------------------------------------------------------------------ - - -errlHndl_t RuleMetaData::loadRuleFile( ScanFacility & i_scanFactory , - ResolutionFactory &i_reslFactory , - TARGETING::TYPE i_type ) -{ - RegMap_t l_regMap; - Reset_t l_resetMap; - ResetAndMaskPair l_currentResets; - uint32_t l_vregMax = 0; - ActionMap_t l_actionMap; - GroupMap_t l_groupMap; - uint32_t l_id = 1; - errlHndl_t l_errl = NULL ; - SharedThreshold_t l_sharedThresholds; - - Prdr::Chip * l_chip; - - /* Initialize local data struct to pass to sub-functions */ - RuleFileData l_localData = { l_regMap, l_groupMap, l_actionMap, - i_scanFactory, i_reslFactory, - l_chip, - l_resetMap, l_currentResets, - l_sharedThresholds - }; - // Parse chip file. - l_errl = Prdr::LoadChipCache::loadChip(cv_fileName, &l_chip); - if( NULL == l_errl ) - { - - // 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; - SCAN_COMM_REGISTER_CLASS::AccessLevel l_regAccess; - - uint32_t l_accessLvls = - Prdr::PRDR_REGISTER_READ | - Prdr::PRDR_REGISTER_WRITE | - Prdr::PRDR_REGISTER_ACCESS_NIL; - - uint32_t l_accessType = - l_chip->cv_registers[i].cv_flags & l_accessLvls; - - switch( l_accessType ) - { - case Prdr::PRDR_REGISTER_ACCESS_NIL: - l_regAccess = SCAN_COMM_REGISTER_CLASS::ACCESS_NONE; - break; - case Prdr::PRDR_REGISTER_WRITE: - l_regAccess = SCAN_COMM_REGISTER_CLASS::ACCESS_WO; - break; - case Prdr::PRDR_REGISTER_READ: - l_regAccess = SCAN_COMM_REGISTER_CLASS::ACCESS_RO; - break; - default: - l_regAccess = SCAN_COMM_REGISTER_CLASS::ACCESS_RW; - } - //If more operations are incorporated in register, it can be - //specified in same way as above. - l_regMap[l_id] = cv_hwRegs[hashId] - = &i_scanFactory.GetScanCommRegister( - l_chip->cv_registers[i].cv_scomAddr, - l_chip->cv_registers[i].cv_scomLen, - i_type, l_regAccess ); - 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( - i_scanFactory, - l_chip->cv_registers[i].cv_scomLen, - i_type ) - ); - - // 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( - i_scanFactory, - l_chip->cv_registers[i].cv_scomLen, - i_type ) ); - l_id++; - - } - - // create capture struct for registers. - for (int i = 0; i < l_chip->cv_regCount; i++) - { - uint16_t hashId = l_chip->cv_registers[i].cv_name; - - //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 - //in the rule file. - bool l_group_is_created = false; - // Copy into capture groups. - std::vector::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::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( - cv_hwRegs[hashId]); - //Added statement below this to indicate group was created. - l_group_is_created = true; - } - // 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) - { - cv_hwCaptureType[cv_hwRegs[hashId]] = - CaptureType((RegType)(*j).data[0]); - } - else if ('f' == (*j).op) - { - CaptureRequirement req; - req.cv_func = this->getExtensibleFunction(j->func); - - cv_hwCaptureReq[cv_hwRegs[hashId]] = req; - } - else if ('P' == (*j).op) - { - cv_hwCaptureNonzero[ cv_hwRegs[hashId] ] = - cv_hwRegs[(*j).data[0]]; - } - else // 'C' - { - CaptureRequirement req; - req.cv_TargetType = (*j).data[0]; - req.cv_TargetIndex = (*j).data[1]; - req.cv_func = NULL; - - cv_hwCaptureReq[cv_hwRegs[hashId]] = req; - } - } - if (!l_group_is_created) // Add to default group if none there. - { - // Add to default if no group specified. - cv_hwCaptureGroups[1].push_back(cv_hwRegs[hashId]); - } - } - - 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 = ResetAndMaskPair(); - - 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.getCalloutGardResol( NULL, - MRU_LOW, NO_GARD ); - for (int i = 0; i < l_chip->cv_groupCount; i++) - { - iv_groupList.push_back( new Group( l_defaultResolution ) ); - l_groupMap[l_id] = iv_groupList.back(); - l_id++; - }; - - for (int i = 0; i < l_chip->cv_actionCount; i++) - { - if (l_actionMap[i]) - { - l_id++; - continue; - } - - // createActionClass will add to the actionMap. - this->createActionClass(i, l_localData); - //l_actionMap[l_id] = l_tmp; - l_id++; - } - - for (int i = 0; i < l_chip->cv_groupCount; i++) - { - this->createGroup( (Group *) l_groupMap[i+l_vregMax+1], - i,l_localData ); - } - for ( int i = 0; i < Prdr::NUM_GROUP_ATTN; i++ ) - cv_groupAttn[i] = l_groupMap[l_chip->cv_groupAttn[i]]; - - } - else - { - PRDF_ERR(" LoadChipCache::loadChip( ) failed "); - } - - return l_errl; - -} - -//------------------------------------------------------------------------------ - -int32_t RuleMetaData::Analyze( STEP_CODE_DATA_STRUCT & i_serviceData, - ATTENTION_TYPE i_attnType ) -{ - int32_t l_rc = SUCCESS; - ExtensibleChip * l_chipAnalyzed = ServiceDataCollector::getChipAnalyzed( ); - ServiceDataCollector & i_sdc = *(i_serviceData.service_data); - // Set default dump flags. - i_sdc.SetDump( (hwTableContent)cv_dumpType, - l_chipAnalyzed->GetChipHandle() ); - // Add statement below for Drop call. - CaptureData & capture = i_serviceData.service_data->GetCaptureData(); - // Get capture data for this chip. Allow override. - ExtensibleChipFunction * l_ignoreCapture = - getExtensibleFunction("PreventDefaultCapture", true); - bool l_shouldPreventDefaultCapture = false; - - (*l_ignoreCapture) - ( l_chipAnalyzed, PluginDef::bindParm - (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; - - // @jl02 JL Added this code to support the new Unit Check Stop. - case UNIT_CS: - // @jl02 JL I don't know if this is the correct cv_groupAttn to add - // here or if it's needed. - l_errReg = cv_groupAttn[3]; - break; - - } - if (NULL != l_errReg) - { //mp02 a Start - //Call any pre analysis functions - ExtensibleChipFunction * l_preAnalysis = - getExtensibleFunction("PreAnalysis", true); - bool analyzed = false; - (*l_preAnalysis)( l_chipAnalyzed , - PluginDef::bindParm - (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->getPrimaryAttnType()) //@pw04 - { - #ifndef __HOSTBOOT_MODULE - SyncAnalysis (i_sdc); //mp01 Add call to Sync SDC - #endif - // Call mask plugin. - if (i_serviceData.service_data->IsAtThreshold()) - { - ExtensibleChipFunction * l_mask = - getExtensibleFunction("MaskError", true); - (*l_mask)( l_chipAnalyzed , - PluginDef::bindParm(i_serviceData) - ); //@pw01 - } - - // Call reset plugin. - ExtensibleChipFunction * l_reset = - getExtensibleFunction("ResetError", true); - (*l_reset)( l_chipAnalyzed, - PluginDef::bindParm(i_serviceData) - ); //@pw01 - } - - // Call postanalysis plugin. - // @jl02 JL Adding PostAnalysis plugin call. - ExtensibleChipFunction * 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)( l_chipAnalyzed, - PluginDef::bindParm(i_serviceData)); - - - return l_rc; -}; - - -//------------------------------------------------------------------------------ - -int32_t RuleMetaData::CaptureErrorData( CaptureData & io_cap, - int i_group ) -{ - using namespace TARGETING; - ExtensibleChip * l_pChipAnalyzed = ServiceDataCollector::getChipAnalyzed( ); - TargetHandle_t l_pTargetAnalyzed = l_pChipAnalyzed->GetChipHandle( ); - - std::vector::const_iterator l_hwCaptureEnd = - cv_hwCaptureGroups[i_group].end(); - - for ( std::vector::const_iterator i = - cv_hwCaptureGroups[i_group].begin(); - i != l_hwCaptureEnd; - ++i ) - { - // Check that requirements are satisfied. - if ( CaptureRequirement() != cv_hwCaptureReq[*i]) - { - CaptureRequirement req = cv_hwCaptureReq[*i]; - if (NULL != req.cv_func) - { - bool l_cap = true; - (*req.cv_func) - ( l_pChipAnalyzed , PluginDef::bindParm(l_cap)); - - if (!l_cap) - continue; - } - else - { - bool l_indexValid =false; - TargetHandleList l_ptargetHandleList = - PlatServices::getConnected( - l_pTargetAnalyzed, - (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; - } - } - } - - HwCaptureNonzero_t::const_iterator l_primRegIter = - cv_hwCaptureNonzero.find(*i); - if(l_primRegIter != cv_hwCaptureNonzero.end()) - { - SCAN_COMM_REGISTER_CLASS * l_primReg = - (l_primRegIter)->second; - - if( l_primReg ) - { - const BIT_STRING_CLASS *l_bitStringPtr = - l_primReg->GetBitString(); - if(l_bitStringPtr->IsZero()) - { - //skip capture data if corresponding primary FIR is - //zero. - continue; - } - } - } - - io_cap.Add( l_pTargetAnalyzed, - (*i)->GetId() ^ this->getSignatureOffset(), - *(*i), - CaptureData::BACK, - cv_hwCaptureType[*i].cv_regType ); - } - - // Call "PostCapture" plugin - ExtensibleChipFunction * l_postCapture = - getExtensibleFunction("PostCapture", true); - - (*l_postCapture) - ( l_pChipAnalyzed, - PluginDef::bindParm(io_cap, i_group) - ); - - return SUCCESS; -} - - -//------------------------------------------------------------------------------ - -SCAN_COMM_REGISTER_CLASS * RuleMetaData::createVirtualRegister( - Prdr::Expr * 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); - } - - // passing NULL objects in *l_arg[x] - l_rc = &i_data.cv_scanFactory.GetAttnTypeRegister(l_arg[0], - l_arg[1], - l_arg[2], - l_arg[3]); - 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 * RuleMetaData::createActionClass( uint32_t i_action, - RuleMetaData::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 & io_data ) - { return SUCCESS; }; - }; - - static NullResolution l_nullRes; - l_retRes = &l_nullRes; - } - - i_data.cv_actionMap[i_action] = l_retRes; - return l_retRes; -}; - -//------------------------------------------------------------------------------ - -Resolution * RuleMetaData::createResolution( Prdr::Expr * i_action, - RuleMetaData::RuleFileData & i_data ) -{ - 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->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 otheriwse - // cv_value[3] tells which threshold needs to pick - // up from mnfg file - // cv_value[5] maskid 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) - { - l_rc = &i_data.cv_reslFactory.GetThresholdSigResolution( - *(MfgThresholdMgr::getInstance()-> - getThresholdP(i_action->cv_value[3].i) ) ); - } - 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 ( !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) - { - l_rc = &i_data.cv_reslFactory. - GetThresholdResolution(i_action->cv_value[5].i, - *(MfgThresholdMgr::getInstance()-> - getThresholdP(i_action->cv_value[3].i))); - } - 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: - l_rc = &i_data.cv_reslFactory.GetDumpResolution( - (hwTableContent) i_action->cv_value[0].i ); - break; - - case Prdr::ACT_ANALY: // ANALYZE - l_rc = &i_data.cv_reslFactory.GetAnalyzeConnectedResolution( - (TARGETING::TYPE) i_action->cv_value[0].i, - i_action->cv_value[1].i); - break; - - case Prdr::ACT_CALL: // CALLOUT - - switch (i_action->cv_value[0].i) - { - case Prdr::CALLOUT_GARD_CHIP: // connected callout with gard - l_rc = &i_data.cv_reslFactory.getConnCalloutGardResol( - (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 ) ) ), - TARGETING::TYPE_NA, - (GARD_POLICY) i_action->cv_value[6].i ); - break; - - // connected callout and gard with connection type - case Prdr::CALLOUT_GARD_PEER: - l_rc = &i_data.cv_reslFactory.getConnCalloutGardResol( - (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 ) ) ), - (TARGETING::TYPE) i_action->cv_value[5].i, - (GARD_POLICY) i_action->cv_value[6].i ); - - break; - - case Prdr::CALLOUT_PROC: // Procedure callout - l_rc = &i_data.cv_reslFactory.getCalloutGardResol( - (SymbolicFru) i_action->cv_value[2].i, - (CalloutPriorityEnum) i_action->cv_value[1].i, - (GARD_POLICY) i_action->cv_value[6].i ); - break; - - case Prdr::CALLOUT_GARD_SELF: // self callout with gard option - default: - l_rc = &i_data.cv_reslFactory.getCalloutGardResol( - NULL , - (CalloutPriorityEnum) i_action->cv_value[1].i, - (GARD_POLICY) i_action->cv_value[6].i ); - break; - - }; - - break; - - case Prdr::ACT_CAPT: // Capture resolution. - l_rc = &i_data.cv_reslFactory.GetCaptureResolution( - i_action->cv_value[0].i); - break; - }; - - return l_rc; -}; - -//------------------------------------------------------------------------------ - -void RuleMetaData::createGroup(Group * i_group, - uint32_t i_groupId, - RuleMetaData::RuleFileData & i_data) -{ - // Internal class to collapse the bit string. - class CreateBitString - { - public: - static void execute(std::vector & i_bits, - Prdr::Expr * 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 l_bits; // Vector to hold bit string. - - // Get expression for group's line. - Prdr::Expr * 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. --- - - // For idea of secondary bit filter to work, it must be the first filter - // applicable on register data. To manage this, first of all, we must push - // secondary filter to group. - // We are supporting the concept of cascaded filter where one filter works - // after other in harmony. When secondary filter acts, it shall make - // all the secondary bits( which are ON ) as "DON'T CARE" during primary - // pass. So, the intent is to filter out secondary bits or in other words - // analyze only primary bits in primary pass. - - if ( i_data.cv_loadChip->cv_groupFlags[i_groupId] & - Prdr::PRDR_GROUP_FILTER_SECONDARY ) - { - // Add secondary filter to find out if any secondary bit - // is on. - std::vector l_bits; - CreateBitString::execute(l_bits, - i_data.cv_loadChip->cv_groupSecondaryBits[i_groupId]); - - FilterClass * l_filter = new SecondaryBitsFilter( l_bits ); - i_group->AddFilter( l_filter, true ); - - } - - // Do Priority filter flag. - if (i_data.cv_loadChip->cv_groupFlags[i_groupId] & - Prdr::PRDR_GROUP_FILTER_PRIORITY) - { - std::vector l_bits; - CreateBitString::execute(l_bits, - i_data.cv_loadChip->cv_groupPriorityBits[i_groupId]); - - FilterClass * 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) - { - FilterClass * l_filter = new SingleBitFilter(); - i_group->AddFilter(l_filter); - } -} - -//------------------------------------------------------------------------------ - -ExtensibleChipFunction *RuleMetaData::getExtensibleFunction( - const char * i_func, - bool i_expectNull ) -{ - #define PRDF_FUNC "[RuleMetaData::getExtensibleFunction] " - ExtensibleFunctionType * plugin = - getPluginGlobalMap().getPlugins(cv_fileName)[i_func]; - - if (NULL == plugin) - { - 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_RULECHIP, - LIC_REFCODE, - PRDF_CODE_FAIL, - __LINE__, - 0, 0, 0); - - PRDF_ADD_FFDC(l_errl, - cv_fileName, - strlen(cv_fileName), - ErrlVer1, - ErrlString); - - PRDF_ADD_FFDC(l_errl, - i_func, - strlen(i_func), - ErrlVer1, - ErrlString ); - - PRDF_COMMIT_ERRL( l_errl, ERRL_ACTION_REPORT ); - - // We can only reach here in two cases - // 1. PRD patch is not properly applied ( prf files are changed - // but PRDF library is not updated ) - // 2. Obvious miss by developer. - // In both these cases, we should catch these issues at very early - // stage during system Initialize and this scenario should fail - // basic validation. - // So aborting system at this point. - PRDF_ERR( PRDF_FUNC "NULL Function for plugin:%s chip %s", - i_func, cv_fileName ); - - PRDF_ASSERT( NULL != plugin ); - } - - static Plugin l_nullPlugin(NULL); - plugin = &l_nullPlugin; - - } - return ( ExtensibleChipFunction * ) plugin; - #undef PRDF_FUNC -} - -//------------------------------------------------------------------------------ - -SCAN_COMM_REGISTER_CLASS * RuleMetaData::getRegister( const char * i_reg, - bool i_expectNull, - ExtensibleChip* i_chip ) -{ - uint16_t hashId = Util::hashString( i_reg ); - SCAN_COMM_REGISTER_CLASS * l_pRegister = cv_hwRegs[hashId]; - if ( NULL == l_pRegister ) - { - l_pRegister = getNullRegister( i_reg,i_expectNull ); - } - else - { - /* l_register obtained from cv_hwRegs is a ScomRegister which does not - have rule chip info built in.Analyze leg of code uses this register. - Inorder to use this register for scom, target info is obtained from - service data collector.This register does not suit us for read and - write operation in plugin function.It is because in plugin function - register read should not be concerned with finding the associated - rule chip or target.Inorder to address this situation,we create a - wrapper register.This register has rule chip info in addition to all - the data of scomRegister.This object is created through factory and - and destroyed at the end of analysis. - */ - - SCAN_COMM_REGISTER_CLASS * l_pReg = l_pRegister; - ScanFacility & l_scanFac = ScanFacility::Access(); - l_pRegister = & l_scanFac.GetPluginRegister( *l_pReg,*i_chip ); - - } - - return l_pRegister; -} - -//------------------------------------------------------------------------------ - -SCAN_COMM_REGISTER_CLASS * RuleMetaData::getNullRegister( const char * i_reg, - bool i_expectNull ) -{ - static NullRegister l_nullRegister(1024); - SCAN_COMM_REGISTER_CLASS * 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_RULECHIP, - LIC_REFCODE, - PRDF_CODE_FAIL, - __LINE__, - 1, 0, 0); - - PRDF_ADD_FFDC(l_errl, - cv_fileName, - strlen(cv_fileName), - ErrlVer1, - ErrlString); - - - PRDF_ADD_FFDC(l_errl, - i_reg, - strlen(i_reg), - ErrlVer1, - ErrlString); - - PRDF_COMMIT_ERRL(l_errl, ERRL_ACTION_REPORT); - } - return l_register; - -} - -//------------------------------------------------------------------------------ - - -}//namespace PRDF ends diff --git a/src/usr/diag/prdf/common/framework/rule/prdfRuleMetaData.H b/src/usr/diag/prdf/common/framework/rule/prdfRuleMetaData.H deleted file mode 100644 index daa02e848..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdfRuleMetaData.H +++ /dev/null @@ -1,308 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdfRuleMetaData.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2004,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 prdfRuleMetaData.H - * @brief Models the register, groups and action and analyzes the attention. - * - * Each Rule file maps to one instance of RuleMetaData. This class uses - * the services of rule file parser classes. Once Rule file is parsed, - * it models all the physical registers and resolutions. It also models - * the logical operation needed to analyze the registers. It furthur - * goes to the extent of modelling the entire mechansim of attention - * analysis using an entity called Group.All RuleChips modelling target - * of type share same instance of RuleMetaData class. It is created - * while building PRD object model. Similar to RuleChips, instance of - * this class too are contained in System class. - * - */ - - -#ifndef __PRDFRULECHIPDATA_H -#define __PRDFRULECHIPDATA_H - - -#include -#include -#include -#include -#include -#include "prdrCommon.H" -#include -#include -#include - -namespace Prdr -{ - -class Chip; -class Expr; - -} // end namespace PRDR - -namespace PRDF -{ - -class ScanFacility; -class ResolutionFactory; -class Resolution; -class Group; -class SCAN_COMM_REGISTER_CLASS; - -typedef std::pair - ResetAndMaskPair; - -// x86 compile wants this here - not forward declaired dgilbert -class CaptureRequirement -{ - public: - - CaptureRequirement() :cv_TargetType(TARGETING::TYPE_NA), - cv_TargetIndex(0), cv_func(NULL) - { }; - - uint32_t cv_TargetType; - uint32_t cv_TargetIndex; - ExtensibleChipFunction * cv_func; - /** - * @brief defines != operator for register capture requirement - */ - - inline bool operator != ( const CaptureRequirement & r ) - { - return ( ( cv_TargetType != r.cv_TargetType ) || - ( cv_TargetIndex != r.cv_TargetIndex ) || - ( cv_func != r.cv_func ) ); - }; -}; - - -//-------------------------------------- - -class CaptureType -{ - public: - RegType cv_regType; - /** - * @brief constructor - */ - CaptureType( RegType reg = PRIMARY ):cv_regType( reg ) - { }; -}; - -//-------------------------------------- - -class RuleMetaData -{ - public: - typedef std::map RegMap_t; - typedef std::map GroupMap_t; - typedef std::map ActionMap_t; - typedef std::map Reset_t; - typedef std::map SharedThreshold_t; - - struct RuleFileData - { - RegMap_t & cv_regMap; - GroupMap_t & cv_groupMap; - ActionMap_t & cv_actionMap; - - ScanFacility & cv_scanFactory; - ResolutionFactory & cv_reslFactory; - - Prdr::Chip *& cv_loadChip; - - Reset_t & cv_resets; - ResetAndMaskPair & cv_currentResets; - - SharedThreshold_t & cv_sharedThresholds; - - }; - - /** - * @brief constructor - * @param[in] i_fileName name of Rule file - * @param[in] i_scanFactory reference to factory class which - * creates register instances - * @param[in] i_targetType target type associated with Rulechip - * @param[o] o_errl reference to error log handle - */ - RuleMetaData( const char * i_fileName, - ScanFacility & i_scanFactory, - ResolutionFactory & i_reslFactory, - TARGETING::TYPE i_targetType, - errlHndl_t & o_errl ); - - - /** - * @brief destructor - */ - - virtual ~RuleMetaData(); - - /** - * @brief Analyzes the attention by reading and analyzing group of - * registers. - * @param[io] io_serviceData reference to STEP_CODE_DATA_STRUCT - * @param[in] i_attn attention reported by RuleChip - * @return SUCCESS|FAIL - */ - - int32_t Analyze( STEP_CODE_DATA_STRUCT & io_serviceData, - ATTENTION_TYPE i_attn ); - /** - * @brief Captures group of register associated with RuleChip - * @param[io] io_capture reference to CaptureData instance. - * @param[in] i_group capture group number - * @return SUCCESS - */ - - int32_t CaptureErrorData( CaptureData & io_capture , int i_group = 1 ); - /** - * @brief Masks error - * @param[in] i - * @return SUCCESS - */ - int32_t MaskError( uint32_t i ) { return SUCCESS; }; - /** - * @brief Returns signature offset associated with registes of a - * RuleChip. - * @return Error signature offset - */ - uint32_t getSignatureOffset() const { return iv_sigOff; }; - /** - * @brief returns pointer to plugin function - * @param[in] i_func name of the plugin function - * @param[in] i_expectNull plugin function availability status - * @return pointer to ExtensibleChipFunction - */ - - ExtensibleChipFunction * getExtensibleFunction( const char * i_func, - bool i_expectNull = false ); - /** - * @brief Returns pointer to physical register. - * @param[in] i_reg name of the register - * @param[in] i_expectNull register non availability expectation - * @param[in] i_chip pointer to RuleChip associated - * @return pointer to SCAN_COMM_REGISTER_CLASS - */ - SCAN_COMM_REGISTER_CLASS * getRegister( const char * i_reg, - bool i_expectNull, - ExtensibleChip* i_chip ); - /** - * @brief Returns Null register instance - * @param[in] i_reg name of the register - * @param[in] i_expectNull register non availability expectation - * @return pointer to SCAN_COMM_REGISTER_CLASS - */ - - SCAN_COMM_REGISTER_CLASS * getNullRegister( const char * i_reg, - bool i_expectNull ); - - ErrorRegisterType * cv_groupAttn[Prdr::NUM_GROUP_ATTN]; - - private: // Data - - const char * cv_fileName; //name of rule file associated with the class - uint32_t cv_dumpType; // dump type - uint32_t iv_sigOff; // signature offset for registers - std::map cv_hwRegs; - - typedef std::vector scomRegisterList_t ; - - typedef std::map< uint32_t,scomRegisterList_t > HwCaptureGroup_t; - HwCaptureGroup_t cv_hwCaptureGroups; //capture group associated - typedef std::map HwCaptureReq_t; - HwCaptureReq_t cv_hwCaptureReq; - - //Adding another std::map for passing some data to capture stuff. - typedef std::map HwCaptureType_t; - HwCaptureType_t cv_hwCaptureType; // capture type - std::vector iv_groupList; - - // A std::map to capture secondary register and its corresponding - // Primary register. - typedef std::map - HwCaptureNonzero_t; - HwCaptureNonzero_t cv_hwCaptureNonzero; - - private: //operations - - /** - * @brief Returns Null register instance - * @param[in] i_scanFacility reference to register factory - * @param[in] i_resolutionFactory refence to resolution factory - * @param[in] i_type target type associated with - * RuleChip - * @return error log handle - */ - - errlHndl_t loadRuleFile( ScanFacility & i_scanFacility, - ResolutionFactory & i_resolutionFactory , - TARGETING::TYPE i_type ); - /** - * @brief Models register operation described in rule file. - * @param[in] i_expr expression for logical operation - * @param[in] i_data Reference to RuleFileData instance. - * @return pointer to SCAN_COMM_REGISTER_CLASS - */ - - SCAN_COMM_REGISTER_CLASS * createVirtualRegister( Prdr::Expr * i_expr, - RuleFileData & i_data ); - /** - * @brief Models actions described in rule file. - * @param[in] i_action number corresponding to action in rule file. - * @param[in] i_data Reference to RuleFileData instance. - * @return pointer to Resolution - */ - Resolution * createActionClass( uint32_t i_action , - RuleFileData& i_data ); - - /** - * @brief Models action described in rule file. - * @param[in] i_expr expression for logical operation. - * @param[in] i_data Reference to RuleFileData instance. - * @return pointer to Resolution - */ - - Resolution * createResolution( Prdr::Expr * i_expr, - RuleFileData & i_data ); - - /** - * @brief Models group described in rule file. - * @param[in] i_group register capture group id - * @param[in] i_data Reference to RuleFileData instance. - */ - - void createGroup( Group * i_group , uint32_t , RuleFileData & i_data ); - -}; - - - -}//namespace PRDF ends - -#endif diff --git a/src/usr/diag/prdf/common/framework/rule/prdf_rule.mk b/src/usr/diag/prdf/common/framework/rule/prdf_rule.mk deleted file mode 100644 index 72e92ce53..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdf_rule.mk +++ /dev/null @@ -1,38 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/diag/prdf/common/framework/rule/prdf_rule.mk $ -# -# OpenPOWER HostBoot Project -# -# Contributors Listed Below - COPYRIGHT 2014,2015 -# [+] International Business Machines Corp. -# -# -# 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 - -# Add Rule tables here: -PRDR_RULE_TABLES += MuranoVeniceProc.prf -PRDR_RULE_TABLES += NaplesProc.prf -PRDR_RULE_TABLES += Ex.prf -PRDR_RULE_TABLES += Mcs.prf -PRDR_RULE_TABLES += Membuf.prf -PRDR_RULE_TABLES += Mba.prf - -prd_rule_prf_targets = ${PRDR_RULE_TABLES} -prd_rule_err_targets = ${PRDR_RULE_TABLES:.prf=.prf.err.C} -prd_rule_reg_targets = ${PRDR_RULE_TABLES:.prf=.prf.reg.C} -prd_rule_html_targets = ${PRDR_RULE_TABLES:.prf=.prf.html} - diff --git a/src/usr/diag/prdf/common/framework/rule/prdrChip.H b/src/usr/diag/prdf/common/framework/rule/prdrChip.H deleted file mode 100755 index 8cd91acba..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdrChip.H +++ /dev/null @@ -1,186 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdrChip.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2004,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 */ - -#ifndef __PRDRCHIP_H -#define __PRDRCHIP_H - -#include -#include - -#include - -#include - -namespace PRDR_COMPILER -{ - -class ExtraSignature -{ - public: - uint32_t iv_sig; - std::string * iv_sname; - std::string * iv_desc; - - ExtraSignature(uint32_t i_sig, - std::string * i_sname, - std::string * i_desc) : iv_sig(i_sig), - iv_sname(i_sname), - iv_desc(i_desc) {}; - - ExtraSignature & operator=(const ExtraSignature & 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 Chip -{ - 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 - RegisterList cv_reglist; - std::list cv_sigExtras; - - uint16_t cv_scomlen; // Default Scom Address. - - std::string cv_name_default; - - Chip() : 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(Chip * i_l, Chip * 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 (RegisterList::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; - - PRDR_FWRITE("PRDRCHIP", 8, 1, l_file); - - l_temp = htonl(cv_chipid); - PRDR_FWRITE(&l_temp, sizeof(l_temp), 1, l_file); - - l_temp = htonl(cv_targetType); - PRDR_FWRITE(&l_temp, sizeof(l_temp), 1, l_file); - - l_temp = htonl(cv_signatureOffset); - PRDR_FWRITE(&l_temp, sizeof(l_temp), 1, l_file); - - // Write dumptype to file. //@ecdf - l_temp = htonl(cv_dumptype); - PRDR_FWRITE(&l_temp, sizeof(l_temp), 1, l_file); - - l_temp16 = htons(cv_scomlen); - PRDR_FWRITE(&l_temp16, sizeof(l_temp16), 1, l_file); - - l_temp16 = htons(cv_reglist.size()); - PRDR_FWRITE(&l_temp16, sizeof(l_temp16), 1, l_file); - - for (RegisterList::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 (RegisterList::iterator i = cv_reglist.begin(); - i != cv_reglist.end(); - i++) - { - (*i)->outputRegisterFile(o_file, cv_signatureOffset); - } - - }; -}; - -} // end namespace PRDR_COMPILER - -#endif - diff --git a/src/usr/diag/prdf/common/framework/rule/prdrCommon.H b/src/usr/diag/prdf/common/framework/rule/prdrCommon.H deleted file mode 100755 index 9d1656ad0..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdrCommon.H +++ /dev/null @@ -1,176 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdrCommon.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* 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 */ - -#ifndef __PRDRCOMMON_H -#define __PRDRCOMMON_H - -/** - * @file prdrCommon.H - * @brief Common enums, typedefs, etc. between compiler and loader for rule - * table code. - */ - -#include -#include - -#ifdef __PRD_RULE_COMPILE - #include -#endif - -/** - * @namespace Prdr - * @brief Namespace to encapsulate Prdr specific enums, classes, and typedefs. - */ -namespace Prdr -{ - - enum NumberOfAttentions - { - NUM_GROUP_ATTN = 4, - }; - - /** - * @enum RegisterFlags - * @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 RegisterFlags - { - PRDR_REGISTER_SCOMLEN = 0x01, ///< Non-default scomlen - PRDR_REGISTER_RESETS = 0x02, ///< Resets defined - PRDR_REGISTER_MASKS = 0x04, ///< Masks defined - PRDR_REGISTER_CAPTURE = 0x08, ///< Capture requirements - PRDR_REGISTER_ACCESS_NIL = 0x10, ///< FFDC only register - PRDR_REGISTER_READ = 0x20, ///< Read only register - PRDR_REGISTER_WRITE = 0x40, ///< Write only register - }; - - /** - * @enum GroupFlags - * @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 GroupFlags - { - /** Single Bit Filter */ - PRDR_GROUP_FILTER_SINGLE_BIT = 0x1, - /** Priority Bit Filter */ - PRDR_GROUP_FILTER_PRIORITY = 0x2, - /** Secondary Bit Filter */ - PRDR_GROUP_FILTER_SECONDARY = 0x4, - }; - - /** - * @enum TimeBaseFlags - * @brief Enums for time base - * - * When reading rule file, these flags can be used to write in prf files - * for time base values. - */ - enum TimeBaseFlags - { - 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 ExprOps - * @brief Single char op's defined for .prf files. - * - * Needed for properly reading/writing .prf files. - */ - enum ExprOps - { - 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_CALL = 'c', - ACT_FUNC = 'f', - ACT_FLAG = 'F', - ACT_CAPT = 'C', - }; - - enum Callout_type - { - CALLOUT_PROC = 0x00000001, // for procedure callout - CALLOUT_GARD_SELF = 0x00000002, // for self callout and gard - CALLOUT_GARD_CHIP = 0x00000003, // for connected callout and gard - CALLOUT_GARD_PEER = 0x00000004, // for callout and gard of connected - // peer - }; - class SignatureOp - { - 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 HashCollisionMap; - #endif - -} // end namespace Prdr - -#endif - diff --git a/src/usr/diag/prdf/common/framework/rule/prdrCompile.C b/src/usr/diag/prdf/common/framework/rule/prdrCompile.C deleted file mode 100755 index 1aa356f19..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdrCompile.C +++ /dev/null @@ -1,525 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdrCompile.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* 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 */ - -#include -#include -#include -#include -#include - -// 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. -#include // For TARGETING::TYPE enum - -// define needed to enable x86 rule parser code only -#define __PRD_RULE_COMPILE -#include -#include -#include -#include - -using namespace PRDR_COMPILER; - -int yyline; -std::stack > yyincfiles; - -namespace PRDR_COMPILER -{ - -Chip * g_currentChip; // the current chip -std::map g_rules; // list of rules. -std::map g_groups; // list of bit groups -std::map g_actionclasses; // list of actions -std::map g_attentionStartGroup; - -// Internal list of references, to make sure every reference resolved. -std::list > g_references; - -Prdr::HashCollisionMap g_groupHashCollision; -Prdr::HashCollisionMap g_regsHashCollision; - -// Used in error reference outputting. -uint32_t g_nextAndBit; -bool g_hadError; - -} // end namespace PRDR_COMPILER - -//-------------------------------------------- -// 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); - } - - 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()); - -#ifndef __HOSTBOOT_MODULE - // Get Backing build or sandbox name. - std::string l_backingBuild(getenv("SANDBOXBASE")); - l_backingBuild = l_backingBuild.substr(l_backingBuild.find_last_of('/')+1); -#else - std::string l_backingBuild("HOSTBOOT"); -#endif - - // setup HTML headers. - l_htmlFile << "" << std::endl; - - // setup error signature file. - l_errFile << "#include " << std::endl; - l_errFile << "PRDR_ERROR_SIGNATURE_TABLE_START "; - - // setup register id file. - l_regFile << "#include " << std::endl; - l_regFile << "PRDR_REGISTER_ID_TABLE_START "; - - 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); - g_currentChip->outputRegisterFile(l_regFile); - //g_currentChip->print(); - } - else - { - yyerror("No chip define!"); - exit(1); - } - - l_htmlFile << " PRD Table: " - << g_currentChip->cv_name->substr(1, - g_currentChip->cv_name->length()-2) - << "" - << std::endl; - l_htmlFile << "" << std::endl; - - // output rules. - l_size = htons((uint16_t)g_rules.size()); - PRDR_FWRITE(&l_size, sizeof(l_size), 1, l_prfFile); - for (std::map::iterator i = g_rules.begin(); - i != g_rules.end(); - i++) - { - (*i).second->output(l_prfFile); - }; - - // set error register HOM_TYPE - l_errFile << "( 0x" << std::hex << g_currentChip->cv_targetType << ", 0x" - << std::hex << g_currentChip->cv_signatureOffset - << " )" << std::endl; - - // output bit groups - uint32_t l_pos = 0; - l_size = htons((uint16_t)g_groups.size()); - PRDR_FWRITE(&l_size, sizeof(l_size), 1, l_prfFile); - l_size = htons((uint16_t)prdrGetRefId(&g_attentionStartGroup["CHECK_STOP"])); - PRDR_FWRITE(&l_size, sizeof(l_size), 1, l_prfFile); - l_size = htons((uint16_t)prdrGetRefId(&g_attentionStartGroup["RECOVERABLE"])); - PRDR_FWRITE(&l_size, sizeof(l_size), 1, l_prfFile); - l_size = htons((uint16_t)prdrGetRefId(&g_attentionStartGroup["SPECIAL"])); - PRDR_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 - PRDR_FWRITE(&l_size, sizeof(l_size), 1, l_prfFile); // @jl02 - - l_htmlFile << "

Register Groups

" << std::endl; - l_htmlFile << "Generated from " << l_backingBuild << "
" << std::endl; - - for (std::map::iterator i = g_groups.begin(); - i != g_groups.end(); - i++, l_pos++) - { - (*i).second->output(l_prfFile); - (*i).second->generateDoxygen(l_htmlFile, (*i).first, l_errFile); - } - - // output action classes. - l_size = htons((uint16_t)g_actionclasses.size()); - PRDR_FWRITE(&l_size, sizeof(l_size), 1, l_prfFile); - - l_htmlFile << "

Actions

" << std::endl; - l_htmlFile << "Generated from " << l_backingBuild << "
" << std::endl; - l_htmlFile << "" << std::endl; - l_htmlFile << " " - << " " - << "" << std::endl; - - for (std::map::iterator i = - g_actionclasses.begin(); - i != g_actionclasses.end(); - i++) - { - (*i).second->output(l_prfFile); - (*i).second->generateDoxygen(l_htmlFile, (*i).first); - } - - l_htmlFile << "
Action Class Description Actions
" << std::endl; - - fclose(l_prfFile); - - l_htmlFile << ""; - l_htmlFile.close(); - - // Add chip's extra signatures. - l_errFile << "//---- Extra Signatures ----" << std::endl; - for (std::list::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(); - - return (g_hadError ? -1 : 0); -}; - -namespace PRDR_COMPILER -{ - -std::map g_refId; -std::map 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 (RegisterList::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::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::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::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 >::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 prdrParseDoxygen(std::string & i_string) -{ - std::list 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. - - 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 = PRDF::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; -} - -} // end namespace PRDR_COMPILER - -#include // for enums -#undef __prdfCalloutMap_H -#define PRDF_RULE_COMPILER_ENUMS -#include // for string-to-enum arrays -#undef PRDF_RULE_COMPILER_ENUMS - -namespace PRDR_COMPILER -{ - -std::map g_ActionArgMap; - -uint32_t prdrActionArgMap(const std::string & i_arg) -{ - using namespace PRDF; - using namespace std; - - 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_NX"] = TARGETING::TYPE_NX; - g_ActionArgMap["TYPE_EX"] = TARGETING::TYPE_EX; - g_ActionArgMap["TYPE_XBUS"] = TARGETING::TYPE_XBUS; - g_ActionArgMap["TYPE_ABUS"] = TARGETING::TYPE_ABUS; - g_ActionArgMap["TYPE_PCI"] = TARGETING::TYPE_PCI; - g_ActionArgMap["TYPE_MCS"] = TARGETING::TYPE_MCS; - g_ActionArgMap["TYPE_MEMBUF"] = TARGETING::TYPE_MEMBUF; - g_ActionArgMap["TYPE_L4"] = TARGETING::TYPE_L4; - g_ActionArgMap["TYPE_MBA"] = TARGETING::TYPE_MBA; - g_ActionArgMap["TYPE_OCC"] = TARGETING::TYPE_OCC; - g_ActionArgMap["TYPE_PSI"] = TARGETING::TYPE_PSI; - g_ActionArgMap["TYPE_NA"] = TARGETING::TYPE_NA; - - // Initialize symbolic callouts. - for ( SymCallout_t * i = symCalloutArray; NULL != i->str; i++ ) - { - g_ActionArgMap[i->str] = i->val; - } - - // Initialize SDC Flags. - // FIXME: RTC 119976 - // 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 - - #define PRDF_GARD_POLICY_MAP_ONLY - #define PRDF_GARD_POLICY_MAP - #define PRDF_GARD_POLICY(name, value) \ - g_ActionArgMap[#name] = value; - #define PRDF_GARD_POLICY_MAP_END - #undef iipServiceDataCollector_h - #include - - -#ifdef __HOSTBOOT_MODULE - //Note: Hostboot does not support dump.So,defining dump type here - //to retain common rule code for hostboot and FSP. - g_ActionArgMap["DUMP_CONTENT_SW"] = 0x80000000; - g_ActionArgMap["DUMP_CONTENT_HW"] = 0x40000000; - g_ActionArgMap["DUMP_CONTENT_SH"] = 0x20000000; - g_ActionArgMap["DUMP_CONTENT_CORE"] = 0x10000000; -#else - // Initialize Dump values. //@ecdf - #include - #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 - -#endif - - // Initialize MFG thresholds. - #define PRDF_MFGTHRESHOLD_TABLE_BEGIN - #define PRDF_MFGTHRESHOLD_TABLE_END - #define PRDF_MFGTHRESHOLD_ENTRY(a,b) \ - g_ActionArgMap[#a] = b; - #include - - - 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]; -} - -} // end namespace PRDR_COMPILER - diff --git a/src/usr/diag/prdf/common/framework/rule/prdrCompile.lex b/src/usr/diag/prdf/common/framework/rule/prdrCompile.lex deleted file mode 100755 index 27678df71..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdrCompile.lex +++ /dev/null @@ -1,227 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdrCompile.lex $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* 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 */ - -/* Pre C stuff: headers, etc. */ -%{ - -/** @file prdrCompile.lex - * - * This file contains all of the flex code for parsing rule-table tokens. - */ - -#include -// Portable formatting of uint64_t. The ISO C99 standard requires -// __STDC_FORMAT_MACROS to be defined in order for PRIx64 etc. to be defined. -#define __STDC_FORMAT_MACROS -#include -#include // Token structure definition. -#include // Token enums from yacc code. -%} - -/* Suppress "yyunput defined but not used" warnings */ -%option nounput - -/* --- 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, "%" PRIu64, &yylval.long_integer); - return PRDR_INTEGER; } -{hexint} { sscanf(yytext, "%" PRIx64, &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. */ -<> { 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; } -access { return PRDR_REGISTER_ACCESS; } -read_only { return PRDR_REGISTER_READ_ACCESS; } -write_only { return PRDR_REGISTER_WRITE_ACCESS; } -no_access { return PRDR_REGISTER_NO_ACCESS; } -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; } -callout { return PRDR_ACT_CALLOUT; } -flag { return PRDR_ACT_FLAG; } -capture { return PRDR_ACT_CAPTURE; } - -connected { return PRDR_CONNECTED; } -connected_peer { return PRDR_CONNECTED_PEER; } -nonzero { return PRDR_ACT_NONZERO; } -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; } -secondarybits { return PRDR_FILTER_SECONDARY; } - -"\<\<" { 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 */ -{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. - */ -\".*\" { - yyincfiles.push( - std::pair( - 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. - */ -{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++) - */ -[ \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. - */ -\n[ \t]*\*[^/][ \t]* { yyline++; return PRDR_DOX_ENDL; } - /* Find any comment line itself (non-star, non-newline) */ -[^*\n]* { - yylval.str_ptr = new std::string(yytext); - return PRDR_DOX_COMMENT; - } - /* New-line in a comment is a special token. */ -\n { yyline++; return PRDR_DOX_ENDL; } -%% - -/* User Code */ -int yywrap() { return 1;}; // We're only parsing one file, so always return 1. - // This is a lex-ism. - diff --git a/src/usr/diag/prdf/common/framework/rule/prdrCompile.y b/src/usr/diag/prdf/common/framework/rule/prdrCompile.y deleted file mode 100755 index 2087d6c4d..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdrCompile.y +++ /dev/null @@ -1,1052 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdrCompile.y $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* 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 */ - -/* 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 -#include - -#include - -#include // REVIEW NOTE: Move to token.h? - -using namespace PRDR_COMPILER; - -%} - - -/* 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. */ - PRDR_COMPILER::RegisterList * reglist; - /** A single parsed register. */ - PRDR_COMPILER::Register * reg; - /** A structure for the reset / mask keywords. */ - PRDR_COMPILER::ResetOrMaskStruct * reg_mask; - /** A chip object */ - PRDR_COMPILER::Chip * chip; - /** A sub-expression token. */ - PRDR_COMPILER::Expr * expr; - /** A parsed group of bit-operation / action pairs */ - PRDR_COMPILER::Group * grp; - /** A list of strings */ - std::list* strlist; - /** A list of filters */ - std::list* 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 PRDR_INTEGER -%token PRDR_ID -%token PRDR_STRING -%token 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_REGISTER_ACCESS -%token PRDR_REGISTER_READ_ACCESS -%token PRDR_REGISTER_WRITE_ACCESS -%token PRDR_REGISTER_NO_ACCESS -%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_CALLOUT -%token PRDR_ACT_FLAG -%token PRDR_ACT_CAPTURE - -%token PRDR_CONNECTED -%token PRDR_CONNECTED_PEER -%token PRDR_ACT_NONZERO -%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 -%token PRDR_FILTER_SECONDARY - - /* Terminal tokens for Doxygen-style comments */ -%token PRDR_DOX_COMMENT -%token PRDR_DOX_ENDL - - /* Non-terminal tokens and the data-type associated with them. */ -%type register reglines regline -%type register_mask -%type chiplines chipline -%type ruleexpr ruleexpr_small ruleexpr_shift ruleop1 ruleop2 -%type bitgroup bitandlist bitorlist -%type time_units -%type grouplines groupline -%type actionlines - -%type actionline -%type action_threshold action_shared_threshold action_analyse -%type action_analyse_conn action_try action_capture -%type action_dump action_callout action_funccall action_flag -%type action_callout_alt - -%type grpattns grpattns_item -%type grpfilters grpfilt_items grpfilt_item - -%type 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 Chip(); - - // 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. - Chip::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 Chip(); - $$->cv_chipid = $2; - } - | PRDR_SIGNATURE_OFFSET PRDR_INTEGER - { - $$ = new Chip(); - $$->cv_signatureOffset = $2; - } - | PRDR_SIGNATURE_EXTRA '(' PRDR_ID ',' PRDR_INTEGER ',' - PRDR_STRING ',' PRDR_STRING ')' - { - $$ = new Chip(); - $$->cv_sigExtras.push_back(ExtraSignature($5, $7, $9)); - } - | PRDR_TARGETTYPE PRDR_ID - { - $$ = new Chip(); - $$->cv_targetType = prdrActionArgMap(*$2); - } - | PRDR_NAME_KW PRDR_STRING - { - $$ = new Chip(); - $$->cv_name = $2; - } - | register // register non-terminal token. - { - $$ = new Chip(); - $$->cv_reglist.push_back($1); - } - | PRDR_SCOMLEN PRDR_INTEGER - { - $$ = new Chip(); - $$->cv_scomlen = $2; - } - | PRDR_ACT_DUMP PRDR_ID //@ecdf - { - $$ = new Chip(); - $$->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 Register(); - 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. - Register::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 Register(); - $$->cv_name = $2; - } - | PRDR_NAME_KW PRDR_ID - { - $$ = new Register(); - $$->cv_name = $2; - } - | PRDR_SCOMADDR PRDR_INTEGER - { - $$ = new Register(); - $$->cv_scomaddr = $2; - } - | PRDR_SCOMLEN PRDR_INTEGER - { - $$ = new Register(); - $$->cv_scomlen = $2; - - // Indicate that the register contains a non-default scomlen. - $$->cv_flags |= Prdr::PRDR_REGISTER_SCOMLEN; - } - | PRDR_RESET_ADDR '(' register_mask ')' - { - $$ = new Register(); - - // Add reset register to list. - $$->cv_resets.push_back(*$3); - delete $3; - } - | PRDR_MASK_ADDR '(' register_mask ')' - { - $$ = new Register(); - - // Add mask register to list. - $$->cv_masks.push_back(*$3); - delete $3; - } - | PRDR_ACT_CAPTURE PRDR_GROUP PRDR_ID - { - $$ = new Register(); - - // Define capture group. - CaptureReqStruct tmp; - tmp.type = CaptureReqStruct::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 Register(); - - // Define capture type. - CaptureReqStruct tmp; - tmp.type = CaptureReqStruct::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 Register(); - - // Define capture "connected" requirement. - CaptureReqStruct tmp; - tmp.type = CaptureReqStruct::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 Register(); - - // Define capture "connected" requirement. - CaptureReqStruct tmp; - tmp.type = CaptureReqStruct::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 Register(); - - // Define funccall requirement. - CaptureReqStruct tmp; - tmp.type = CaptureReqStruct::PRDR_CAPTURE_FUNC; - tmp.str = *$5; - - $$->cv_captures.push_back(tmp); - } - | PRDR_ACT_CAPTURE PRDR_REQUIRED_KW PRDR_ACT_NONZERO '(' PRDR_STRING ')' - { - $$ = new Register(); - - CaptureReqStruct tmp; - tmp.type = CaptureReqStruct::PRDR_CAPTURE_NONZERO; - tmp.str = *$5; - - $$->cv_captures.push_back(tmp); - } - | PRDR_REGISTER_ACCESS PRDR_REGISTER_READ_ACCESS - { - $$ = new Register(); - $$->cv_flags |= Prdr::PRDR_REGISTER_READ; - } - | PRDR_REGISTER_ACCESS PRDR_REGISTER_WRITE_ACCESS - { - $$ = new Register(); - $$->cv_flags |= Prdr::PRDR_REGISTER_WRITE; - } - | PRDR_REGISTER_ACCESS PRDR_REGISTER_NO_ACCESS - { - $$ = new Register(); - $$->cv_flags |= Prdr::PRDR_REGISTER_ACCESS_NIL; - } -; - - /* Define the possible reset/mask instructions. */ -register_mask: '|' ',' PRDR_INTEGER - { - $$ = new ResetOrMaskStruct(); - $$->type = '|'; - $$->addr_r = $3; - $$->addr_w = $3; - } - | '|' ',' PRDR_INTEGER ',' PRDR_INTEGER - { - $$ = new ResetOrMaskStruct(); - $$->type = '|'; - $$->addr_r = $3; - $$->addr_w = $5; - } - | '&' ',' PRDR_INTEGER - { - $$ = new ResetOrMaskStruct(); - $$->type = '&'; - $$->addr_r = $3; - $$->addr_w = $3; - } - | '&' ',' PRDR_INTEGER ',' PRDR_INTEGER - { - $$ = new ResetOrMaskStruct(); - $$->type = '&'; - $$->addr_r = $3; - $$->addr_w = $5; - } - | '^' ',' PRDR_INTEGER - { - $$ = new ResetOrMaskStruct(); - $$->type = '^'; - $$->addr_r = $3; - $$->addr_w = $3; - } - | '^' ',' PRDR_INTEGER ',' PRDR_INTEGER - { - $$ = new ResetOrMaskStruct(); - $$->type = '^'; - $$->addr_r = $3; - $$->addr_w = $5; - } - | '~' ',' PRDR_INTEGER - { - $$ = new ResetOrMaskStruct(); - $$->type = '~'; - $$->addr_r = $3; - $$->addr_w = $3; - } - | '~' ',' PRDR_INTEGER ',' PRDR_INTEGER - { - $$ = new ResetOrMaskStruct(); - $$->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::iterator i = $3->begin(); - i != $3->end(); - ++i) - { - g_attentionStartGroup[*(*i)] = *$2; - delete (*i); - } - } - - // Add filters to group. - if (NULL != $4) - { - for (std::list::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; - $$->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; - $$->push_back(new Group_Filter_SingleBit); - } -; - -grpfilt_item: PRDR_FILTER_PRIORITY '(' bitandlist ')' - { - $$ = new std::list; - $$->push_back(new Group_Filter_Priority($3)); - } -; - -grpfilt_item: PRDR_FILTER_SECONDARY '(' bitandlist ')' - { - $$ = new std::list; - $$->push_back(new Group_Filter_Secondary($3)); - } -; - - -grouplines: { $$ = new Group(); } - | grouplines groupline ';' - { - Group::merge($1,$2); - $$ = $1; - delete $2; - } | grouplines dox_comment groupline ';' - { - $3->setComment(*$2); - Group::merge($1,$3); - $$ = $1; - delete $3; - } -; - -groupline: { $$ = new Group(); } - | '(' PRDR_ID ',' bitgroup ')' '?' PRDR_ID - { - $$ = new Group(); - $$->cv_rules.push_front(new ExprRule($2,$4,$7)); - g_references.push_front(RefPair("r",*$2)); - g_references.push_front(RefPair("a",*$7)); - } - | '(' PRDR_ID ',' bitgroup ')' '?' action_analyse - { - $$ = new Group(); - $$->cv_rules.push_front(new ExprRule($2,$4,static_cast($7)->cv_name)); - g_references.push_front(RefPair("r",*$2)); - g_references.push_front(RefPair("g",*static_cast($7)->cv_name)); - } - | PRDR_ID - { - $$ = new Group(); - $$->cv_rules.push_front(new ExprRef($1)); - g_references.push_front(RefPair("g",*$1)); - } -; - -bitgroup: PRDR_BIT_KW '(' bitandlist ')' { $$ = $3; } - | PRDR_BIT_KW '(' bitorlist ')' { $$ = $3; } -; - -bitandlist: bitandlist ',' PRDR_INTEGER - { - $$ = new ExprOp2(Prdr::AND, - $1, - new ExprInt($3, Prdr::INT_SHORT)); - } - | PRDR_INTEGER - { - $$ = new ExprInt($1, Prdr::INT_SHORT); - } -; - -bitorlist: bitorlist '|' PRDR_INTEGER - { - $$ = new ExprOp2(Prdr::OR, - $1, - new ExprInt($3, Prdr::INT_SHORT)); - } - | PRDR_INTEGER '|' PRDR_INTEGER - { - $$ = new ExprOp2(Prdr::OR, - new ExprInt($1, Prdr::INT_SHORT), - new ExprInt($3, Prdr::INT_SHORT)); - } -; - -rule: PRDR_RULE PRDR_ID '{' ruleexpr ';' '}' ';' - { - g_rules[*$2] = new ExprOp1(Prdr::RULE, $4); - delete $2; - } - | PRDR_RULE PRDR_ID '{' PRDR_ID ':' ruleexpr ';' '}' ';' - { - g_rules[*$2] = new ExprOp1(Prdr::RULE, - new ExprAttnLink($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 ExprOp1(Prdr::RULE, - new ExprAttnLink($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 ExprOp1(Prdr::RULE, - new ExprAttnLink($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 ExprOp1(Prdr::RULE, - new ExprAttnLink($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($$)->cv_arg[0] = $1; - static_cast($$)->cv_arg[1] = $3; - } - | ruleexpr_shift { $$ = $1; } -; - -ruleexpr_small: '(' ruleexpr ')' { $$ = $2; } - | PRDR_ID - { - $$ = new ExprRef($1); - g_references.push_front(RefPair("re", *$1)); - } - | ruleop1 ruleexpr_small - { - $$ = $1; - static_cast($$)->cv_arg = $2; - } - | PRDR_BIT_STRING - { - $$ = new ExprBitString(*$1); - delete $1; - } -; - -ruleexpr_shift: ruleexpr_small PRDR_OP_LEFTSHIFT PRDR_INTEGER - { - $$ = new ExprOp2(Prdr::LSHIFT, - $1, - new ExprInt($3)); - - } - | ruleexpr_small PRDR_OP_RIGHTSHIFT PRDR_INTEGER - { - $$ = new ExprOp2(Prdr::RSHIFT, - $1, - new ExprInt($3, Prdr::INT_SHORT)); - } -; - -ruleop1: '~' - { - $$ = new ExprOp1(Prdr::NOT); - } -; - -ruleop2: '|' - { - $$ = new ExprOp2(Prdr::OR); - } - | '&' - { - $$ = new ExprOp2(Prdr::AND); - } - | '^' - { - $$ = new ExprOp2(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 Group(Prdr::ACTION); - } - | actionlines actionline ';' - { - if (NULL != $2) - $1->cv_rules.push_back($2); - $$ = $1; - } -; - -actionline: - { - $$ = NULL; - } - | PRDR_ID - { - $$ = new ExprRef($1); - g_references.push_front(RefPair("a", *$1)); - } - | action_threshold { $$ = $1; } - | action_shared_threshold { $$ = $1; } - | action_analyse { $$ = $1; } - | action_analyse_conn { $$ = $1; } - | action_try { $$ = $1; } - | action_dump { $$ = $1; } - | action_callout { $$ = $1; } - | action_funccall { $$ = $1; } - | action_flag { $$ = $1; } - | action_capture { $$ = $1; } -; - -action_threshold: PRDR_ACT_THRESHOLD '(' ')' - { - $$ = new ExprAct_Thresh(); - } - | PRDR_ACT_THRESHOLD '(' PRDR_FLD_KW '(' PRDR_INTEGER time_units ')' ')' - { - $$ = new ExprAct_Thresh($5, $6); - } - | PRDR_ACT_THRESHOLD '(' PRDR_FLD_KW '(' PRDR_INTEGER time_units ')' ',' PRDR_MFG_KW '(' PRDR_INTEGER time_units ')' ')' - { - $$ = new ExprAct_Thresh($5, $6, $11, $12); - } - | PRDR_ACT_THRESHOLD '(' PRDR_FLD_KW '(' PRDR_INTEGER time_units ')' ',' PRDR_MFG_FILE_KW '(' PRDR_ID ')' ')' - { - $$ = new ExprAct_Thresh($5, $6, 0, NULL, $11); - } -; - -action_shared_threshold: action_threshold PRDR_SHARED_KW '(' PRDR_INTEGER ')' - { - static_cast($1)->cv_3 = $4; - $$ = $1; - } -; - -time_units: - { - $$ = new ExprTime(0xffffffff, Prdr::PRDR_TIME_BASE_SEC); - } - // FIXME: (RTC 51218) It is impossible to reach a theshold of 1000 per - // second because PRD cannot respond to attentions that quickly (at - // least on the FSP). Need to add code to check if the threshold is - // possible to based on the reaction type per attention ratio. - | '/' PRDR_TIME_SEC - { - $$ = new ExprTime(1, Prdr::PRDR_TIME_BASE_SEC); - } - | '/' PRDR_TIME_MIN - { - $$ = new ExprTime(1, Prdr::PRDR_TIME_BASE_MIN); - } - | '/' PRDR_TIME_HOUR - { - $$ = new ExprTime(1, Prdr::PRDR_TIME_BASE_HOUR); - } - | '/' PRDR_TIME_DAY - { - $$ = new ExprTime(1, Prdr::PRDR_TIME_BASE_DAY); - } - | '/' PRDR_INTEGER PRDR_TIME_SEC - { - $$ = new ExprTime($2, Prdr::PRDR_TIME_BASE_SEC); - } - | '/' PRDR_INTEGER PRDR_TIME_MIN - { - $$ = new ExprTime($2, Prdr::PRDR_TIME_BASE_MIN); - } - | '/' PRDR_INTEGER PRDR_TIME_HOUR - { - $$ = new ExprTime($2, Prdr::PRDR_TIME_BASE_HOUR); - } - | '/' PRDR_INTEGER PRDR_TIME_DAY - { - $$ = new ExprTime($2, Prdr::PRDR_TIME_BASE_DAY); - } -; - -action_analyse: PRDR_ACT_ANALYSE '(' PRDR_ID ')' - { - $$ = new ExprRef($3); - g_references.push_front(RefPair("g",*$3)); - } -; - -action_analyse_conn: PRDR_ACT_ANALYSE '(' PRDR_CONNECTED '(' PRDR_ID ')' ')' - { - $$ = new ExprAct_Analyse($5); - } -; - -action_analyse_conn: PRDR_ACT_ANALYSE '(' PRDR_CONNECTED '(' PRDR_ID ',' PRDR_INTEGER ')' ')' - { - $$ = new ExprAct_Analyse($5, $7); - } -; - -action_try: PRDR_ACT_TRY '(' actionline ',' actionline ')' - { - $$ = new ExprAct_Try($3,$5); - } -; - -action_dump: PRDR_ACT_DUMP '(' PRDR_ID ')' - { - $$ = new ExprAct_Dump($3); - } -; - -action_callout: PRDR_ACT_CALLOUT '(' PRDR_ID ')' - { - $$ = new ExprAct_Callout($3); - } - | PRDR_ACT_CALLOUT '(' PRDR_CONNECTED '(' PRDR_ID action_callout_alt ')' ',' PRDR_ID ')' - { - $$ = new ExprAct_Callout($9, $5, Prdr::CALLOUT_GARD_CHIP, 0xffffffff, $6 ); - } - | PRDR_ACT_CALLOUT '(' PRDR_CONNECTED '(' PRDR_ID ',' PRDR_INTEGER action_callout_alt ')' ',' PRDR_ID ')' - { - $$ = new ExprAct_Callout($11, $5, Prdr::CALLOUT_GARD_CHIP, $7, $8); - } - - | PRDR_ACT_CALLOUT '(' PRDR_PROCEDURE '(' PRDR_ID ')' ',' PRDR_ID ')' - { - $$ = new ExprAct_Callout($8, $5, Prdr::CALLOUT_PROC ); - } - | PRDR_ACT_CALLOUT '(' PRDR_CONNECTED_PEER '(' PRDR_ID ',' PRDR_INTEGER action_callout_alt ')' ',' PRDR_ID ')' - { - $$ = new ExprAct_Callout($11, $5, Prdr::CALLOUT_GARD_PEER, $7, $8 ); - } - | PRDR_ACT_CALLOUT '(' PRDR_ID ',' PRDR_ID ')' - { - $$ = new ExprAct_Callout($3, NULL, Prdr::CALLOUT_GARD_SELF, 0xffffffff, NULL, $5); - } - - | PRDR_ACT_CALLOUT '(' PRDR_CONNECTED '(' PRDR_ID action_callout_alt')' ',' PRDR_ID ',' PRDR_ID ')' - { - $$ = new ExprAct_Callout($9, $5, Prdr::CALLOUT_GARD_CHIP, 0xffffffff, $6, $11 ); - } - - | PRDR_ACT_CALLOUT '(' PRDR_CONNECTED '(' PRDR_ID ',' PRDR_INTEGER action_callout_alt ')' ',' PRDR_ID ',' PRDR_ID ')' - { - $$ = new ExprAct_Callout($11, $5, Prdr::CALLOUT_GARD_CHIP, $7, $8, $13 ); - } - - | PRDR_ACT_CALLOUT '(' PRDR_CONNECTED_PEER '(' PRDR_ID ',' PRDR_INTEGER action_callout_alt ')' ',' PRDR_ID ',' PRDR_ID ')' - { - $$ = new ExprAct_Callout($11, $5, Prdr::CALLOUT_GARD_PEER, $7, $8, $13 ); - } -; - -action_callout_alt: - { - $$ = NULL; - } - | ',' PRDR_ALTERNATE '(' actionline ')' - { - $$ = $4; - } -; - -action_funccall: PRDR_ACT_FUNCCALL '(' PRDR_STRING ')' - { - $$ = new ExprAct_Funccall($3); - } - | PRDR_ACT_FUNCCALL '(' PRDR_STRING ',' PRDR_ID ')' - { - $$ = new ExprAct_Funccall($3, $5); - } -; - -action_flag: PRDR_ACT_FLAG '(' PRDR_ID ')' - { - $$ = new ExprAct_Flag($3); - } -; - -action_capture: PRDR_ACT_CAPTURE '(' PRDR_ID ')' - { - $$ = new ExprAct_Capture($3); - } -; - - -dox_comment: dox_commentblk - { - $$ = $1; - } - | dox_commentblk dox_comment - { - (*$1) += (*$2); - $$ = $1; - } -; - -dox_commentblk: dox_commentline - { - $$ = $1; - } - | PRDR_DOX_ENDL - { - $$ = new std::string("\n"); - } -; - -dox_commentline: PRDR_DOX_COMMENT - { - $$ = $1; - } -; - -%% -/* Additional C Code */ - -void yyerror(const char * s) -{ - if (yyincfiles.empty()) - fprintf(stderr, "Line %d: %s\n", yyline, s); - else - fprintf(stderr, "File %s Line %d: %s\n", - yyincfiles.top().first.c_str(), - yyline, - s); - - g_hadError = true; -} - diff --git a/src/usr/diag/prdf/common/framework/rule/prdrExpr.H b/src/usr/diag/prdf/common/framework/rule/prdrExpr.H deleted file mode 100755 index 6393da915..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdrExpr.H +++ /dev/null @@ -1,1060 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdrExpr.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* 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 */ - -#ifndef __PRDREXPR_H -#define __PRDREXPR_H - -#include -#include -#include -#include -#include // for typeid - -#include - -#include // for enums. - -using Prdr::SignatureOp; - -extern void yyerror(const char *); - -namespace PRDR_COMPILER -{ - -// -- Forward defs // -class Expr; -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 &); -std::list prdrParseDoxygen(std::string & i_string); -class Chip; -extern Chip * g_currentChip; -extern std::map g_rules; -extern uint32_t g_nextAndBit; -extern bool g_hadError; -// -- end Forward defs // - -class Expr -{ - 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 SignatureOp::DEFAULT_SIGNATURE; - }; - - - Expr() : cv_doxcomment("") {}; - virtual ~Expr() {}; - - protected: - std::string cv_doxcomment; -}; - -class ExprRef : public Expr -{ - public: - std::string * cv_name; - - ExprRef(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)); - - PRDR_FWRITE(&l_op, 1, 1, i_file); - PRDR_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 << "" - << *cv_name << ""; - } - - virtual uint16_t getSignature() - { - if (Prdr::REF_REG == prdrGetRefType(cv_name)) - { - return PRDF::Util::hashString(cv_name->c_str()); - } - else - { - Expr * tmp = g_rules[*cv_name]; - if (NULL == tmp) - { - std::cerr << "NPE: " << *cv_name << std::endl; - } - return (NULL == tmp ? - SignatureOp::DEFAULT_SIGNATURE - : tmp->getSignature() - ); - } - }; - -}; - -class ExprInt : public Expr -{ - public: - uint32_t cv_value; - char cv_op; - - ExprInt() : cv_op(Prdr::INTEGER) {}; - ExprInt(uint32_t v, char o = Prdr::INTEGER) : cv_value(v), - cv_op(o) {}; - - int output(FILE * i_file) - { - char tmp = cv_op; - PRDR_FWRITE(&tmp, 1, 1, i_file); - - if (Prdr::INTEGER != cv_op) - { - uint16_t temp = htons((uint16_t) cv_value); - PRDR_FWRITE(&temp, sizeof(temp), 1, i_file); - } - else - { - uint32_t temp = htonl(cv_value); - PRDR_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 SignatureOp::DEFAULT_SIGNATURE; }; -}; - -class ExprTime : public Expr -{ - public: - - uint32_t iv_units; - Prdr::TimeBaseFlags iv_base; - - ExprTime() : - iv_units(0xffffffff), iv_base(Prdr::PRDR_TIME_BASE_SEC) - {} - - ExprTime( uint32_t units, Prdr::TimeBaseFlags 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 ); - PRDR_FWRITE( &seconds, sizeof(seconds), 1, i_file ); - - return 0; - } - - void generateDoxygen( std::ostream & o_stream, - std::string & o_trailing, - std::ostream & o_errFile = std::cerr ) - { - o_stream << iv_units << " "; - switch ( iv_base ) - { - case Prdr::PRDR_TIME_BASE_SEC: o_stream << "sec"; break; - case Prdr::PRDR_TIME_BASE_MIN: o_stream << "min"; break; - case Prdr::PRDR_TIME_BASE_HOUR: o_stream << "hour"; break; - case Prdr::PRDR_TIME_BASE_DAY: o_stream << "day"; break; - default: ; - } - } -}; - -class ExprBitString : public Expr -{ - public: - std::string cv_value; - char cv_op; - - ExprBitString() : cv_value(), cv_op(Prdr::BIT_STR) {}; - ExprBitString(std::string v, char o = Prdr::BIT_STR) : cv_value(v), - cv_op(o) {}; - - int output(FILE * i_file) - { - char tmp = cv_op; - PRDR_FWRITE(&tmp, 1, 1, i_file); - - // subtract 2 backticks. - uint8_t len = (cv_value.length() - 2) * 4; - PRDR_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) - { - PRDR_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 SignatureOp::DEFAULT_SIGNATURE; }; -}; - - -class ExprOp1 : public Expr -{ - public: - char cv_op; - Expr * cv_arg; - - ExprOp1(char o) : cv_op(o) {}; - ExprOp1(char o, Expr * a) : cv_op(o), cv_arg(a) {}; - - int output(FILE * i_file) - { - PRDR_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 ? - SignatureOp::DEFAULT_SIGNATURE - : cv_arg->getSignature() - ); - } - -}; - -class ExprOp2 : public Expr -{ - public: - Expr * cv_arg[2]; - char cv_op; - - ExprOp2(char o) : cv_op(o) {}; - ExprOp2(char o, Expr * a1, Expr * a2) : cv_op(o) - { - cv_arg[0] = a1; cv_arg[1] = a2; - }; - - int output(FILE * i_file) - { - PRDR_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() - { - // To match the signature generation during IPL - // time in RightShiftRegister/LeftShiftRegister, - // We need to skip calling combineSig during - // rule compile time. - // The casting is needed since these are extend ascii codes - if ((char(Prdr::RSHIFT) == cv_op) || - (char(Prdr::LSHIFT) == cv_op)) - { - return cv_arg[0]->getSignature(); - } - else - { - return SignatureOp::combineSig( - (NULL == cv_arg[0] ? - SignatureOp::DEFAULT_SIGNATURE - : cv_arg[0]->getSignature() - ), - (NULL == cv_arg[1] ? - SignatureOp::DEFAULT_SIGNATURE - : cv_arg[1]->getSignature() - )); - } - }; - -}; - -class ExprAttnLink : public Expr -{ - public: - static const int MAX_ATTNS = 4; - Expr * cv_arg[MAX_ATTNS]; - - ExprAttnLink(std::string * attn1, Expr * exp1, - std::string * attn2, Expr * exp2, - std::string * attn3, Expr * exp3, - std::string * attn4, Expr * 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; - PRDR_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++; - PRDR_FWRITE(&cv_op, 1, 1, i_file); - - for (int i = 0; i < MAX_ATTNS; i++) - if (NULL != cv_arg[i]) - { - cv_op = i; - PRDR_FWRITE(&cv_op, 1, 1, i_file); - cv_arg[i]->output(i_file); - } - - return 0; - } - - uint16_t getSignature() - { - uint16_t l_val = SignatureOp::DEFAULT_SIGNATURE; - for (int i = 0; i < MAX_ATTNS; i++) - if (NULL != cv_arg[i]) - l_val = SignatureOp::combineSig(l_val, - cv_arg[i]->getSignature()); - else - l_val = SignatureOp::combineSig(l_val, - SignatureOp::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 ExprRule : public Expr -{ - public: - std::string * cv_rulename; - Expr * cv_bits; - std::string * cv_actionname; - - ExprRule(std::string * r, Expr * 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; - PRDR_FWRITE(&l_op, 1, 1, i_file); - l_ref = htons(prdrGetRefId(cv_rulename)); - PRDR_FWRITE(&l_ref, sizeof(l_ref), 1, i_file); - - cv_bits->output(i_file); - - l_op = prdrGetRefType(cv_actionname); - PRDR_FWRITE(&l_op, 1, 1, i_file); - l_ref = htons(prdrGetRefId(cv_actionname)); - PRDR_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 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 - << ( (ExprRef(cv_rulename).getSignature() - + g_currentChip->cv_signatureOffset) & 0xffff ) - << "00"; - - o_stream << ""; - 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 << ""; - if (std::string() != l_long) - { - o_stream << ""; - - o_trailing += "" ; - o_trailing += l_name + ": "; - - o_trailing += l_short + "
"; - o_trailing += l_long + "

\n"; - } - o_stream << l_name; - if (std::string() != l_long) - { - o_stream << ""; - o_trailing += ""; - } - - o_stream << "" << l_short; - - - o_stream << "" - << *cv_actionname << ""; - - 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(ExprOp2).name()) - { - if (static_cast(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 ExprAct_Try : public Expr -{ - public: - Expr * cv_left, * cv_right; - - ExprAct_Try(Expr * l, Expr * r) : cv_left(l), - cv_right(r) {}; - - int output(FILE * i_file) - { - char l_op; - - l_op = Prdr::ACT_TRY; - PRDR_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 ExprAct_Thresh : public Expr -{ - public: - Expr* 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; - - ExprAct_Thresh( uint8_t i_field = 0, Expr * i_fieldTime = NULL, - uint8_t i_mfg = 0, Expr * 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; - PRDR_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; - - PRDR_FWRITE(&l_op, 1, 1, i_file); - - if (NULL != cv_thresholdTime[0]) - { - PRDR_FWRITE(&cv_field, sizeof(cv_field), 1, i_file); - cv_thresholdTime[0]->output(i_file); - if (NULL != cv_thresholdTime[1]) - { - PRDR_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); - PRDR_FWRITE(&l_tmp32, sizeof(l_tmp32), 1, i_file); - } - } - - if (0 != cv_3) - { - uint32_t l_tmp32 = htonl(cv_3); - PRDR_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 ExprAct_Dump : public Expr //@ecdf -{ - public: - std::string * cv_1; - - ExprAct_Dump(std::string * i_1) : cv_1(i_1) {}; - - int output(FILE * i_file) - { - char l_op; - - l_op = Prdr::ACT_DUMP; - PRDR_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); - PRDR_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 ExprAct_Analyse : public Expr -{ - public: - std::string * cv_1; - uint32_t cv_2; - - ExprAct_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; - PRDR_FWRITE(&l_op, 1, 1, i_file); - - uint32_t l_chipType = htonl(prdrActionArgMap(*cv_1)); - PRDR_FWRITE(&l_chipType, sizeof(l_chipType), 1, i_file); - - uint32_t l_chipIndx = htonl(cv_2); - PRDR_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 ExprAct_Callout : public Expr -{ - public: - std::string * cv_1, * cv_2; - uint32_t cv_3; - - Expr * cv_alt; - - Prdr::Callout_type cv_type; - std::string * cv_4; - - ExprAct_Callout(std::string * i_1, - std::string * i_2 = NULL, - Prdr::Callout_type i_t = Prdr::CALLOUT_GARD_SELF, - uint32_t i_3 = 0xffffffff, - Expr * i_alt = NULL, - std::string * i_4 = NULL ): - cv_1(i_1), cv_2(i_2), - cv_3(i_3), cv_alt(i_alt), - cv_type(i_t), - cv_4( i_4 ) - {} - - int output(FILE * i_file) - { - char l_op; - - l_op = Prdr::ACT_CALL; - PRDR_FWRITE(&l_op, 1, 1, i_file); - - l_op = cv_type; - PRDR_FWRITE(&l_op, 1, 1, i_file); - - uint32_t l_priority = htonl(prdrActionArgMap(*cv_1)); - PRDR_FWRITE(&l_priority, sizeof(l_priority), 1, i_file); - - if ( Prdr::CALLOUT_GARD_SELF != cv_type ) - { - uint32_t l_arg = htonl(prdrActionArgMap(*cv_2)); - PRDR_FWRITE(&l_arg, sizeof(l_arg), 1, i_file); - - l_arg = htonl(cv_3); - PRDR_FWRITE(&l_arg, sizeof(l_arg), 1, i_file); - // Write bool for ALT resolution. - l_op = (NULL == cv_alt ? 0 : 1); - PRDR_FWRITE(&l_op, 1, 1, i_file); - - // Write ALT resolution. - if (NULL != cv_alt) - cv_alt->output(i_file); - - // Write peer connection type - if(Prdr::CALLOUT_GARD_PEER == cv_type) - l_arg = htonl(prdrActionArgMap(*cv_2)); - else - l_arg = htonl(prdrActionArgMap("TYPE_NA")); - - PRDR_FWRITE(&l_arg, sizeof(l_arg), 1, i_file); - } - // Write gard state - if( NULL == cv_4 ) - { - // if no policy for gard has been specified explicitly, assume - // it to be NO GARD for procedure callout. But for self or - // connected callout, assume it to be GARD. - - if( Prdr::CALLOUT_PROC == cv_type ) // is it a procedure callout - { - l_op = prdrActionArgMap("NO_GARD"); - } - else - { - l_op = prdrActionArgMap("GARD"); - } - } - else - { - l_op = prdrActionArgMap(*cv_4); - } - - PRDR_FWRITE(&l_op, 1, 1, i_file); - return 0; - - }; - - void generateDoxygen(std::ostream & o_stream, - std::string & o_trailing, - std::ostream & o_errFile = std::cerr) - { - o_stream << "callout ( "; - std::string tmpGard("GARD"); - if( NULL != cv_4 ) - { - tmpGard.assign( *cv_4 ); - } - - if ( Prdr::CALLOUT_GARD_SELF == cv_type ) - { - o_stream << "SELF, " << *cv_1 << tmpGard << " )"; - } - else if ( Prdr::CALLOUT_PROC == cv_type ) - { - o_stream << "procedure ( " << *cv_2 << " ), " << *cv_1 << " ) "; - } - else - { - if(Prdr::CALLOUT_GARD_PEER == cv_type) - { - o_stream << "connected_peer ( " << *cv_2 ; - } - else - { - o_stream << "connected ( " << *cv_2 ; - } - if ( 0xffffffff != cv_3 ) - o_stream << ", " << cv_3; - - o_stream << " ), " << *cv_1 << tmpGard << " ) "; - } - } -}; - -class ExprAct_Funccall : public Expr -{ - public: - std::string * cv_1, * cv_2; - - ExprAct_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; - PRDR_FWRITE(&l_op, 1, 1, i_file); - - if ('"' == (*cv_1)[0]) - (*cv_1) = cv_1->substr(1, cv_1->size() - 2); - PRDR_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; - PRDR_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 ExprAct_Flag : public Expr -{ - public: - std::string * cv_1; - - ExprAct_Flag(std::string * i_1) : cv_1(i_1) {}; - - int output(FILE * i_file) - { - char l_op; - - l_op = Prdr::ACT_FLAG; - PRDR_FWRITE(&l_op, 1, 1, i_file); - - uint32_t l_flag = htonl(prdrActionArgMap(*cv_1)); - PRDR_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 ExprAct_Capture : public Expr -{ - public: - std::string * cv_1; - - ExprAct_Capture(std::string * i_1) : cv_1(i_1) {}; - - int output(FILE * i_file) - { - char l_op; - - l_op = Prdr::ACT_CAPT; - PRDR_FWRITE(&l_op, 1, 1, i_file); - - uint32_t l_group = htonl(prdrCaptureGroupMap(*cv_1)); - PRDR_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 g_rules; - -typedef std::pair RefPair; -extern std::list g_references; - -} // end namespace PRDR_COMPILER - -#endif - diff --git a/src/usr/diag/prdf/common/framework/rule/prdrGroup.H b/src/usr/diag/prdf/common/framework/rule/prdrGroup.H deleted file mode 100755 index b0cb90afb..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdrGroup.H +++ /dev/null @@ -1,269 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdrGroup.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2014 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* 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 */ - -#ifndef __PRDRGROUP_H -#define __PRDRGROUP_H - -#include -#include -#include - -#include -#include - -namespace PRDR_COMPILER -{ - -class Chip; -extern Chip * g_currentChip; -extern uint32_t g_nextAndBit; -class Group_Filter; - -class Group -{ - public: - std::list cv_rules; - Expr * cv_priorityList; - Expr * cv_secondaryList; - - char cv_op; - uint8_t cv_flags; - std::string cv_doxcomment; - - Group() : - cv_priorityList(NULL), - cv_secondaryList(NULL), - cv_op(Prdr::GROUP), - cv_flags(0), - cv_doxcomment() {}; - Group(char o) : - cv_priorityList(NULL), - cv_secondaryList(NULL), - cv_op(o), - cv_flags(0), - cv_doxcomment() {}; - - static void merge(Group * i_l, Group * 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; - - // Set Secondary bit list. - if ( NULL != i_l->cv_secondaryList ) - { - i_r->cv_secondaryList = i_l->cv_secondaryList; - } - - }; - - void setComment(std::string & i_comment) - { - if (Prdr::GROUP == cv_op) - { - Expr * 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 << "

" - << i_name << "

"; - - o_stream << "" - << "" << std::endl; - - o_stream << "" - << "" - << std::endl; - - g_nextAndBit = 64; - } - else if (Prdr::ACTION == cv_op) - { - o_stream << ""; - o_stream << " "; - o_stream << ""; - - o_stream << ""; - } - else if (Prdr::ACTION == cv_op) - { - if (i != cv_rules.begin()) - o_stream << "
" << std::endl; - - } - (*i)->generateDoxygen(o_stream, l_trailingInfo, o_errFile); - if (Prdr::GROUP == cv_op) - { - o_stream << "" << std::endl; - } - - } - if (Prdr::GROUP == cv_op) - { - o_stream << "
" - << "Register Group: " << i_name - << "
Bit(s)" - << "NameShort Description" - << "Actions

" - << i_name << "

"; - if (std::string() != cv_doxcomment) - { - o_stream << cv_doxcomment; - } - o_stream << "" << std::endl; - } - - for (std::list::iterator i = cv_rules.begin(); - i != cv_rules.end(); - i++) - { - if (Prdr::GROUP == cv_op) - { - o_stream << "

" << std::endl; - o_stream << l_trailingInfo << std::endl; - o_stream << ""; - } - else if (Prdr::ACTION == cv_op) - { - o_stream << "" << std::endl; - } - }; - - int output(FILE * i_file) - { - PRDR_FWRITE(&cv_op, 1, 1, i_file); - - uint16_t l_ruleCount = htons(cv_rules.size()); - PRDR_FWRITE(&l_ruleCount, sizeof(l_ruleCount), 1, i_file); - - // Write flags for GROUP op. - if (Prdr::GROUP == cv_op) - { - PRDR_FWRITE(&cv_flags, 1, 1, i_file); - if ( Prdr::PRDR_GROUP_FILTER_PRIORITY & cv_flags ) - { - cv_priorityList->output( i_file ); - } - if ( Prdr::PRDR_GROUP_FILTER_SECONDARY & cv_flags ) - { - cv_secondaryList->output( i_file ); - } - } - - for (std::list::iterator i = cv_rules.begin(); - i != cv_rules.end(); - i++) - { - (*i)->output( i_file ); - } - - return 0; - }; - - -}; - -extern std::map g_groups; -extern std::map g_actionclasses; -extern std::map g_attentionStartGroup; - -class Group_Filter -{ - public: - virtual ~Group_Filter() { } // zs01 - virtual void AddFilter(Group *) = 0; -}; - -class Group_Filter_SingleBit : public Group_Filter -{ - public: - void AddFilter(Group * i_group) - { - i_group->cv_flags |= Prdr::PRDR_GROUP_FILTER_SINGLE_BIT; - }; -}; - -class Group_Filter_Priority : public Group_Filter -{ - public: - Group_Filter_Priority(Expr * i_list) : iv_list(i_list) {}; - - void AddFilter(Group * i_group) - { - i_group->cv_flags |= Prdr::PRDR_GROUP_FILTER_PRIORITY; - i_group->cv_priorityList = iv_list; - }; - - private: - Expr * iv_list; -}; - -class Group_Filter_Secondary : public Group_Filter -{ - public: - Group_Filter_Secondary( Expr * i_list ) : iv_secList( i_list ) {}; - - void AddFilter( Group * i_group ) - { - i_group->cv_flags |= Prdr::PRDR_GROUP_FILTER_SECONDARY; - i_group->cv_secondaryList = iv_secList; - }; - - private: - Expr * iv_secList; -}; -} // end namespace PRDR_COMPILER - -#endif - diff --git a/src/usr/diag/prdf/common/framework/rule/prdrLoadChip.C b/src/usr/diag/prdf/common/framework/rule/prdrLoadChip.C deleted file mode 100755 index 8fca69624..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdrLoadChip.C +++ /dev/null @@ -1,549 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdrLoadChip.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* 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 */ - -#include // for memcmp -#include - -#include -#include -#include -#include - -#include -#include -#include -#include // for Util::hashString -#include -#include // for std::generate_n - -namespace Prdr -{ - -// 'using namespace PRDF' added so that the Hostboot error log parser can find -// the moduleid and reasoncode in the error log tags. The alternative is to add -// 'PRDF::' before the moduleid and reasoncode in the error log tags -using namespace PRDF; - -void ReadExpr(UtilStream & i_stream, Expr & o_expr); - -// NOTE: caller must call delete[] to release the buffer -void ReadString(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 & 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 LoadChip(UtilStream & i_stream, Chip & 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("LoadChip() 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_LOADCHIP - * @userdata1 0x50524452 ("PRDR") - * @userdata2 0x43484950 ("CHIP") - * @devdesc Attempted to load chip rule file that lacked - * the proper header "PRDRCHIP". - * @custDesc An Internal firmware fault, chip diagnosis failed to - * initialize. - */ - PRDF_CREATE_ERRL(l_errl, - ERRL_SEV_UNRECOVERABLE, - ERRL_ETYPE_NOT_APPLICABLE, - SRCI_ERR_INFO, - SRCI_NO_ATTR, - PRDF::PRDF_LOADCHIP, - LIC_REFCODE, - PRDF::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 Register[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_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_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 - ), - PRDF::Util::unary_input(i_stream)(), - PRDF::Util::unary_input (i_stream) - ); - - } - - if (o_chip.cv_registers[i].cv_flags & - 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 - ), - PRDF::Util::unary_input(i_stream)(), - PRDF::Util::unary_input (i_stream) - ); - - } - - if (o_chip.cv_registers[i].cv_flags & - 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 - ), - PRDF::Util::unary_input(i_stream)(), - PRDF::Util::unary_input (i_stream) - ); - } - } - } - - // read rules. - i_stream >> o_chip.cv_ruleCount; - if (o_chip.cv_ruleCount != 0) - { - o_chip.cv_rules = new Expr[o_chip.cv_ruleCount]; - for (uint32_t i = 0; i < o_chip.cv_ruleCount; i++) - { - i_stream >> l_temp[0]; // should be 'R' - ReadExpr(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 Expr * [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 Expr * [o_chip.cv_groupCount]; - o_chip.cv_groupSecondaryBits = new Expr * [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]; - - //check if priority filter has been specified - if ( PRDR_GROUP_FILTER_PRIORITY & o_chip.cv_groupFlags[i] ) - { - o_chip.cv_groupPriorityBits[i] = new Expr(); - ReadExpr(i_stream, *o_chip.cv_groupPriorityBits[i]); - } - else - { - o_chip.cv_groupPriorityBits[i] = NULL; - } - - //check if secondary filter has been specified - if( PRDR_GROUP_FILTER_SECONDARY & o_chip.cv_groupFlags[i] ) - { - o_chip.cv_groupSecondaryBits[i] = new Expr(); - ReadExpr(i_stream, *o_chip.cv_groupSecondaryBits[i]); - } - else - { - o_chip.cv_groupSecondaryBits[i] = NULL; - } - if (0 != o_chip.cv_groupSize[i]) - { - o_chip.cv_groups[i] = new Expr[o_chip.cv_groupSize[i]]; - for (uint32_t j = 0; j < o_chip.cv_groupSize[i]; j++) - { - ReadExpr(i_stream, o_chip.cv_groups[i][j]); - if (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 Expr(); - o_chip.cv_groups[i][j].cv_deletePtr[k] = true; - - ReadExpr(i_stream, - *o_chip.cv_groups[i][j].cv_value[k].p); - } - } - } - } - else - { - o_chip.cv_groups[i] = new Expr[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 Expr * [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 Expr[o_chip.cv_actionSize[i]]; - for (uint32_t j = 0; j < o_chip.cv_actionSize[i]; j++) - { - ReadExpr(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 ReadExpr(UtilStream & i_stream, Expr & 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 AND: - case OR: - case XOR: - case LSHIFT: - case RSHIFT: - case ACT_TRY: - o_expr.cv_value[0].p = new Expr(); - o_expr.cv_deletePtr[0] = true; - ReadExpr(i_stream, *o_expr.cv_value[0].p); - - o_expr.cv_value[1].p = new Expr(); - o_expr.cv_deletePtr[1] = true; - ReadExpr(i_stream, *o_expr.cv_value[1].p); - break; - - case NOT: - o_expr.cv_value[0].p = new Expr(); - o_expr.cv_deletePtr[0] = true; - ReadExpr(i_stream, *o_expr.cv_value[0].p); - break; - - case INTEGER: - case ACT_FLAG: - i_stream >> o_expr.cv_value[0].i; - break; - - case REF_RULE: - case REF_REG: - case REF_GRP: - case REF_ACT: - case INT_SHORT: - i_stream >> l_tmp16; - o_expr.cv_value[0].i = l_tmp16; - break; - - case BIT_STR: - o_expr.cv_bitStrVect.clear(); - prdrReadBitString(i_stream, o_expr.cv_bitStrVect); - break; - - case ACT_THRES: - - // 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] mask id if shared threshold - - //default values - o_expr.cv_value[0].i = PRDF::ThresholdResolution:: - cv_fieldDefault.threshold; - o_expr.cv_value[1].i = PRDF::ThresholdResolution:: - cv_fieldDefault.interval; - o_expr.cv_value[2].i = PRDF::ThresholdResolution:: - cv_mnfgDefault.threshold; - o_expr.cv_value[3].i = PRDF::ThresholdResolution:: - cv_mnfgDefault.interval; - // 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); - - 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 ACT_ANALY: - i_stream >> o_expr.cv_value[0].i; - i_stream >> o_expr.cv_value[1].i; - break; - - case ACT_FUNC: - o_expr.cv_actFunc = NULL; - ReadString(i_stream, o_expr.cv_actFunc); - - i_stream >> o_expr.cv_value[1].i; - break; - - case ACT_CALL: - i_stream >> l_tmpChar; - o_expr.cv_value[0].i = l_tmpChar; - i_stream >> o_expr.cv_value[1].i; - - if( Prdr::CALLOUT_GARD_SELF != 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 Expr(); - o_expr.cv_deletePtr[4] = true; - ReadExpr(i_stream, *o_expr.cv_value[4].p); - } - else - o_expr.cv_value[4].p = NULL; - - // Read peer connection type - i_stream >> o_expr.cv_value[5].i; - } - //Read gard state associated with callout - i_stream >> l_tmp8; - o_expr.cv_value[6].i = l_tmp8; - - - break; - - case ACT_DUMP: //@ecdf - i_stream >> o_expr.cv_value[0].i; - break; - - case 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 Expr(); - o_expr.cv_deletePtr[l_tmpChar] = true; - ReadExpr(i_stream, *o_expr.cv_value[l_tmpChar].p); - } - break; - - case ACT_CAPT: - i_stream >> o_expr.cv_value[0].i; - - default: - break; - } -} - -Register::Register() : cv_name(0) -{} - -Register::~Register() -{ - for(std::vector::iterator - j = cv_captures.begin(); - j != cv_captures.end(); - ++j) - { - if (NULL != (*j).func) - { - delete[] (*j).func; - (*j).func = NULL; - } - } -} - -Expr::Expr() -{ - 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; - } -} - -Expr::~Expr() -{ - // 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 ACT_FUNC: - if(NULL != cv_actFunc) - { - delete[] cv_actFunc; - cv_actFunc = NULL; - } - break; - case 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 Prdr diff --git a/src/usr/diag/prdf/common/framework/rule/prdrLoadChip.H b/src/usr/diag/prdf/common/framework/rule/prdrLoadChip.H deleted file mode 100755 index 44feebfbb..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdrLoadChip.H +++ /dev/null @@ -1,251 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdrLoadChip.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* 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 */ - -#ifndef __PRDRLOADCHIP_H -#define __PRDRLOADCHIP_H - -/** - * @file prdrLoadChip.H - * @brief Describes classes and enums needed to load a .prf file. - */ - - -//-------------------------------------------------------------------- -// Includes -//-------------------------------------------------------------------- - -#include - -#include -#include - -#include - -#include -#include - -//-------------------------------------------------------------------- - -/** - * @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 ReadString(UtilStream & i_stream, char *& o_string); - - /** - * @class Register - * @brief Holds data associated with a register. - */ - class Register - { - 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 */ - - Register(); - ~Register(); - - 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 cv_resets; - std::vector 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': - case 'P': - 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) - { - ReadString(i_left, i_right.func); - } - - return i_left; - } - }; - - std::vector cv_captures; - - }; - - /** - * @class Expr - * @brief Contains data for the basic rule object, the "expression". - */ - class Expr - { - public: - union value { uint32_t i; Expr * p; }; - - /** Maximum number of entries a expression can have. */ - static const uint32_t MAX_VALUES = 7; - - 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 cv_bitStrVect; - - /** - * @func Expr() - * @brief Default constructor. Clear entry arrays. - */ - Expr(); - - /** - * @func ~Expr() - * @brief Default destructor. Delete all attached pointers, as - * requested. - */ - ~Expr(); - - private: - // Don't let us copy these things, we don't want to mess with the - // pointer tree. - Expr(const Expr & i_copy) {}; - }; - - class Chip - { - 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; - Register * cv_registers; - uint16_t cv_ruleCount; - Expr * cv_rules; - uint16_t cv_groupCount; - uint16_t cv_groupAttn[NUM_GROUP_ATTN]; - uint16_t * cv_groupSize; - uint8_t * cv_groupFlags; - Expr ** cv_groupPriorityBits; - Expr ** cv_groupSecondaryBits; - Expr ** cv_groups; - uint16_t cv_actionCount; - uint16_t * cv_actionSize; - Expr ** cv_actions; - - Chip() : 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_groupSecondaryBits(NULL), cv_groups(NULL), - cv_actionCount(0), cv_actionSize(NULL), - cv_actions(NULL) - { - }; - - ~Chip() - { - 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_groupSecondaryBits[i] ) - delete cv_groupSecondaryBits[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; - if ( NULL != cv_groupSecondaryBits ) - delete[] cv_groupSecondaryBits; - 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 LoadChip(UtilStream & i_stream, Chip & o_chip); - -} // end namespace Prdr - -#endif diff --git a/src/usr/diag/prdf/common/framework/rule/prdrLoadChipCache.C b/src/usr/diag/prdf/common/framework/rule/prdrLoadChipCache.C deleted file mode 100755 index ebe77878d..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdrLoadChipCache.C +++ /dev/null @@ -1,173 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdrLoadChipCache.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* 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 */ - -#ifndef __HOSTBOOT_MODULE - -#include // for UtilReg - -#endif - - -#include // for strncat -#include -#include -#include - -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 (Chip*)i->second; - } - - // Clear map. - cv_cache.clear(); - }; - //--------------------------------------------------------------------- - - //--------------------------------------------------------------------- - errlHndl_t LoadChipCache::loadChip(const char * i_file, - Chip ** 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) = (Chip*)(*i).second; - l_errl = NULL; - } - else - { - (*o_chip) = new Chip(); - - do - { - // NOTE: to patch PRF files require rebuilding - // entire Hostboot image and put in a special - // location on FSP /nfs/test/pnor/ mount. - - const char * ext = ".prf"; - - const size_t sz_file = strlen( i_file ); - const size_t sz_ext = strlen( ext ); - const size_t sz_filePath = sz_file + sz_ext; - - char filePath[sz_filePath + 1]; - memset( filePath, '\0', sizeof(filePath) ); - - strncpy( filePath, i_file, sz_file ); - strncat( filePath, ext, sz_ext ); - - #ifdef __HOSTBOOT_MODULE - - UtilFile l_ruleFile( filePath ); - if ( !l_ruleFile.exists() ) - { - PRDF_ERR( "LoadChipCache::loadChip() failed to find %s", - filePath ); - } - else - { - l_ruleFile.Open("r"); - } - - #else // not __HOSTBOOT_MODULE - - // Read the correct directory path for flash. - const char * prdPath = "prdf/"; - const size_t sz_prdPath = strlen( prdPath ); - - size_t sz_rootPath = 256; - char rootPath[ sz_rootPath + sz_prdPath + sz_filePath + 1 ]; - memset( rootPath, '\0', sizeof(rootPath) ); - - l_errl = UtilReg::read( "fstp/RO_Root", (void *)rootPath, - sz_rootPath ); - if ( NULL != l_errl ) break; - - strncat( rootPath, prdPath, sz_prdPath ); - strncat( rootPath, filePath, sz_filePath ); - - // Read /maint/data/... directory path for any prf file patch. - const char * maintPath = "/maint/data/prdf/"; - const size_t sz_maintPath = strlen( maintPath ); - - char patchPath[ sz_maintPath + sz_filePath + 1 ]; - memset( patchPath, '\0', sizeof(patchPath) ); - - strncpy( patchPath, maintPath, sz_maintPath ); - strncat( patchPath, filePath, sz_filePath ); - - // Open File to read chip. - UtilFile l_ruleFile( patchPath ); - if ( !l_ruleFile.exists() ) // check for patch file. - { - l_ruleFile.Open(rootPath, "r"); - } - else - { - l_ruleFile.Open("r"); - } - - #endif // end __HOSTBOOT_MODULE - - // Load chip object. - l_errl = LoadChip(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; - - }; - //--------------------------------------------------------------------- - -} // end namespace Prdr diff --git a/src/usr/diag/prdf/common/framework/rule/prdrLoadChipCache.H b/src/usr/diag/prdf/common/framework/rule/prdrLoadChipCache.H deleted file mode 100755 index bd75948d1..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdrLoadChipCache.H +++ /dev/null @@ -1,83 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdrLoadChipCache.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2006,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 prdrLoadChipCache.H - * @brief Contains class information for a rule-chip loader cache. - */ - -#include -#include -#include -#include - -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, Chip ** o_chip); - - private: - /** The file cache. */ - typedef std::map Cache_t; - static Cache_t cv_cache; - }; - -} // end namespace Prdr diff --git a/src/usr/diag/prdf/common/framework/rule/prdrRegister.H b/src/usr/diag/prdf/common/framework/rule/prdrRegister.H deleted file mode 100755 index 746427591..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdrRegister.H +++ /dev/null @@ -1,370 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdrRegister.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2014 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* 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 */ - -#ifndef __PRDRREGISTER_H -#define __PRDRREGISTER_H - -#include -#include -#include - -#include -#include - -#include - -#include -#include -#include - -// define needed to enable x86 rule parser code only -#define __PRD_RULE_COMPILE -#include -#include - -#ifdef __HOSTBOOT_MODULE - #include - # define htonll(x) htobe64(x) - #ifndef htobe64 - #include - #if __BYTE_ORDER == __LITTLE_ENDIAN - #define htobe64(x) __bswap_64(x) - #else - #define htobe64(x) (x) - #endif - #endif -#else - #include -#endif - -#define PRDR_FWRITE( memPtr, size, count, fileStream) \ - if( count != fwrite(memPtr, size, count, fileStream)) \ - { \ - std::cout<<"Failed to write data to file"; \ - exit(1); \ - } - -namespace PRDR_COMPILER -{ - -extern Prdr::HashCollisionMap g_regsHashCollision; -extern bool g_hadError; - -struct ResetOrMaskStruct -{ - uint8_t type; - uint64_t addr_r; - uint64_t addr_w; - - void output(FILE * l_file) - { - PRDR_FWRITE(&type, 1, 1, l_file); - - uint64_t l_tmp64; - - l_tmp64 = htonll(addr_r); - PRDR_FWRITE(&l_tmp64, sizeof (l_tmp64), 1, l_file); - - l_tmp64 = htonll(addr_w); - PRDR_FWRITE(&l_tmp64, sizeof (l_tmp64), 1, l_file); - } -}; - -struct CaptureReqStruct -{ - 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. - PRDR_CAPTURE_NONZERO = 'P' // Added this to specify non zero register. - }; - - void output(FILE * l_file) - { - PRDR_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: - case PRDR_CAPTURE_NONZERO: - loopMax = 0; - break; - } - - for (int i = 0; i < loopMax; i++) - { - l_tmp32 = htonl(data[i]); - PRDR_FWRITE(&l_tmp32, 4, 1, l_file); - } - - if (type == PRDR_CAPTURE_FUNC) - { - if ('"' == (str)[0]) - str = str.substr(1, str.size() - 2); - PRDR_FWRITE(str.c_str(), str.size() + 1, 1, l_file); - } - - if (type == PRDR_CAPTURE_NONZERO ) - { - if ('"' == (str)[0]) - { - // remove double quotes from the string - str = str.substr(1, str.size() - 2); - } - l_tmp32 = htonl(PRDF::Util::hashString(str.c_str())); - PRDR_FWRITE(&l_tmp32, sizeof(l_tmp32), 1, l_file); - } - }; -}; - -class Register -{ - 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 cv_resets; - std::list cv_masks; - - std::list cv_captures; - - Register() : - 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(Register * i_l, Register * 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; - cout << "\tAccess: "; - uint32_t accessLevels = - Prdr::PRDR_REGISTER_WRITE | - Prdr::PRDR_REGISTER_READ | - Prdr::PRDR_REGISTER_ACCESS_NIL; - - switch( cv_flags & accessLevels ) - { - case Prdr::PRDR_REGISTER_ACCESS_NIL: cout << "No access"; break; - case Prdr::PRDR_REGISTER_WRITE: cout << "Write only"; break; - case Prdr::PRDR_REGISTER_READ: cout << "Read only"; break; - default: cout << "Read/Write"; - } - } - - int output( FILE * l_file, uint16_t i_sigOff ) - { - // Check for hash collisions - uint16_t hash = PRDF::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; - - uint32_t readWriteAccess = - Prdr::PRDR_REGISTER_WRITE | - Prdr::PRDR_REGISTER_READ | - Prdr::PRDR_REGISTER_ACCESS_NIL; - - if ( 0 == (readWriteAccess & cv_flags) ) - { - // No access has been specified so default to Read/Write access. - cv_flags |= readWriteAccess; - } - - // output data - uint32_t l_temp; - uint16_t l_temp16; - - l_temp16 = htons(PRDF::Util::hashString( cv_sname->c_str() )); - PRDR_FWRITE(&l_temp16, sizeof(l_temp16), 1, l_file); - - l_temp = htonl(cv_flags); - PRDR_FWRITE(&l_temp, sizeof(l_temp), 1, l_file); - - uint64_t l_temp64 = htonll(cv_scomaddr); - PRDR_FWRITE(&l_temp64, sizeof(l_temp64), 1, l_file); - - if (cv_flags & Prdr::PRDR_REGISTER_SCOMLEN) - { - l_temp16 = htons(cv_scomlen); - PRDR_FWRITE(&l_temp16, sizeof(l_temp16), 1, l_file); - } - - if (cv_flags & Prdr::PRDR_REGISTER_RESETS) - { - l_temp16 = htons(cv_resets.size()); - PRDR_FWRITE(&l_temp16, sizeof(l_temp16), 1, l_file); - - std::for_each( cv_resets.begin(), cv_resets.end(), - std::bind2nd( - std::mem_fun_ref(&ResetOrMaskStruct::output), - l_file) ); - } - - if (cv_flags & Prdr::PRDR_REGISTER_MASKS) - { - l_temp16 = htons(cv_masks.size()); - PRDR_FWRITE(&l_temp16, sizeof(l_temp16), 1, l_file); - - std::for_each( cv_masks.begin(), cv_masks.end(), - std::bind2nd( - std::mem_fun_ref(&ResetOrMaskStruct::output), - l_file) ); - } - - if (cv_flags & Prdr::PRDR_REGISTER_CAPTURE) - { - l_temp16 = htons(cv_captures.size()); - PRDR_FWRITE(&l_temp16, sizeof(l_temp16), 1, l_file); - - std::for_each( cv_captures.begin(), cv_captures.end(), - std::bind2nd( - std::mem_fun_ref(&CaptureReqStruct::output), - l_file) ); - } - - return 0; - }; - - void outputRegisterFile(std::ostream & o_file, uint16_t i_sigOff) - { - uint16_t hash = PRDF::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 RegisterList; - -} // end namespace PRDR_COMPILER - -#endif - diff --git a/src/usr/diag/prdf/common/framework/rule/prdrSignatures.H b/src/usr/diag/prdf/common/framework/rule/prdrSignatures.H deleted file mode 100755 index 332ceb6ff..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdrSignatures.H +++ /dev/null @@ -1,36 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdrSignatures.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2007,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 */ - -#include - -// Create a constant integer for PRDR_ERROR_SIGNATURE( foo, 0x1, "asdf", "ASDF") -#define PRDR_ERROR_SIGNATURE(a,b,c,d) \ - const uint32_t PRDFSIG_##a = b - -// Change Log ********************************************************* -// -// Flag Reason Vers Date Coder Description -// ---- -------- ---- -------- -------- ------------------------------- -// D586213 f310 02/19/07 iawillia Add extra signature support. -// End Change Log ***************************************************** - diff --git a/src/usr/diag/prdf/common/framework/rule/prdrToken.H b/src/usr/diag/prdf/common/framework/rule/prdrToken.H deleted file mode 100755 index a6bf29ade..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdrToken.H +++ /dev/null @@ -1,64 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/rule/prdrToken.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2004,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 */ - -#ifndef __PRDRTOKEN_H -#define __PRDRTOKEN_H - -/** - * @file prdrToken.H - * @brief Collect of function defines and includes for prdrcompiler. - */ - -//-------------------------------------------------------------------- -// Includes -//-------------------------------------------------------------------- - -#include -#include -#include - -#include -#include -#include -#include - -//-------------------------------------------------------------------- -// Forward References -//-------------------------------------------------------------------- - -extern int yylex(); -extern int yyparse(); -extern void yyerror(const char *); - -extern int yyline; -extern std::stack > yyincfiles; - -namespace PRDR_COMPILER -{ - -extern Chip * g_currentChip; - -} // end namespace PRDR_COMPILER - -#endif - diff --git a/src/usr/diag/prdf/common/framework/rule/prdrpp b/src/usr/diag/prdf/common/framework/rule/prdrpp deleted file mode 100755 index 77aa55aa3..000000000 --- a/src/usr/diag/prdf/common/framework/rule/prdrpp +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/perl -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/diag/prdf/common/framework/rule/prdrpp $ -# -# OpenPOWER HostBoot Project -# -# COPYRIGHT International Business Machines Corp. 2004,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 - -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"; - } - elsif ( $line =~ m{/\*[^\*].*\*/} ) - { - # Skip C-style (/* */) comments. This is needed to avoid prologs - # added to the extra signature .H files. - } - else - { - print $line; - } - } -} - -sub open_file -{ - my $filename = shift; - foreach my $dir (@search_dirs) - { - my $fileDirName = "$dir/$filename"; - if (-e $fileDirName) - { - open FILE, "< $fileDirName" || die "Error opening $fileDirName"; - read_file(\*FILE); - close FILE; - return; - } - } - print STDERR "prdrpp: $filename not found!\n"; -} diff --git a/src/usr/diag/prdf/common/framework/rule/tables.mk b/src/usr/diag/prdf/common/framework/rule/tables.mk deleted file mode 100755 index 225449dc3..000000000 --- a/src/usr/diag/prdf/common/framework/rule/tables.mk +++ /dev/null @@ -1,51 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/diag/prdf/common/framework/rule/tables.mk $ -# -# OpenPOWER HostBoot Project -# -# Contributors Listed Below - COPYRIGHT 2012,2015 -# [+] International Business Machines Corp. -# -# -# 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 - - -#------------------------------------------------------------------- -# To add a new chip, modify PRDR_RULE_TABLES line in prdf_rule.mk -# To change system type, modify VPATH line in rule/Makefile -#------------------------------------------------------------------- - -#------------------------------------------------------------------ -# 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. - -- cgit v1.2.1