Skip to content

Commit 3ea9bd9

Browse files
committed
PRD: updates to prdfCalloutMap.H
Change-Id: Ia66755795db6cfc23cff381383640fb5bd9b3bb3 RTC: 137911 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/37306 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Benjamin J. Weisenbeck <bweisenb@us.ibm.com> Reviewed-by: Caleb N. Palmer <cnpalmer@us.ibm.com> Reviewed-by: Zane C. Shelley <zshelle@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/37600 Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
1 parent 24fea60 commit 3ea9bd9

File tree

4 files changed

+98
-77
lines changed

4 files changed

+98
-77
lines changed

src/usr/diag/prdf/common/framework/resolution/prdfCalloutMap.H

Lines changed: 76 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
//------------------------------------------------------------------------------
3434

35-
#ifndef PRDF_SIM_ENUMS // needed to compile prdfsimEnumMap.C
35+
#if !defined(PRDF_RULE_COMPILER_ENUMS) && !defined(PRDF_SIM_ENUMS)
3636
namespace PRDF
3737
{
3838
#endif
@@ -44,21 +44,27 @@ namespace PRDF
4444
// Used only in the rule compiler. Sets up a map between string keywords in
4545
// the rule code to the enum name.
4646

47-
#define PRDF_SYM_CALLOUT_MAP_BEGIN \
48-
struct SymCallout_t { const char * str; SymbolicFru val; }; \
49-
SymCallout_t symCalloutArray[] = \
50-
{
47+
#define PRDF_SYM_CALLOUT_MAP_BEGIN
5148

5249
#define PRDF_SYM_CALLOUT_ALIAS(name1, name2) \
53-
{ #name1 , name1 },
50+
g_ActionArgMap[ #name1 ] = name2;
51+
52+
#define PRDF_SYM_CALLOUT_MAP_END
5453

55-
#define PRDF_SYM_CALLOUT_MAP_END \
56-
{ NULL , (SymbolicFru) 0 } \
57-
};
5854

5955
#elif defined PRDF_SIM_ENUMS
6056

61-
// included from prdfsimEnumMap.C, nothing for now
57+
#define PRDF_SYM_CALLOUT_MAP_BEGIN \
58+
{ \
59+
ENUMNAMES * l_calloutEnum = new ENUMNAMES(); \
60+
ivEnumTypes["calloutNames"] = l_calloutEnum; \
61+
std::string s;
62+
63+
#define PRDF_SYM_CALLOUT_ALIAS(n1,n2) \
64+
s = #n1; ToUpper(s); ivEnumValue[s] = n2; (*l_calloutEnum)[n2] = s;
65+
66+
#define PRDF_SYM_CALLOUT_MAP_END \
67+
}
6268

6369
#else
6470

@@ -98,27 +104,31 @@ PRDF_SYM_CALLOUT_MAP_END
98104
// Used only in the rule compiler. Sets up a map between string keywords in
99105
// the rule code to the enum name.
100106

101-
#define PRDF_CALLOUT_PRIORITY_MAP_BEGIN \
102-
struct CalloutPriority_t \
103-
{ const char * str; CalloutPriorityEnum val; }; \
104-
CalloutPriority_t calloutPriorityArray[] = \
105-
{
107+
#define PRDF_CALLOUT_PRIORITY_MAP_BEGIN
106108

107109
#define PRDF_CALLOUT_PRIORITY_ALIAS(name1, name2) \
108-
{ #name1 , name1 },
110+
g_ActionArgMap[ #name1 ] = name2;
109111

110-
#define PRDF_CALLOUT_PRIORITY_MAP_END \
111-
{ NULL , (CalloutPriorityEnum) 0 } \
112-
};
112+
#define PRDF_CALLOUT_PRIORITY_MAP_END
113113

114114
#elif defined PRDF_SIM_ENUMS
115115

116-
// included from prdfsimEnumMap.C, nothing for now
116+
#define PRDF_CALLOUT_PRIORITY_MAP_BEGIN \
117+
{ \
118+
ENUMNAMES * l_priorityEnum = new ENUMNAMES(); \
119+
ivEnumTypes["priorityNames"] = l_priorityEnum; \
120+
std::string s;
121+
122+
#define PRDF_CALLOUT_PRIORITY_ALIAS(n1,n2) \
123+
s = #n1; ToUpper(s); ivEnumValue[s] = n2; (*l_priorityEnum)[n2] = s;
124+
125+
#define PRDF_CALLOUT_PRIORITY_MAP_END \
126+
}
117127

118128
#else
119129

120130
#define PRDF_CALLOUT_PRIORITY_MAP_BEGIN \
121-
enum CalloutPriorityEnum \
131+
enum PRDpriority \
122132
{
123133

124134
#define PRDF_CALLOUT_PRIORITY_ALIAS(n1,n2) \
@@ -146,7 +156,51 @@ PRDF_CALLOUT_PRIORITY_MAP_END
146156

147157
//------------------------------------------------------------------------------
148158

149-
#ifndef PRDF_SIM_ENUMS
159+
#ifdef PRDF_RULE_COMPILER_ENUMS
160+
161+
#define PRDF_TARGET_TYPE_ALIAS(n1, n2) \
162+
g_ActionArgMap[ #n1 ] = n2;
163+
164+
#elif defined PRDF_SIM_ENUMS
165+
166+
#define PRDF_TARGET_TYPE_ALIAS(n1, n2) \
167+
ivEnumValue[ #n1 ] = n2;
168+
169+
#else
170+
171+
#define PRDF_TARGET_TYPE_ALIAS(n1, n2)
172+
173+
#endif
174+
175+
PRDF_TARGET_TYPE_ALIAS( TYPE_SYS, TARGETING::TYPE_SYS )
176+
PRDF_TARGET_TYPE_ALIAS( TYPE_NODE, TARGETING::TYPE_NODE )
177+
PRDF_TARGET_TYPE_ALIAS( TYPE_PROC, TARGETING::TYPE_PROC )
178+
PRDF_TARGET_TYPE_ALIAS( TYPE_EQ, TARGETING::TYPE_EQ )
179+
PRDF_TARGET_TYPE_ALIAS( TYPE_EX, TARGETING::TYPE_EX )
180+
PRDF_TARGET_TYPE_ALIAS( TYPE_CORE, TARGETING::TYPE_CORE )
181+
PRDF_TARGET_TYPE_ALIAS( TYPE_CAPP, TARGETING::TYPE_CAPP )
182+
PRDF_TARGET_TYPE_ALIAS( TYPE_PEC, TARGETING::TYPE_PEC )
183+
PRDF_TARGET_TYPE_ALIAS( TYPE_PHB, TARGETING::TYPE_PHB )
184+
PRDF_TARGET_TYPE_ALIAS( TYPE_OBUS, TARGETING::TYPE_OBUS )
185+
PRDF_TARGET_TYPE_ALIAS( TYPE_XBUS, TARGETING::TYPE_XBUS )
186+
PRDF_TARGET_TYPE_ALIAS( TYPE_NX, TARGETING::TYPE_NX )
187+
PRDF_TARGET_TYPE_ALIAS( TYPE_OCC, TARGETING::TYPE_OCC )
188+
PRDF_TARGET_TYPE_ALIAS( TYPE_PSI, TARGETING::TYPE_PSI )
189+
PRDF_TARGET_TYPE_ALIAS( TYPE_MCBIST, TARGETING::TYPE_MCBIST )
190+
PRDF_TARGET_TYPE_ALIAS( TYPE_MCS, TARGETING::TYPE_MCS )
191+
PRDF_TARGET_TYPE_ALIAS( TYPE_MCA, TARGETING::TYPE_MCA )
192+
PRDF_TARGET_TYPE_ALIAS( TYPE_MEMBUF, TARGETING::TYPE_MEMBUF )
193+
PRDF_TARGET_TYPE_ALIAS( TYPE_L4, TARGETING::TYPE_L4 )
194+
PRDF_TARGET_TYPE_ALIAS( TYPE_MBA, TARGETING::TYPE_MBA )
195+
PRDF_TARGET_TYPE_ALIAS( TYPE_DIMM, TARGETING::TYPE_DIMM )
196+
PRDF_TARGET_TYPE_ALIAS( TYPE_OSCREFCLK, TARGETING::TYPE_OSCREFCLK )
197+
PRDF_TARGET_TYPE_ALIAS( TYPE_NA, TARGETING::TYPE_NA )
198+
199+
#undef PRDF_TARGET_TYPE_ALIAS
200+
201+
//------------------------------------------------------------------------------
202+
203+
#if !defined(PRDF_RULE_COMPILER_ENUMS) && !defined(PRDF_SIM_ENUMS)
150204
} // end namespace PRDF
151205
#endif
152206

src/usr/diag/prdf/common/framework/resolution/prdfCallouts.H

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* */
66
/* OpenPOWER HostBoot Project */
77
/* */
8-
/* Contributors Listed Below - COPYRIGHT 2012,2016 */
8+
/* Contributors Listed Below - COPYRIGHT 2012,2017 */
99
/* [+] International Business Machines Corp. */
1010
/* */
1111
/* */
@@ -30,7 +30,7 @@
3030
// Includes
3131
//------------------------------------------------------------------------------
3232

33-
#include <prdfCalloutMap.H>
33+
#include <prdfCalloutMap.H> // for enums
3434
#include <prdfCalloutsData.H>
3535
#include <prdfEnums.H>
3636
#include <prdfMemoryMru.H>
@@ -41,8 +41,6 @@ namespace PRDF
4141

4242
//------------------------------------------------------------------------------
4343

44-
typedef CalloutPriorityEnum PRDpriority;
45-
4644
/**
4745
* @brief Wrapper class for PRD callouts (TargetHandle_t, MemoryMru, and
4846
* SymbolicFru).

src/usr/diag/prdf/common/rule/prdfRuleMetaData.C

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -941,42 +941,42 @@ Resolution * RuleMetaData::createResolution( Prdr::Expr * i_action,
941941
{
942942
case Prdr::CALLOUT_GARD_CHIP: // connected callout with gard
943943
l_rc = &i_data.cv_reslFactory.getConnCalloutGardResol(
944-
(TARGETING::TYPE) i_action->cv_value[2].i,
945-
i_action->cv_value[3].i,
946-
(CalloutPriorityEnum) i_action->cv_value[1].i,
944+
(TARGETING::TYPE) i_action->cv_value[2].i,
945+
i_action->cv_value[3].i,
946+
(PRDpriority) i_action->cv_value[1].i,
947947
( NULL == i_action->cv_value[4].p ? NULL :
948948
( this->createResolution(
949949
i_action->cv_value[4].p, i_data ) ) ),
950-
TARGETING::TYPE_NA,
951-
(GARD_POLICY) i_action->cv_value[6].i );
950+
TARGETING::TYPE_NA,
951+
(GARD_POLICY) i_action->cv_value[6].i );
952952
break;
953953

954954
// connected callout and gard with connection type
955955
case Prdr::CALLOUT_GARD_PEER:
956956
l_rc = &i_data.cv_reslFactory.getConnCalloutGardResol(
957-
(TARGETING::TYPE) i_action->cv_value[2].i,
958-
i_action->cv_value[3].i,
959-
(CalloutPriorityEnum) i_action->cv_value[1].i,
957+
(TARGETING::TYPE) i_action->cv_value[2].i,
958+
i_action->cv_value[3].i,
959+
(PRDpriority) i_action->cv_value[1].i,
960960
( NULL == i_action->cv_value[4].p ? NULL :
961961
( this->createResolution(
962962
i_action->cv_value[4].p, i_data ) ) ),
963-
(TARGETING::TYPE) i_action->cv_value[5].i,
964-
(GARD_POLICY) i_action->cv_value[6].i );
963+
(TARGETING::TYPE) i_action->cv_value[5].i,
964+
(GARD_POLICY) i_action->cv_value[6].i );
965965

966966
break;
967967

968968
case Prdr::CALLOUT_PROC: // Procedure callout
969969
l_rc = &i_data.cv_reslFactory.getCalloutGardResol(
970970
(SymbolicFru) i_action->cv_value[2].i,
971-
(CalloutPriorityEnum) i_action->cv_value[1].i,
971+
(PRDpriority) i_action->cv_value[1].i,
972972
(GARD_POLICY) i_action->cv_value[6].i );
973973
break;
974974

975975
case Prdr::CALLOUT_GARD_SELF: // self callout with gard option
976976
default:
977977
l_rc = &i_data.cv_reslFactory.getCalloutGardResol(
978-
NULL ,
979-
(CalloutPriorityEnum) i_action->cv_value[1].i,
978+
NULL,
979+
(PRDpriority) i_action->cv_value[1].i,
980980
(GARD_POLICY) i_action->cv_value[6].i );
981981
break;
982982

src/usr/diag/prdf/common/rule/prdrCompile.C

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* */
66
/* OpenPOWER HostBoot Project */
77
/* */
8-
/* Contributors Listed Below - COPYRIGHT 2016 */
8+
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
99
/* [+] International Business Machines Corp. */
1010
/* */
1111
/* */
@@ -39,7 +39,7 @@
3939
#include <prdrCommon.H>
4040
#include <prdrToken.H>
4141
#include <UtilHash.H>
42-
#include <prdfEnums.H>
42+
#include <prdfCalloutMap.H> // for enums
4343

4444
using namespace PRDR_COMPILER;
4545

@@ -404,12 +404,6 @@ uint32_t prdrCaptureTypeMap(const std::string & i_arg)
404404

405405
} // end namespace PRDR_COMPILER
406406

407-
#include <prdfCalloutMap.H> // for enums
408-
#undef __prdfCalloutMap_H
409-
#define PRDF_RULE_COMPILER_ENUMS
410-
#include <prdfCalloutMap.H> // for string-to-enum arrays
411-
#undef PRDF_RULE_COMPILER_ENUMS
412-
413407
namespace PRDR_COMPILER
414408
{
415409

@@ -427,36 +421,11 @@ uint32_t prdrActionArgMap(const std::string & i_arg)
427421
if (l_initialized)
428422
break;
429423

430-
// Initialize Callout priorities.
431-
for (CalloutPriority_t * i = calloutPriorityArray; NULL != i->str; i++)
432-
{
433-
g_ActionArgMap[i->str] = i->val;
434-
}
435-
436-
// Initialize target types.
437-
g_ActionArgMap["TYPE_PROC"] = TARGETING::TYPE_PROC;
438-
g_ActionArgMap["TYPE_EQ"] = TARGETING::TYPE_EQ;
439-
g_ActionArgMap["TYPE_EX"] = TARGETING::TYPE_EX;
440-
g_ActionArgMap["TYPE_CORE"] = TARGETING::TYPE_CORE;
441-
g_ActionArgMap["TYPE_CAPP"] = TARGETING::TYPE_CAPP;
442-
g_ActionArgMap["TYPE_PEC"] = TARGETING::TYPE_PEC;
443-
g_ActionArgMap["TYPE_PHB"] = TARGETING::TYPE_PHB;
444-
g_ActionArgMap["TYPE_OBUS"] = TARGETING::TYPE_OBUS;
445-
g_ActionArgMap["TYPE_XBUS"] = TARGETING::TYPE_XBUS;
446-
g_ActionArgMap["TYPE_MCBIST"] = TARGETING::TYPE_MCBIST;
447-
g_ActionArgMap["TYPE_MCS"] = TARGETING::TYPE_MCS;
448-
g_ActionArgMap["TYPE_MCA"] = TARGETING::TYPE_MCA;
449-
g_ActionArgMap["TYPE_MEMBUF"] = TARGETING::TYPE_MEMBUF;
450-
g_ActionArgMap["TYPE_L4"] = TARGETING::TYPE_L4;
451-
g_ActionArgMap["TYPE_MBA"] = TARGETING::TYPE_MBA;
452-
g_ActionArgMap["TYPE_DIMM"] = TARGETING::TYPE_DIMM;
453-
g_ActionArgMap["TYPE_NA"] = TARGETING::TYPE_NA;
454-
455-
// Initialize symbolic callouts.
456-
for ( SymCallout_t * i = symCalloutArray; NULL != i->str; i++ )
457-
{
458-
g_ActionArgMap[i->str] = i->val;
459-
}
424+
// Include procedure callouts, callout priorities, and target types.
425+
#define PRDF_RULE_COMPILER_ENUMS
426+
#undef __prdfCalloutMap_H
427+
#include <prdfCalloutMap.H> // for string-to-enum map
428+
#undef PRDF_RULE_COMPILER_ENUMS
460429

461430
// Initialize SDC Flags.
462431
// FIXME: RTC 119976

0 commit comments

Comments
 (0)