diff options
author | CamVan Nguyen <ctnguyen@us.ibm.com> | 2012-04-16 16:49:12 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-04-19 17:11:31 -0500 |
commit | 4a47221cbf1a556c71e4a66b9742205e85b1c0a5 (patch) | |
tree | 781fd04735be8bb8a3c2306d1c2d300aa3daddc5 | |
parent | 3f89cb472a8fb434b27fb0a9be39f053c3efe48e (diff) | |
download | talos-hostboot-4a47221cbf1a556c71e4a66b9742205e85b1c0a5.tar.gz talos-hostboot-4a47221cbf1a556c71e4a66b9742205e85b1c0a5.zip |
Right justify SCOM data
Ability to specify search paths for include files
Change-Id: I0179b0bb81bf645b91fe2a3c25e763a71c3b1121
RTC: 40443
RTC: 40447
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/906
Tested-by: Jenkins Server
Reviewed-by: Douglas R. Gilbert <dgilbert@us.ibm.com>
Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
-rw-r--r-- | src/usr/hwpf/hwp/fapiHwpExecInitFile.C | 15 | ||||
-rwxr-xr-x | src/usr/hwpf/hwp/initfiles/sample.initfile | 15 | ||||
-rwxr-xr-x | src/usr/hwpf/ifcompiler/initCompiler.C | 13 | ||||
-rwxr-xr-x | src/usr/hwpf/ifcompiler/initCompiler.H | 2 | ||||
-rwxr-xr-x | src/usr/hwpf/ifcompiler/initCompiler.lex | 23 | ||||
-rw-r--r-- | src/usr/hwpf/makefile | 4 |
6 files changed, 49 insertions, 23 deletions
diff --git a/src/usr/hwpf/hwp/fapiHwpExecInitFile.C b/src/usr/hwpf/hwp/fapiHwpExecInitFile.C index ae354ad68..c3413283c 100644 --- a/src/usr/hwpf/hwp/fapiHwpExecInitFile.C +++ b/src/usr/hwpf/hwp/fapiHwpExecInitFile.C @@ -43,6 +43,7 @@ * camvanng 01/20/2012 Support for using a range * indexes for array attributes * mjjones 02/21/2012 Use new Target toEcmdString + * camvanng 04/12/2012 Right justify SCOM data */ #include <fapiHwpExecInitFile.H> @@ -1411,18 +1412,8 @@ fapi::ReturnCode writeScom(const ifData_t & i_ifData, const uint32_t i_scomNum, uint16_t l_offset = i_ifData.scoms[i_scomNum].offset; uint16_t l_len = i_ifData.scoms[i_scomNum].len; - if ((l_id & IF_TYPE_MASK) == IF_ATTR_TYPE) //It's an attribute - { - //Attribute data of different sizes is returned from getAttr - //as a 64bit right-justified number. - //Shift data to the right offset - l_data <<= (64 - (l_offset + l_len)); - } - else // It's a numerical literal - { - //Shift data to the right offset - l_data >>= l_offset; - } + //Shift data to the right offset; data is right aligned + l_data <<= (64 - (l_offset + l_len)); //Create mask uint64_t l_mask = 0; diff --git a/src/usr/hwpf/hwp/initfiles/sample.initfile b/src/usr/hwpf/hwp/initfiles/sample.initfile index f8cd0be75..093d912ba 100755 --- a/src/usr/hwpf/hwp/initfiles/sample.initfile +++ b/src/usr/hwpf/hwp/initfiles/sample.initfile @@ -19,11 +19,18 @@ SyntaxVersion = 1 #-- ----------------------------------------------------------------------------- #-- #-- Includes -#-- Note: Must include the path to the .define file. +#-- Note: +# Must specify the path to the .define file here; i.e. +# "include ./hwp/initfiles/sample.define" +# Or specify the directories to search for the include file (-I <path to search>) +# in priority order at the initCompiler command line; i.e. +# "initCompiler -init ./sample.initfile -outdir . -attr ./fapiAttributeIds.H \ +# -I hwp/initfiles -I hwp" +# #-- ----------------------------------------------------------------------------- #--****************************************************************************** #-- ----------------------------------------------------------------------------- -include ./hwp/initfiles/sample.define +include sample.define #-- ----------------------------------------------------------------------------- #--****************************************************************************** @@ -116,8 +123,8 @@ scom 0x0000000013013283 { bits , scom_data ; 0:11 , 0b001111001001 ; 12 , 0b1 ; - 13 , 0b1 ; - 14:59, 0b0000001100000110010000000000010000010010000000 ; + 13 , 0x1 ; + 14:59, 0x00c190010480 ; } #--****************************************************************************** diff --git a/src/usr/hwpf/ifcompiler/initCompiler.C b/src/usr/hwpf/ifcompiler/initCompiler.C index de8553e6c..36222c0e9 100755 --- a/src/usr/hwpf/ifcompiler/initCompiler.C +++ b/src/usr/hwpf/ifcompiler/initCompiler.C @@ -22,6 +22,7 @@ // andrewg 05/24/11 Port over for VPL/PgP // andrewg 09/19/11 Updates based on review // mjjones 11/17/11 Output attribute listing +// camvanng 04/12/12 Ability to specify search paths for include files // End Change Log ********************************************************************************* /** @@ -50,6 +51,7 @@ using namespace std; int yyline = 1; init::ScomList * yyscomlist = NULL; +vector<string> yyincludepath; //path to search for include files ostringstream init::dbg; ostringstream init::erros; @@ -204,6 +206,7 @@ Parser::Parser(int narg, char ** argv) else if (arg.compare(0,2,"-o") == 0) iv_outfile = argv[++i]; //dg003a else if (arg.compare(0,3,"-if") == 0) iv_source_path = argv[++i]; else if (arg.compare(0,3,"-ec") == 0) iv_ec = strtoul(argv[++i],NULL,16); //dg002a + else if (arg.compare(0,2, "-I") == 0) yyincludepath.push_back(argv[++i]); else if (arg.compare(0,9,"--compare") == 0) { compare.first = argv[++i]; @@ -253,6 +256,16 @@ Parser::Parser(int narg, char ** argv) stats << "* attr: " << attr_listing_fn() << endl; stats << "* binary: " << binseq_fn() << endl; + if (yyincludepath.size()) + { + stats << "* search paths for include files:" << endl; + for (size_t i = 0; i < yyincludepath.size(); i++) + { + stats << "* " << yyincludepath.at(i) << endl; + } + stats << "*" << endl; + } + iv_scomlist = new ScomList(iv_source_path, header_files, stats, iv_ec); //dg002c if(compare.second.size()) { diff --git a/src/usr/hwpf/ifcompiler/initCompiler.H b/src/usr/hwpf/ifcompiler/initCompiler.H index d49c8e136..afd804d01 100755 --- a/src/usr/hwpf/ifcompiler/initCompiler.H +++ b/src/usr/hwpf/ifcompiler/initCompiler.H @@ -25,6 +25,7 @@ // andrewg 05/24/11 Port over for VPL/PgP // andrewg 09/19/11 Updates based on review // mjjones 11/17/11 Output attribute listing +// camvanng 04/12/12 Ability to specify search paths for include files // End Change Log ********************************************************************************* /** @@ -48,6 +49,7 @@ extern FILE * yyin; extern int yyparse(); void yyerror(const char * s); extern init::ScomList * yyscomlist; +extern vector<string> yyincludepath; namespace init { diff --git a/src/usr/hwpf/ifcompiler/initCompiler.lex b/src/usr/hwpf/ifcompiler/initCompiler.lex index 39fec30bb..612f29601 100755 --- a/src/usr/hwpf/ifcompiler/initCompiler.lex +++ b/src/usr/hwpf/ifcompiler/initCompiler.lex @@ -30,6 +30,8 @@ // camvanng 02/07/12 Ability to #include common scom initfile defines // camvanng 02/14/12 Support binary and hex scom addresses // Support for array at beginning of scom address +// camvanng 04/12/12 Right justify SCOM data +// Ability to specify search paths for include files // End Change Log *********************************************************************************/ /** * @file initCompiler.lex @@ -71,6 +73,7 @@ bool g_equation = false; // equation inside scomv col std::string g_scomname; // dg02 extern int yyline; +extern std::vector<std::string> yyincludepath; #define MAX_INCLUDE_DEPTH 10 YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; @@ -133,6 +136,7 @@ MULTI_DIGIT [0-9]+ else { yy_delete_buffer(YY_CURRENT_BUFFER); + fclose(yyin); yy_switch_to_buffer(include_stack[include_stack_num]); } } @@ -168,7 +172,13 @@ include { BEGIN(incl); } YY_CURRENT_BUFFER; /* Switch input buffer */ - yyin = fopen( yytext, "r" ); + std::string filename = yytext; + yyin = fopen( filename.c_str(), "r" ); + for (size_t i = 0; (i < yyincludepath.size()) && (NULL == yyin); i++) + { + filename = yyincludepath.at(i) + "/" + yytext; + yyin = fopen( filename.c_str(), "r" ); + } if (NULL == yyin) { oss.str(""); @@ -176,6 +186,7 @@ include { BEGIN(incl); } lex_err(oss.str().c_str()); exit(1); } + printf("Include file %s\n", filename.c_str()); yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); BEGIN(INITIAL); @@ -375,11 +386,11 @@ void lex_err(const char *s ) std::cerr << "\nERROR: " << s << " -line " << yyline << std::endl; } -// Convert left justified bitstring to 64 bit integer +// Convert left justified bitstring to right-justified 64 bit integer uint64_t bits2int( const char * bitString) { uint32_t idx = 0; - uint64_t mask = 0x8000000000000000ull; + uint64_t mask = 0x0000000000000001ull; uint64_t val = 0; do { @@ -393,6 +404,7 @@ uint64_t bits2int( const char * bitString) while( bitString[idx] != 0 ) { + val <<= 1; char c = bitString[idx]; if( c == '1') val |= mask; else if(c != '0') @@ -401,7 +413,6 @@ uint64_t bits2int( const char * bitString) break; } ++idx; - mask >>= 1; } if(idx > 66) //dg01a 64bits + "0B" prefix lex_err("Bit string greater than 64 bits!"); @@ -410,7 +421,7 @@ uint64_t bits2int( const char * bitString) return val; } -// Convert left justified hex string to 64 bit integer +// Convert left justified hex string to 64 right-justified bit integer uint64_t hexs2int(const char * hexString, int32_t size) { uint64_t val = 0; @@ -420,7 +431,7 @@ uint64_t hexs2int(const char * hexString, int32_t size) lex_err("HEX literal greater than 64 bits"); size = 18; } - s.append(18-size,'0'); // 0x + 16 digits + s.insert(2, 18-size,'0'); // 0x + 16 digits val = strtoull(s.c_str(),NULL,16); return val; } diff --git a/src/usr/hwpf/makefile b/src/usr/hwpf/makefile index 832c2615a..7c0091bfe 100644 --- a/src/usr/hwpf/makefile +++ b/src/usr/hwpf/makefile @@ -51,6 +51,7 @@ HWP_ATTR_XML_FILES = hwp/memory_attributes.xml \ # Initfiles #------------------------------------------------------------------------------ HWP_INITFILES = hwp/initfiles/sample.initfile +HWP_IF_DEFINE_DIR = hwp/initfiles #------------------------------------------------------------------------------ # Generated files @@ -166,7 +167,8 @@ $(call GENTARGET, ${FAPI_ATTR_ID_TARGET} ${FAPI_ATTR_PLAT_CHECK_TARGET} \ #------------------------------------------------------------------------------ $(call GENTARGET, ${HWP_IF_ALL_TARGETS}) : \ ${GENDIR}/${IF_CMP_COMPILER_TARGET} ${HWP_INITFILES} ${GENDIR}/${FAPI_ATTR_ID_TARGET} - $< -init ${HWP_INITFILES} -outdir $(dir $@) -attr ${GENDIR}/${FAPI_ATTR_ID_TARGET} + $< -init ${HWP_INITFILES} -outdir $(dir $@) -attr ${GENDIR}/${FAPI_ATTR_ID_TARGET} \ + -I ${HWP_IF_DEFINE_DIR} ${EXTRA_PARTS}: ${IMGDIR}/% : ${GENDIR}/% cp -f $^ $@ |