diff options
author | Mike Jones <mjjones@us.ibm.com> | 2012-04-10 16:01:57 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-04-16 12:09:33 -0500 |
commit | 0bae1b9d0f250bea887d930ecc8da99986fab463 (patch) | |
tree | ba3f53903e80cebe2e6816bad724253302564617 /src/usr/hwpf/ifcompiler | |
parent | 3cad095a5c2a1c6e70e56d5b7be773d148d86844 (diff) | |
download | blackbird-hostboot-0bae1b9d0f250bea887d930ecc8da99986fab463.tar.gz blackbird-hostboot-0bae1b9d0f250bea887d930ecc8da99986fab463.zip |
HWPF: Use fixed enum values for generated error/attr enums
Change-Id: Id0552daad9e6d9907cef7fa013fc6d75dbc8e185
RTC: 39175
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/879
Tested-by: Jenkins Server
Reviewed-by: Van H. Lee <vanlee@us.ibm.com>
Reviewed-by: CAMVAN T. NGUYEN <ctnguyen@us.ibm.com>
Reviewed-by: Brian H. Horton <brianh@linux.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/ifcompiler')
-rwxr-xr-x | src/usr/hwpf/ifcompiler/initSymbols.C | 77 | ||||
-rwxr-xr-x | src/usr/hwpf/ifcompiler/initSymbols.H | 8 |
2 files changed, 33 insertions, 52 deletions
diff --git a/src/usr/hwpf/ifcompiler/initSymbols.C b/src/usr/hwpf/ifcompiler/initSymbols.C index 68e18f01c..f2cb9c2c7 100755 --- a/src/usr/hwpf/ifcompiler/initSymbols.C +++ b/src/usr/hwpf/ifcompiler/initSymbols.C @@ -24,6 +24,7 @@ // mjjones 11/17/11 Output attribute listing // camvanng 11/17/11 Support for system & target attributes // camvanng 01/07/12 Support for writing an attribute to a SCOM register +// camvanng 04/10/12 Support fixed attribute enum value // End Change Log ********************************************************************************* /** @@ -85,45 +86,30 @@ Symbols::Symbols(FILELIST & i_filenames) getline(infs,fileline); getline(infs,fileline); - // We're just parsing the enum in order so attribute id start - // at 0 and increment by 1 after that. - uint32_t attrId = 0; - while(fileline[0] != '}') { istringstream attr_stream(fileline); string attr; + char tempChar = 0; + uint32_t attrId = 0; + + // Read the attribute name attr_stream >> attr; - // Strip off the "," at the end. - size_t pos = attr.find(','); - if(pos != string::npos) - { - attr = attr.substr(0,attr.length()-1); - } + // Read and ignore the '=' '0' 'x' characters + attr_stream >> tempChar; + attr_stream >> tempChar; + attr_stream >> tempChar; - //printf("Attribute String:%s\n",attr.c_str()); - // We now have the first attribute loaded into attr - // Get an index for the string + // Read the attribute ID + attr_stream >> hex >> attrId; + // Store the value iv_symbols[attr] = MAP_DATA(attrId,NOT_USED); + iv_symbols[SYS_ATTR + attr] = MAP_DATA(attrId,NOT_USED); - attrId++; getline(infs,fileline); } - - //Create system attribute for each of the attribute found - //Assign them unique attribute ids - SYMBOL_MAP::iterator itr = iv_symbols.begin(); - uint32_t size = iv_symbols.size(); - for(uint32_t j = 0; j < size; ++j) - { - string sysAttr = SYS_ATTR + (*itr).first; - //printf("\n\n\nsysAttr %s", sysAttr.c_str()); - iv_symbols[sysAttr] = MAP_DATA(attrId,NOT_USED); - attrId++; - itr++; - } } else { @@ -388,7 +374,6 @@ uint32_t Symbols::add_undefined(const string & i_symbol) uint16_t Symbols::get_tag(uint32_t i_rpn_id) { uint16_t tag = NOT_FOUND; - uint32_t cini_id = CINI_ID_NOT_FOUND; // Set up tag table if not already setup if(iv_used_var.size() == 0) @@ -405,13 +390,18 @@ uint16_t Symbols::get_tag(uint32_t i_rpn_id) { if(i->second.second != NOT_USED) { + //printf("Symbols::get_tag adding rpn_id[0x%x]\n", i->second.second); + if((i->second.first & CINI_LIT_MASK) == CINI_LIT_MASK) { iv_used_lit.push_back(i->second.first); + //printf("Symbols::get_tag added to iv_used_lit[0x%x]\n", iv_used_lit.back()); } else //VAR { - iv_used_var.push_back(RPN_DATA(find_text(i->second.first), i->second.first)); + iv_used_var.push_back(RPN_DATA(i->first, i->second.first)); + //printf("Symbols::get_tag added to iv_used_var[%s, 0x%x]\n", + // iv_used_var.back().first.c_str(), iv_used_var.back().second); } } } @@ -419,12 +409,8 @@ uint16_t Symbols::get_tag(uint32_t i_rpn_id) do { - RPN_MAP::iterator rm = iv_rpn_map.find(i_rpn_id); - if(rm != iv_rpn_map.end()) - { - cini_id = (rm->second).second; - } - else + string name = find_name(i_rpn_id); + if ("NOT_FOUND" == name) { //SYMBOL_MAP::iterator sm = iv_not_found.begin(); //for(; sm != iv_not_found.end(); ++sm) @@ -448,14 +434,14 @@ uint16_t Symbols::get_tag(uint32_t i_rpn_id) uint32_t offset = 0; for(VAR_SYMBOL_USED::iterator i = iv_used_var.begin(); i != iv_used_var.end(); ++i,++offset) { - if(cini_id == (*i).second) + if (name == (*i).first) { tag = (uint16_t) (offset | IF_ATTR_TYPE); - if ((*i).first.compare(0, 4, SYS_ATTR) == 0) + if (name.compare(0, 4, SYS_ATTR) == 0) { tag |= IF_SYS_ATTR_MASK; - //printf ("get tag: %s tag 0x%x\n", (*i).first.c_str(), tag); + //printf ("get tag: %s tag 0x%x\n", name.c_str(), tag); } break; @@ -606,6 +592,8 @@ string Symbols::find_text(uint32_t i_cini_id) else if(i_cini_id == SYM_EXPR) name = "EXPR"; else { + //NOTE: if there are multiple elements of the same cini_id, then this function will return the + //first element found for(SYMBOL_MAP::const_iterator i = iv_symbols.begin(); i != iv_symbols.end(); ++i) { //printf("SYMBOL:%s\n",i->first.c_str()); @@ -873,16 +861,10 @@ uint32_t Symbols::bin_vars(BINSEQ & blist) string name = (*i).first; uint32_t attrId = (*i).second; - // If sys attribute, use same attribute id as target attribute - if (name.compare(0, 4, SYS_ATTR) == 0) - { - attrId = iv_symbols[name.substr(4)].first; - } - Rpn::set8(blist,iv_attr_type[name]); Rpn::set32(blist,attrId); - //printf("Symbols::bin_vars: Just wrote out type:%u index:%u\n",iv_attr_type[name],attrId); + //printf("Symbols::bin_vars: Just wrote out type:%u attrId:0x%x\n",iv_attr_type[name],attrId); } return count; } @@ -1034,13 +1016,12 @@ uint32_t Symbols::get_rpn_id(uint32_t bin_tag) uint32_t rpn_id = NOT_FOUND; uint32_t type = bin_tag & IF_TYPE_MASK; uint32_t offset = bin_tag & ~IF_TYPE_MASK; - uint32_t cini_id = 0; + //uint32_t cini_id = 0; switch(type) { case IF_ATTR_TYPE: { offset &= ~IF_SYS_ATTR_MASK; - cini_id = iv_used_var[offset].second; - string name = find_text(cini_id); + string name = iv_used_var[offset].first; rpn_id = use_symbol(name); } break; diff --git a/src/usr/hwpf/ifcompiler/initSymbols.H b/src/usr/hwpf/ifcompiler/initSymbols.H index dc77a9425..d3b957ebb 100755 --- a/src/usr/hwpf/ifcompiler/initSymbols.H +++ b/src/usr/hwpf/ifcompiler/initSymbols.H @@ -236,8 +236,8 @@ namespace init private: //data // map | symbol name | (cini_id, usage flags) | - typedef pair<uint32_t,uint32_t> MAP_DATA; - typedef map<string,MAP_DATA > SYMBOL_MAP; + typedef pair<uint32_t,uint32_t> MAP_DATA; //cini_id & corresponding rpn_id/NOT_USED + typedef map<string,MAP_DATA > SYMBOL_MAP; //attr name & corresponding cini_id, rpn_id/NOT_USED pair typedef map<string,uint32_t> SPY_MAP; typedef map<string,uint32_t> SYMBOL_ATTR_TYPE; typedef map<string,uint64_t> SYMBOL_ATTR_ENUM; @@ -245,8 +245,8 @@ namespace init typedef pair<Rpn,uint32_t> DEF_DATA; typedef map<string,DEF_DATA> DEF_MAP; - typedef pair<string,uint32_t> RPN_DATA; - typedef map<uint32_t,RPN_DATA> RPN_MAP; + typedef pair<string,uint32_t> RPN_DATA; //attribute name & corresponding cini_id + typedef map<uint32_t,RPN_DATA> RPN_MAP; //attr name & corresponding attr name, cini_id pair typedef vector<RPN_DATA> VAR_SYMBOL_USED; typedef vector<uint32_t> SYMBOL_USED; |