diff options
author | CamVan Nguyen <ctnguyen@us.ibm.com> | 2012-06-19 00:51:48 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-06-26 13:53:55 -0500 |
commit | 2ca475148bef81d13f6d4bdfda376691c3a0f9d1 (patch) | |
tree | 328c58898b03b480d1670a1ff7682e7473d9a3e2 /src | |
parent | 280e4323aaed2d4d58ea738f9bd004281b606067 (diff) | |
download | talos-hostboot-2ca475148bef81d13f6d4bdfda376691c3a0f9d1.tar.gz talos-hostboot-2ca475148bef81d13f6d4bdfda376691c3a0f9d1.zip |
SCOM Initfile: Ability to do bitwise OR and AND operations
Change-Id: Ie3836bc2e3ca580761c71ea810cd9c6c55da54b6
RTC: 43757
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1220
Tested-by: Jenkins Server
Reviewed-by: Douglas R. Gilbert <dgilbert@us.ibm.com>
Reviewed-by: Andrew J. Geissler <andrewg@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/include/usr/hwpf/hwp/fapiHwpInitFileInclude.H | 52 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/fapiHwpExecInitFile.C | 11 | ||||
-rwxr-xr-x | src/usr/hwpf/hwp/initfiles/sample.initfile | 6 | ||||
-rwxr-xr-x | src/usr/hwpf/ifcompiler/initCompiler.lex | 3 | ||||
-rwxr-xr-x | src/usr/hwpf/ifcompiler/initCompiler.y | 5 | ||||
-rwxr-xr-x | src/usr/hwpf/ifcompiler/initRpn.C | 3 | ||||
-rw-r--r-- | src/usr/hwpf/test/hwpftest.H | 2 |
7 files changed, 53 insertions, 29 deletions
diff --git a/src/include/usr/hwpf/hwp/fapiHwpInitFileInclude.H b/src/include/usr/hwpf/hwp/fapiHwpInitFileInclude.H index e726c59bb..182c1f505 100644 --- a/src/include/usr/hwpf/hwp/fapiHwpInitFileInclude.H +++ b/src/include/usr/hwpf/hwp/fapiHwpInitFileInclude.H @@ -1,25 +1,26 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/include/usr/hwpf/hwp/fapiHwpInitFileInclude.H $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2011 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END +/* IBM_PROLOG_BEGIN_TAG + * This is an automatically generated prolog. + * + * $Source: src/include/usr/hwpf/hwp/fapiHwpInitFileInclude.H $ + * + * IBM CONFIDENTIAL + * + * COPYRIGHT International Business Machines Corp. 2011-2012 + * + * p1 + * + * Object Code Only (OCO) source materials + * Licensed Internal Code Source Materials + * IBM HostBoot Licensed Internal Code + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + * + * Origin: 30 + * + * IBM_PROLOG_END_TAG + */ /** * @file fapiHwpInitFileInclude.H * @@ -35,7 +36,8 @@ * attributes * camvanng 05/07/2012 Support for associated * target attributes - * + * camvanng 06/15/2012 Ability to do bitwise OR and + * AND operations */ #ifndef FAPIHWPINITFILEINCLUDE_H_ @@ -65,7 +67,9 @@ enum IfRpnOp SHIFTRIGHT = 0x00000011, FALSE_OP = 0x00000012, TRUE_OP = 0x00000013, - LAST_OP = 0x00000014, + BITWISEAND = 0x00000014, + BITWISEOR = 0x00000015, + LAST_OP = 0x00000016, PUSH_MASK = 0x000000C0, OP_MASK = 0x000000FF }; diff --git a/src/usr/hwpf/hwp/fapiHwpExecInitFile.C b/src/usr/hwpf/hwp/fapiHwpExecInitFile.C index 6c5d6040b..42fc1b766 100644 --- a/src/usr/hwpf/hwp/fapiHwpExecInitFile.C +++ b/src/usr/hwpf/hwp/fapiHwpExecInitFile.C @@ -57,6 +57,7 @@ * data column * SW146714 camvanng 06/08/2012 Use two bytes to store row * rpn sequence byte count + * camvanng 06/15/2012 Ability to do bitwise OR and AND operations */ #include <fapiHwpExecInitFile.H> @@ -1831,6 +1832,14 @@ uint64_t rpnBinaryOp(IfRpnOp i_op, uint64_t i_val1, uint64_t i_val2, result = i_val1 >> i_val2; break; + case (BITWISEAND): + result = i_val1 & i_val2; + break; + + case (BITWISEOR): + result = i_val1 | i_val2; + break; + default: FAPI_ERR("fapiHwpExecInitFile: rpnBinaryOp, invalid operator %d", i_op); @@ -1964,6 +1973,8 @@ fapi::ReturnCode rpnDoOp(rpnStack_t * io_rpnStack, IfRpnOp i_op, uint32_t i_any) case (MOD): case (SHIFTLEFT): case (SHIFTRIGHT): + case (BITWISEAND): + case (BITWISEOR): //pop the first value val2 = rpnPop(io_rpnStack); diff --git a/src/usr/hwpf/hwp/initfiles/sample.initfile b/src/usr/hwpf/hwp/initfiles/sample.initfile index d86be3957..6e3c0b178 100755 --- a/src/usr/hwpf/hwp/initfiles/sample.initfile +++ b/src/usr/hwpf/hwp/initfiles/sample.initfile @@ -131,9 +131,9 @@ scom 0x000000000006800c { scom 0x000000000006800c { bits , scom_data , expr ; - 24:31, (MBA1.ATTR_CHIP_UNIT_POS + SYS.ATTR_SCRATCH_UINT8_ARRAY_2[1][2][3]) , SYS.ATTR_SCRATCH_UINT8_1 != 1; - 24:31, (MBA1.ATTR_CHIP_UNIT_POS + SYS.ATTR_SCRATCH_UINT8_ARRAY_2[1][2][3] + 1) / 2, !(SYS.ATTR_SCRATCH_UINT8_1 == 3); - 32:63, (SYS.ATTR_SCRATCH_UINT32_1 * 20) << 8 , SYS.ATTR_SCRATCH_UINT32_1 == 3; + 24:31, (MBA1.ATTR_CHIP_UNIT_POS + SYS.ATTR_SCRATCH_UINT8_ARRAY_2[1][2][3]) , (SYS.ATTR_SCRATCH_UINT8_1 | 0b00000001) != 1; + 24:31, ((MBA1.ATTR_CHIP_UNIT_POS | SYS.ATTR_SCRATCH_UINT8_ARRAY_2[1][2][3]) + 1) / 2, !(SYS.ATTR_SCRATCH_UINT8_1 == 3); + 32:63, (((SYS.ATTR_SCRATCH_UINT32_1 * 20) & 0x000000F0)) << 8 , (SYS.ATTR_SCRATCH_UINT32_1 & 0x0000FFFF) == 3; } #--****************************************************************************** diff --git a/src/usr/hwpf/ifcompiler/initCompiler.lex b/src/usr/hwpf/ifcompiler/initCompiler.lex index 26574b632..a9b7e5bb3 100755 --- a/src/usr/hwpf/ifcompiler/initCompiler.lex +++ b/src/usr/hwpf/ifcompiler/initCompiler.lex @@ -44,6 +44,7 @@ // Save and restore line numbers for each include file // camvanng 05/22/12 Fix "OP" definition // camvanng 06/11/12 Fix shift/reduce warnings from yacc +// camvanng 06/15/12 Ability to do bitwise OR and AND operations // End Change Log *********************************************************************************/ /** * @file initCompiler.lex @@ -113,7 +114,7 @@ ID2 [A-Za-z][A-Za-z0-9_]*(\[[0-9]+(..[0-9]+)?(,[0-9]+(..[0-9]+)?)*\]){0,4} ID3 [0-9]+[A-Za-z_]+[0-9]* DIGIT [0-9] COMMENT #.*\n -OP "="|"+"|"-"|"!"|"<"|">"|"*"|"/"|"%" +OP "="|"+"|"-"|"!"|"<"|">"|"*"|"/"|"%"|"&"|"|" FLOAT [0-9]+"."[0-9]* BINARY 0[bB][0-1]+ SINGLE_BIN [0-1] diff --git a/src/usr/hwpf/ifcompiler/initCompiler.y b/src/usr/hwpf/ifcompiler/initCompiler.y index 62f534016..39254c2b3 100755 --- a/src/usr/hwpf/ifcompiler/initCompiler.y +++ b/src/usr/hwpf/ifcompiler/initCompiler.y @@ -41,6 +41,7 @@ // in the scom_data column // camvanng 06/11/12 Ability to do logical operations with attribute columns // Fix shift/reduce warnings from yacc +// camvanng 06/15/12 Ability to do bitwise OR and AND operations // End Change Log ********************************************************************************* /** * @file initCompiler.y @@ -263,6 +264,8 @@ scomdexpr: INIT_INTEGER { $$= new init::Rpn($1,yyscomlist->get_s | scomdexpr '*' scomdexpr { $$ = $1->push_merge($3,MULT); } | scomdexpr '/' scomdexpr { $$ = $1->push_merge($3,DIVIDE); } | scomdexpr '%' scomdexpr { $$ = $1->push_merge($3,MOD); } + | scomdexpr '&' scomdexpr { $$ = $1->push_merge($3,BITWISEAND); } + | scomdexpr '|' scomdexpr { $$ = $1->push_merge($3,BITWISEOR); } | '!' scomdexpr { $$ = $2->push_op(NOT); } | '(' scomdexpr ')' { $$ = $2; } ; @@ -330,6 +333,8 @@ expr: INIT_INTEGER { $$= new init::Rpn($1,yyscomlist->get_s | expr '*' expr { $$ = $1->push_merge($3,MULT); } | expr '/' expr { $$ = $1->push_merge($3,DIVIDE); } | expr '%' expr { $$ = $1->push_merge($3,MOD); } + | expr '&' expr { $$ = $1->push_merge($3,BITWISEAND); } + | expr '|' expr { $$ = $1->push_merge($3,BITWISEOR); } | '!' expr { $$ = $2->push_op(NOT); } | '(' expr ')' { $$ = $2; } ; diff --git a/src/usr/hwpf/ifcompiler/initRpn.C b/src/usr/hwpf/ifcompiler/initRpn.C index 2443ae9d4..75558428d 100755 --- a/src/usr/hwpf/ifcompiler/initRpn.C +++ b/src/usr/hwpf/ifcompiler/initRpn.C @@ -41,6 +41,7 @@ // camvanng 05/22/12 Ability to do simple operations on attributes // in the scom_data column // SW146714 camvanng 06/08/12 Use two bytes to store row rpn sequence byte count +// camvanng 06/15/12 Ability to do bitwise OR and AND operations // End Change Log ********************************************************************************* /** @@ -84,6 +85,8 @@ const char * OP_TXT[] = "SHIFTRIGHT", "FALSE", //dg003a "TRUE", //dg003a + "BITWISEAND", + "BITWISEOR", }; std::string Rpn::cv_empty_str; diff --git a/src/usr/hwpf/test/hwpftest.H b/src/usr/hwpf/test/hwpftest.H index 49dc4321f..7c36f26c0 100644 --- a/src/usr/hwpf/test/hwpftest.H +++ b/src/usr/hwpf/test/hwpftest.H @@ -296,7 +296,7 @@ public: {0x000000000006800b, 0, 0}, {0x000000000006800c, 0, (0x8000000000000000 >> 0x17) | (0x0000000000000060ll << (64 - (24 + 8))) | - 0x0000000000003C00}, + 0x0000000000003000}, {0x0000000013010002, 0, 0xAABBC00000000000}, {0x0000000013030007, 0, 0x00000CDE00000000}, {0x0000000013013283, 0, 0x3c90000000000000 | |