diff options
-rwxr-xr-x | src/build/ifcompiler/makefile | 48 | ||||
-rwxr-xr-x | src/build/ifcompiler/sample.initfile | 133 | ||||
-rw-r--r-- | src/build/makefile | 2 | ||||
-rw-r--r-- | src/makefile | 2 | ||||
-rwxr-xr-x | src/usr/hwpf/fapi/fapiCreateIfAttrService.pl | 264 | ||||
-rwxr-xr-x | src/usr/hwpf/fapi/fapiParseAttributeInfo.pl | 95 | ||||
-rwxr-xr-x | src/usr/hwpf/hwp/fapiTestHwpAttr.C | 50 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/initfiles/makefile | 44 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/makefile | 1 | ||||
-rwxr-xr-x | src/usr/hwpf/ifcompiler/initCompiler.C (renamed from src/build/ifcompiler/initCompiler.C) | 9 | ||||
-rwxr-xr-x | src/usr/hwpf/ifcompiler/initCompiler.H (renamed from src/build/ifcompiler/initCompiler.H) | 4 | ||||
-rwxr-xr-x | src/usr/hwpf/ifcompiler/initCompiler.lex (renamed from src/build/ifcompiler/initCompiler.lex) | 0 | ||||
-rwxr-xr-x | src/usr/hwpf/ifcompiler/initCompiler.y (renamed from src/build/ifcompiler/initCompiler.y) | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | src/usr/hwpf/ifcompiler/initRpn.C (renamed from src/build/ifcompiler/initRpn.C) | 0 | ||||
-rwxr-xr-x | src/usr/hwpf/ifcompiler/initRpn.H (renamed from src/build/ifcompiler/initRpn.H) | 0 | ||||
-rwxr-xr-x | src/usr/hwpf/ifcompiler/initScom.C (renamed from src/build/ifcompiler/initScom.C) | 8 | ||||
-rwxr-xr-x | src/usr/hwpf/ifcompiler/initScom.H (renamed from src/build/ifcompiler/initScom.H) | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | src/usr/hwpf/ifcompiler/initSymbols.C (renamed from src/build/ifcompiler/initSymbols.C) | 19 | ||||
-rwxr-xr-x | src/usr/hwpf/ifcompiler/initSymbols.H (renamed from src/build/ifcompiler/initSymbols.H) | 2 | ||||
-rw-r--r-- | src/usr/hwpf/makefile | 140 | ||||
-rw-r--r-- | src/usr/initservice/extinitsvc/extinitsvctasks.H | 15 |
21 files changed, 446 insertions, 392 deletions
diff --git a/src/build/ifcompiler/makefile b/src/build/ifcompiler/makefile deleted file mode 100755 index 737c8004d..000000000 --- a/src/build/ifcompiler/makefile +++ /dev/null @@ -1,48 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/build/ifcompiler/makefile $ -# -# 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 -# add a -d to flex for debug output -# ./bin/initCompiler -init ./sample.initfile -outdir . --debug -attr ./fapiAttributeIds.H - -ROOTPATH = ../../.. - -y.tab.%: initCompiler.y - yacc -d initCompiler.y - -lex.yy.c: initCompiler.lex - flex initCompiler.lex - -bin/initCompiler: y.tab.c y.tab.h lex.yy.c initCompiler.C initCompiler.H initRpn.C initRpn.H initScom.C initScom.H initSymbols.C initSymbols.H - mkdir -p bin; g++ initCompiler.C lex.yy.c y.tab.c initRpn.C initScom.C initSymbols.C -I ./ -I ${ROOTPATH}/src/include/usr/hwpf/hwp/ -o ./bin/initCompiler - -ifcompiler: bin/initCompiler - -all: gen_pass - -code_pass: - -gen_pass: ifcompiler - -clean: - rm -f ./bin/initCompiler lex.yy.c y.tab.* -beam: - diff --git a/src/build/ifcompiler/sample.initfile b/src/build/ifcompiler/sample.initfile deleted file mode 100755 index deef9ba97..000000000 --- a/src/build/ifcompiler/sample.initfile +++ /dev/null @@ -1,133 +0,0 @@ -#-- $Id: sample.initfile,v 1.1 2011/07/13 16:03:44 andrewg Exp $ -#-- CHANGE HISTORY: -#-------------------------------------------------------------------------------- -#-- Version:|Author: | Date: | Comment: -#-- --------|--------|--------|-------------------------------------------------- -#-- 0.01|andrewg |05/24/11|Created sample file -#-- --------|--------|--------|-------------------------------------------------- -#-------------------------------------------------------------------------------- -# End of revision history -#-------------------------------------------------------------------------------- - -#--Master list of variables that can be used in this file is at: -#--<Attribute Definition Location> - -SyntaxVersion = 1 - -#-- ----------------------------------------------------------------------------- -#--****************************************************************************** -#-- ----------------------------------------------------------------------------- -#-- -#-- Defines -#-- -#-- ----------------------------------------------------------------------------- -#--****************************************************************************** -#-- ----------------------------------------------------------------------------- - -define def_equal_test = (ATTR_SCRATCH_UINT32_1 == ATTR_SCRATCH_UINT32_2); -define def_not_equal_test = (ATTR_SCRATCH_UINT64_1 != ATTR_SCRATCH_UINT64_2); - - -#--****************************************************************************** -#-- Basic SCOM -#--****************************************************************************** -scom 0x0000000000000001 { - scom_data ; - 0x0000000000000181 ; -} - -#--****************************************************************************** -#-- Basic SCOM with Expression and Attribute -#--****************************************************************************** - -scom 0x0000000000000002 { - scom_data, expr ; - 0x0000000000000182, ATTR_SCRATCH_UINT8_1 == ATTR_SCRATCH_UINT8_2 ; -} - -#--****************************************************************************** -#-- Basic SCOM with Array In Middle -#--****************************************************************************** - -scom 0x000000000(ABC,BCD)0003 { - scom_data ; - 0x0000000000000183 ; -} - -#--****************************************************************************** -#-- Basic SCOM with define used -#--****************************************************************************** - -scom 0x0000000000000004 { - scom_data, expr ; - 0x0000000000000184, def_equal_test ; -} - -#--****************************************************************************** -#-- Basic SCOM with a single bit set -#--****************************************************************************** - -scom 0x0000000000000005 { - bits , scom_data ; - 23 , 0b1 ; -} - -#--****************************************************************************** -#-- Basic SCOM with bits -#--****************************************************************************** - -scom 0x0000000000000006 { - bits , scom_data ; - 0:11 , 0b001111001001 ; - 12 , 0b1 ; - 13 , 0b1 ; - 14:59, 0b0000001100000110010000000000010000010010000000 ; -} - -#--****************************************************************************** -#-- Complext SCOM with Bit Support, define, and attributes -#--****************************************************************************** - -scom 0x0000000000000007 { - bits , scom_data, expr ; - 0:11 , 0b001111001001, any ; - 12 , 0b1, def_equal_test ; - 12 , 0b0, def_not_equal_test ; - 13 , 0b1, ATTR_SCRATCH_UINT8_1 > ATTR_SCRATCH_UINT8_2 ; - 14:59, 0b0000001100000110010000000000010000010010000000, ATTR_SCRATCH_UINT64_1 == ATTR_SCRATCH_UINT64_2 ; -} - -#--****************************************************************************** -#-- Complex SCOM with Bit Support, and logical operators -#--****************************************************************************** - -scom 0x0000000000000009 { - bits , scom_data, expr ; - 12 , 0b1, def_equal_test && def_not_equal_test ; - 12 , 0b0, def_equal_test || def_not_equal_test ; - 14 , 0b1, ATTR_SCRATCH_UINT32_1 < ATTR_SCRATCH_UINT32_2 ; - 15 , 0b1, ATTR_SCRATCH_UINT32_1 > ATTR_SCRATCH_UINT32_2 ; - 16 , 0b1, ATTR_SCRATCH_UINT32_1 >= ATTR_SCRATCH_UINT32_2 ; - 17 , 0b1, ATTR_SCRATCH_UINT32_1 <= ATTR_SCRATCH_UINT32_2 ; - 18 , 0b1, ATTR_SCRATCH_UINT32_1 == ATTR_SCRATCH_UINT32_2 ; - 19 , 0b1, ATTR_SCRATCH_UINT32_1 != ATTR_SCRATCH_UINT32_2 ; - 20 , 0b1, (ATTR_SCRATCH_UINT32_1 + ATTR_SCRATCH_UINT32_2) == 4 ; - 21:59, 0b000000110000011001000000000001000001001, ATTR_SCRATCH_UINT8_1 == ATTR_SCRATCH_UINT8_2 ; -} - -#--****************************************************************************** -#-- SCOM with 'ec' column - Use scratch for now since all attributes work -#--****************************************************************************** - -scom 0x000000000000000A { - scom_data, ATTR_SCRATCH_UINT32_1 ; - 0x0000000000000192, 1 ; -} - -#--****************************************************************************** -#-- Basic SCOM with an array -#--****************************************************************************** -scom 0x000000000000000B { - scom_data, expr ; - 0x0000000000000182, ATTR_SCRATCH_UINT8_ARRAY_1[2] == ATTR_SCRATCH_UINT8_1 ; -} diff --git a/src/build/makefile b/src/build/makefile index bcbe5f5ec..9cc2341ff 100644 --- a/src/build/makefile +++ b/src/build/makefile @@ -22,6 +22,6 @@ # IBM_PROLOG_END ROOTPATH = ../.. -SUBDIRS = linker.d tocgen.d ifcompiler.d +SUBDIRS = linker.d tocgen.d include ${ROOTPATH}/config.mk diff --git a/src/makefile b/src/makefile index 66f795e1d..56c0c8224 100644 --- a/src/makefile +++ b/src/makefile @@ -46,7 +46,7 @@ RUNTIME_OBJECTS = BASE_MODULES = trace errl devicefw scom xscom initservice taskargs \ pnor i2c fsi vfs -EXTENDED_MODULES = targeting ecmddatabuffer hwpf fapi hwp plat \ +EXTENDED_MODULES = targeting ecmddatabuffer fapi hwp plat \ extinitsvc istepdisp hwas fsiscom DIRECT_BOOT_MODULES = example diff --git a/src/usr/hwpf/fapi/fapiCreateIfAttrService.pl b/src/usr/hwpf/fapi/fapiCreateIfAttrService.pl new file mode 100755 index 000000000..ab71d80e0 --- /dev/null +++ b/src/usr/hwpf/fapi/fapiCreateIfAttrService.pl @@ -0,0 +1,264 @@ +#!/usr/bin/perl +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/hwpf/fapi/fapiCreateIfAttrService.pl $ +# +# 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 +# +# Purpose: This perl script will parse HWP Attribute XML files and +# initfile attr files and create the fapiGetInitFileAttr() function +# in a file called fapiAttributeService.C +# +# Author: Mike Jones +# +# Change Log ********************************************************** +# +# Flag Track# Userid Date Description +# ---- -------- -------- -------- ----------- +# mjjones 11/15/11 Copied from fapiParseAttributeInfo +# +# End Change Log ****************************************************** + +use strict; + +#------------------------------------------------------------------------------ +# Print Command Line Help +#------------------------------------------------------------------------------ +my $numArgs = $#ARGV + 1; +if ($numArgs < 4) +{ + print ("Usage: fapiCreateIfAttrService.pl <output dir>\n"); + print (" <if-attr-file1> [<if-attr-file2> ...]\n"); + print (" -a <attr-xml-file1> [<attr-xml-file2> ...]\n"); + print (" This perl script will parse initfile attr files and attribute XML\n"); + print (" files and create the fapiGetInitFileAttr() function in a file\n"); + print (" called fapiAttributeService.C\n"); + exit(1); +} + +#------------------------------------------------------------------------------ +# Specify perl modules to use +#------------------------------------------------------------------------------ +use XML::Simple; +my $xml = new XML::Simple (KeyAttr=>[]); + +# Uncomment to enable debug output +#use Data::Dumper; + +#------------------------------------------------------------------------------ +# Open output file for writing +#------------------------------------------------------------------------------ +my $asFile = $ARGV[0]; +$asFile .= "/"; +$asFile .= "fapiAttributeService.C"; +open(ASFILE, ">", $asFile); + +#------------------------------------------------------------------------------ +# Print Start of file information to fapiAttributeService.C +#------------------------------------------------------------------------------ +print ASFILE "// fapiAttributeService.C\n"; +print ASFILE "// This file is generated by perl script fapiCreateIfAttrService.pl\n\n"; +print ASFILE "#include <fapiAttributeService.H>\n\n"; +print ASFILE "namespace fapi\n"; +print ASFILE "{\n\n"; +print ASFILE "ReturnCode fapiGetInitFileAttr(const AttributeId i_id,\n"; +print ASFILE " const Target * i_pTarget,\n"; +print ASFILE " uint64_t & o_val,\n"; +print ASFILE " const uint32_t i_arrayIndex1,\n"; +print ASFILE " const uint32_t i_arrayIndex2,\n"; +print ASFILE " const uint32_t i_arrayIndex3,\n"; +print ASFILE " const uint32_t i_arrayIndex4)\n"; +print ASFILE "{\n"; +print ASFILE " ReturnCode l_rc;\n\n"; + +my $xmlFiles = 0; +my $attCount = 0; +my @attrIds; + +#------------------------------------------------------------------------------ +# For each argument +#------------------------------------------------------------------------------ +foreach my $argnum (1 .. $#ARGV) +{ + my $infile = $ARGV[$argnum]; + + if ($infile eq '-a') + { + # Start of attribute XML files + $xmlFiles = 1; + next; + } + + if ($xmlFiles == 0) + { + #---------------------------------------------------------------------- + # Process initfile attr file. This file contains the HWPF attributes + # that the initfile uses. + #---------------------------------------------------------------------- + open(ATTRFILE, "<", $infile); + + # Read each line of the file (each line contains an attribute) + while(my $fileAttrId = <ATTRFILE>) + { + # Remove newline + chomp($fileAttrId); + + # Store the attribute in @attrIds if it does not already exist + my $match = 0; + + foreach my $attrId (@attrIds) + { + if ($fileAttrId eq $attrId) + { + $match = 1; + last; + } + } + + if (!($match)) + { + push(@attrIds, $fileAttrId); + } + } + + close(ATTRFILE); + } + else + { + #---------------------------------------------------------------------- + # Process XML file + #---------------------------------------------------------------------- + my $attributes = $xml->XMLin($infile); + + #---------------------------------------------------------------------- + # For each Attribute + #---------------------------------------------------------------------- + foreach my $attr (@{$attributes->{attribute}}) + { + #------------------------------------------------------------------ + # Check that the AttributeId exists + #------------------------------------------------------------------ + if (! exists $attr->{id}) + { + print ("fapiParseAttributeInfo.pl ERROR. Att 'id' missing\n"); + exit(1); + } + + #------------------------------------------------------------------ + # Find if the attribute is used by any initfile + #------------------------------------------------------------------ + my $match = 0; + + foreach my $attrId (@attrIds) + { + if ($attr->{id} eq $attrId) + { + $match = 1; + last; + } + } + + if (!($match)) + { + # Look at the next attribute in the XML file + next; + } + + #------------------------------------------------------------------ + # Figure out the number of attribute array dimensions + #------------------------------------------------------------------ + my $numArrayDimensions = 0; + if ($attr->{array}) + { + # Remove leading whitespace + my $dimText = $attr->{array}; + $dimText =~ s/^\s+//; + + # Split on commas or whitespace + my @vals = split(/\s*,\s*|\s+/, $dimText); + + $numArrayDimensions=@vals; + } + + #------------------------------------------------------------------ + # Print the attribute get code to fapiAttributeService.C + #------------------------------------------------------------------ + if ($attCount > 0) + { + print ASFILE " else "; + } + else + { + print ASFILE " "; + } + $attCount++; + + print ASFILE "if (i_id == $attr->{id})\n"; + print ASFILE " {\n"; + print ASFILE " $attr->{id}_Type l_attr;\n"; + print ASFILE " l_rc = FAPI_ATTR_GET($attr->{id}, i_pTarget, l_attr);\n"; + print ASFILE " o_val = l_attr"; + + if ($numArrayDimensions >= 5) + { + print ("fapiParseAttributeInfo.pl ERROR. More than 4 array dimensions!!\n"); + exit(1); + } + else + { + for (my $i = 0; $i < $numArrayDimensions; $i++) + { + print ASFILE "[i_arrayIndex"; + print ASFILE $i+1; + print ASFILE "]"; + } + } + + print ASFILE ";\n"; + print ASFILE " }\n"; + } + } +} + +#------------------------------------------------------------------------------ +# Print End of file information to fapiAttributeService.C +#-------------------------------------------------------------------------- +if ($attCount > 0) +{ + print ASFILE " else\n"; +} +print ASFILE " {\n"; +print ASFILE " FAPI_ERR(\"fapiGetInitFileAttr: Unrecognized attr: %d\", i_id);\n"; +print ASFILE " ReturnCodeFfdc::addEIFfdc(l_rc, static_cast<uint32_t>(i_id));\n"; +print ASFILE " l_rc = FAPI_RC_INVALID_ATTR_GET;\n"; +print ASFILE " }\n\n"; +print ASFILE " if (l_rc)\n"; +print ASFILE " {\n"; +print ASFILE " FAPI_ERR(\"fapiGetInitFileAttr: Error getting attr\");\n"; +print ASFILE " }\n\n"; +print ASFILE " return l_rc;\n"; +print ASFILE "}\n\n"; +print ASFILE "}\n"; + + +#------------------------------------------------------------------------------ +# Close output file +#------------------------------------------------------------------------------ +close(ASFILE); diff --git a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl index 333e68440..e493255ec 100755 --- a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl +++ b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl @@ -47,13 +47,11 @@ # camvanng 10/20/11 Changed i_pTarget to "const" ptr # camvanng 11/09/11 Prepend "ENUM_" to attribute # enums +# mjjones 11/15/11 Move gen of fapiAttributeService.C +# to a different file # # End Change Log ****************************************************** -# -# Usage: -# fapiParseAttributeInfo.pl <output dir> <filename1> <filename2> ... - use strict; #------------------------------------------------------------------------------ @@ -62,7 +60,7 @@ use strict; my $numArgs = $#ARGV + 1; if ($numArgs < 2) { - print ("Usage: fapiParseAttributeInfo.pl <output dir> <filename1> <filename2> ...\n"); + print ("Usage: fapiParseAttributeInfo.pl <output dir> <attr-xml-file1> [<attr-xml-file2> ...]\n"); print (" This perl script will parse attribute XML files and add\n"); print (" attribute information to a file called fapiAttributeIds.H\n"); exit(1); @@ -78,18 +76,13 @@ my $xml = new XML::Simple (KeyAttr=>[]); #use Data::Dumper; #------------------------------------------------------------------------------ -# Open output files for writing +# Open output file for writing #------------------------------------------------------------------------------ my $aiFile = $ARGV[0]; $aiFile .= "/"; $aiFile .= "fapiAttributeIds.H"; open(AIFILE, ">", $aiFile); -my $asFile = $ARGV[0]; -$asFile .= "/"; -$asFile .= "fapiAttributeService.C"; -open(ASFILE, ">", $asFile); - #------------------------------------------------------------------------------ # Print Start of file information to fapiAttributeIds.H #------------------------------------------------------------------------------ @@ -105,24 +98,6 @@ print AIFILE " *\/\n"; print AIFILE "enum AttributeId\n{\n"; #------------------------------------------------------------------------------ -# Print Start of file information to fapiAttributeService.C -#------------------------------------------------------------------------------ -print ASFILE "// fapiAttributeService.C\n"; -print ASFILE "// This file is generated by perl script fapiParseAttributeInfo.pl\n\n"; -print ASFILE "#include <fapiAttributeService.H>\n\n"; -print ASFILE "namespace fapi\n"; -print ASFILE "{\n\n"; -print ASFILE "ReturnCode fapiGetInitFileAttr(const AttributeId i_id,\n"; -print ASFILE " const Target * i_pTarget,\n"; -print ASFILE " uint64_t & o_val,\n"; -print ASFILE " const uint32_t i_arrayIndex1,\n"; -print ASFILE " const uint32_t i_arrayIndex2,\n"; -print ASFILE " const uint32_t i_arrayIndex3,\n"; -print ASFILE " const uint32_t i_arrayIndex4)\n"; -print ASFILE "{\n"; -print ASFILE " ReturnCode l_rc;\n\n"; - -#------------------------------------------------------------------------------ # For each XML file #------------------------------------------------------------------------------ foreach my $argnum (1 .. $#ARGV) @@ -287,47 +262,6 @@ foreach my $argnum (1 .. $#ARGV) # Print newline between each attribute's info to fapiAttributeIds.H #---------------------------------------------------------------------- print AIFILE "\n"; - - #---------------------------------------------------------------------- - # Print the attribute get code to fapiAttributeService.C - # *** TODO *** - # Currently, all attributes are supported in fapiGetInitFileAttr() in - # fapiAttributeService.C. Ideally only the initfile attributes should - # be supported to minimize code size. Need to figure out how to do this - #---------------------------------------------------------------------- - if ($attCount > 0) - { - print ASFILE " else "; - } - else - { - print ASFILE " "; - } - $attCount++; - - print ASFILE "if (i_id == $attr->{id})\n"; - print ASFILE " {\n"; - print ASFILE " $attr->{id}_Type l_attr;\n"; - print ASFILE " l_rc = FAPI_ATTR_GET($attr->{id}, i_pTarget, l_attr);\n"; - print ASFILE " o_val = l_attr"; - - if ($numArrayDimensions >= 5) - { - print ("fapiParseAttributeInfo.pl ERROR. More than 4 array dimensions!!\n"); - exit(1); - } - else - { - for (my $i = 0; $i < $numArrayDimensions; $i++) - { - print ASFILE "[i_arrayIndex"; - print ASFILE $i+1; - print ASFILE "]"; - } - } - - print ASFILE ";\n"; - print ASFILE " }\n"; }; } @@ -338,25 +272,6 @@ print AIFILE "}\n\n"; print AIFILE "#endif\n"; #------------------------------------------------------------------------------ -# Print End of file information to fapiAttributeService.C -#-------------------------------------------------------------------------- -print ASFILE " else\n"; -print ASFILE " {\n"; -print ASFILE " FAPI_ERR(\"fapiGetInitFileAttr: Unrecognized attr: %d\", i_id);\n"; -print ASFILE " ReturnCodeFfdc::addEIFfdc(l_rc, static_cast<uint32_t>(i_id));"; -print ASFILE " l_rc = FAPI_RC_INVALID_ATTR_GET;\n"; -print ASFILE " }\n\n"; -print ASFILE " if (l_rc)\n"; -print ASFILE " {\n"; -print ASFILE " FAPI_ERR(\"fapiGetInitFileAttr: Error getting attr\");\n"; -print ASFILE " }\n\n"; -print ASFILE " return l_rc;\n"; -print ASFILE "}\n\n"; -print ASFILE "}\n"; - - -#------------------------------------------------------------------------------ -# Close output files +# Close output file #------------------------------------------------------------------------------ close(AIFILE); -close(ASFILE); diff --git a/src/usr/hwpf/hwp/fapiTestHwpAttr.C b/src/usr/hwpf/hwp/fapiTestHwpAttr.C index df13107dc..55281cf6d 100755 --- a/src/usr/hwpf/hwp/fapiTestHwpAttr.C +++ b/src/usr/hwpf/hwp/fapiTestHwpAttr.C @@ -40,6 +40,7 @@ * camvanng 10/26/2011 Update scratch test * mjjones 10/28/2011 Fix error generation * camvanng 11/09/2011 Update attr enum test + * mjjones 11/17/2011 Removed some initfile attr tests */ #include <fapiTestHwpAttr.H> @@ -805,54 +806,15 @@ fapi::ReturnCode hwpTestAttributes() } //---------------------------------------------------------------------- - // Test getting scratch attributes with the fapiGetInitFileAttr function + // Removed getting scratch attributes using fapiGetInitFileAttr(). This + // now only supports the getting of attributes that are actually used by + // initfiles and those are excercised by the test initfile //---------------------------------------------------------------------- - uint64_t l_val = 0; - fapi::AttributeId l_id; - fapi::AttributeId l_ids[] = {fapi::ATTR_SCRATCH_UINT8_1, - fapi::ATTR_SCRATCH_UINT8_2, - fapi::ATTR_SCRATCH_UINT32_1, - fapi::ATTR_SCRATCH_UINT32_2, - fapi::ATTR_SCRATCH_UINT64_1, - fapi::ATTR_SCRATCH_UINT64_2, - fapi::ATTR_SCRATCH_UINT8_ARRAY_1, - fapi::ATTR_SCRATCH_UINT8_ARRAY_2, - fapi::ATTR_SCRATCH_UINT32_ARRAY_1, - fapi::ATTR_SCRATCH_UINT32_ARRAY_2, - fapi::ATTR_SCRATCH_UINT64_ARRAY_1, - fapi::ATTR_SCRATCH_UINT64_ARRAY_2}; - - for (uint32_t i = 0; i < 12; i++) - { - l_val = 7; - l_id = l_ids[i]; - l_rc = fapiGetInitFileAttr(l_id, NULL, l_val); - - if (l_rc) - { - FAPI_ERR("hwpTestAttributes: ID: %d. Error 0x%x from fapiGetInitFileAttr", - l_ids[i], static_cast<uint32_t>(l_rc)); - break; - } - - if (l_val != 0) - { - FAPI_SET_HWP_ERROR(l_rc, RC_HWP_ATTR_UNIT_TEST_FAIL); - FAPI_ERR("hwpTestAttributes: ID: %d. Get returned %d", - l_ids[i], static_cast<uint32_t>(l_val)); - break; - } - } - - if (l_rc) - { - break; - } //---------------------------------------------------------------------- - // Test getting an invalid scratch attribute with the - // fapiGetInitFileAttr function + // Test getting an invalid attribute using fapiGetInitFileAttr() //---------------------------------------------------------------------- + uint64_t l_val = 0; fapi::AttributeId l_badId = static_cast<fapi::AttributeId>(0xff); l_rc = fapiGetInitFileAttr(l_badId, NULL, l_val); diff --git a/src/usr/hwpf/hwp/initfiles/makefile b/src/usr/hwpf/hwp/initfiles/makefile deleted file mode 100644 index 504deb982..000000000 --- a/src/usr/hwpf/hwp/initfiles/makefile +++ /dev/null @@ -1,44 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/hwpf/hwp/initfiles/makefile $ -# -# 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 -ROOTPATH = ../../../../../ - -INITFILES_INPUT = sample.initfile -INITFILES_OUTPUT = sample.if - -INITCOMPILER = ${ROOTPATH}/src/build/ifcompiler/bin/initCompiler -ATTR_HEADER = ${ROOTPATH}/obj/genfiles/fapiAttributeIds.H - -EXTRA_PARTS = $(addprefix ${IMGDIR}/, ${INITFILES_OUTPUT}) - -include ${ROOTPATH}/config.mk - -${EXTRA_PARTS}: ${IMGDIR}/% : ${GENDIR}/% - cp -f $^ $@ - -${GENDIR}/%.if: ${INITCOMPILER} ${ATTR_HEADER} %.initfile - ${INITCOMPILER} -init ${INITFILES_INPUT} -outdir ${GENDIR} -attr ${ATTR_HEADER} - - - - - diff --git a/src/usr/hwpf/hwp/makefile b/src/usr/hwpf/hwp/makefile index d027e4b15..cc6d32303 100644 --- a/src/usr/hwpf/hwp/makefile +++ b/src/usr/hwpf/hwp/makefile @@ -20,7 +20,6 @@ # Origin: 30 # # IBM_PROLOG_END -SUBDIRS = initfiles.d ROOTPATH = ../../../.. MODULE = hwp diff --git a/src/build/ifcompiler/initCompiler.C b/src/usr/hwpf/ifcompiler/initCompiler.C index 1f3cc24d6..de8553e6c 100755 --- a/src/build/ifcompiler/initCompiler.C +++ b/src/usr/hwpf/ifcompiler/initCompiler.C @@ -21,6 +21,7 @@ // dg003 D779902 dgilbert 12/08/10 Add ability to specify ouput if file // andrewg 05/24/11 Port over for VPL/PgP // andrewg 09/19/11 Updates based on review +// mjjones 11/17/11 Output attribute listing // End Change Log ********************************************************************************* /** @@ -144,6 +145,7 @@ int main(int narg, char ** argv) printf("Generate Listing\n"); // This builds a listing from the compiled binary sequence yyscomlist->listing(bin_seq, parsed.listing_ostream()); + yyscomlist->attr_listing(bin_seq, parsed.attr_listing_ostream()); // open if file and read in to new SpyList @@ -248,6 +250,7 @@ Parser::Parser(int narg, char ** argv) stats << "*********************************************************" << endl; stats << "* source: " << iv_source_path << endl; stats << "* listing: " << listing_fn() << endl; + stats << "* attr: " << attr_listing_fn() << endl; stats << "* binary: " << binseq_fn() << endl; iv_scomlist = new ScomList(iv_source_path, header_files, stats, iv_ec); //dg002c @@ -270,11 +273,17 @@ Parser::Parser(int narg, char ** argv) throw invalid_argument(string("ERROR! Could not open ") + listing_fn()); } + iv_attr_list_ostream.open(attr_listing_fn().c_str()); + if(!iv_attr_list_ostream) + { + throw invalid_argument(string("ERROR! Could not open ") + attr_listing_fn()); + } } Parser::~Parser() { iv_list_ostream.close(); + iv_attr_list_ostream.close(); } void Parser::capture_dbg() diff --git a/src/build/ifcompiler/initCompiler.H b/src/usr/hwpf/ifcompiler/initCompiler.H index 76eef5782..d49c8e136 100755 --- a/src/build/ifcompiler/initCompiler.H +++ b/src/usr/hwpf/ifcompiler/initCompiler.H @@ -24,6 +24,7 @@ // dg003 D779902 dgilbert 12/08/10 Ability to specify output if file // andrewg 05/24/11 Port over for VPL/PgP // andrewg 09/19/11 Updates based on review +// mjjones 11/17/11 Output attribute listing // End Change Log ********************************************************************************* /** @@ -72,12 +73,14 @@ namespace init ~Parser(); string listing_fn() { return (binseq_fn()).append(".list"); } + string attr_listing_fn() { return (binseq_fn()).append(".attr"); } string source_fn() { return iv_source_path; } string binseq_fn() { return iv_outfile; } //dg003a //{ string s(iv_outdir); s.append(iv_initfile); s.append(".if"); return s; } //dg003d uint32_t get_source_type() { return iv_type; } ostream & listing_ostream() { return iv_list_ostream; } + ostream & attr_listing_ostream() { return iv_attr_list_ostream; } ScomList * get_scomlist() { return iv_scomlist; } // TODO refactor this out bool debug_mode() { return iv_dbg; } @@ -91,6 +94,7 @@ namespace init string iv_outdir; string iv_outfile; //dg003a ofstream iv_list_ostream; + ofstream iv_attr_list_ostream; uint32_t iv_type; ScomList * iv_scomlist; bool iv_dbg; diff --git a/src/build/ifcompiler/initCompiler.lex b/src/usr/hwpf/ifcompiler/initCompiler.lex index 9abdaded3..9abdaded3 100755 --- a/src/build/ifcompiler/initCompiler.lex +++ b/src/usr/hwpf/ifcompiler/initCompiler.lex diff --git a/src/build/ifcompiler/initCompiler.y b/src/usr/hwpf/ifcompiler/initCompiler.y index 4c8da2ca3..4c8da2ca3 100755 --- a/src/build/ifcompiler/initCompiler.y +++ b/src/usr/hwpf/ifcompiler/initCompiler.y diff --git a/src/build/ifcompiler/initRpn.C b/src/usr/hwpf/ifcompiler/initRpn.C index 39af931a1..39af931a1 100644..100755 --- a/src/build/ifcompiler/initRpn.C +++ b/src/usr/hwpf/ifcompiler/initRpn.C diff --git a/src/build/ifcompiler/initRpn.H b/src/usr/hwpf/ifcompiler/initRpn.H index 5eba73c62..5eba73c62 100755 --- a/src/build/ifcompiler/initRpn.H +++ b/src/usr/hwpf/ifcompiler/initRpn.H diff --git a/src/build/ifcompiler/initScom.C b/src/usr/hwpf/ifcompiler/initScom.C index 8a7d08cf1..b37c05182 100755 --- a/src/build/ifcompiler/initScom.C +++ b/src/usr/hwpf/ifcompiler/initScom.C @@ -24,6 +24,7 @@ // andrewg 05/24/11 Port over for VPL/PgP // andrewg 09/19/11 Updates based on review // andrewg 11/09/11 Multi-dimensional array and move to common fapi include +// mjjones 11/17/11 Output attribute listing // End Change Log ********************************************************************************* /** @@ -1232,6 +1233,13 @@ void ScomList::listing(BINSEQ & bin_seq,ostream & olist) //------------------------------------------------------------------------------------------------- +void ScomList::attr_listing(BINSEQ & bin_seq,ostream & olist) +{ + olist << iv_symbols->attr_listing(); +} + +//------------------------------------------------------------------------------------------------- + string ScomList::fmt8(uint32_t val) { ostringstream oss; diff --git a/src/build/ifcompiler/initScom.H b/src/usr/hwpf/ifcompiler/initScom.H index fa8087116..35938ba20 100755 --- a/src/build/ifcompiler/initScom.H +++ b/src/usr/hwpf/ifcompiler/initScom.H @@ -24,6 +24,7 @@ // dg003 SW047506 dgilbert 12/09/10 More filtering enhancements // andrewg 05/24/11 Port over for VPL/PgP // andrewg 09/19/11 Updates based on review +// mjjones 11/17/11 Output attribute listing // End Change Log ********************************************************************************* /** @@ -208,6 +209,7 @@ namespace init void compile(BINSEQ & bin_seq); void listing(BINSEQ & bin_seq, ostream & out); + void attr_listing(BINSEQ & bin_seq, ostream & out); /** * Compare two spylists for equivalance diff --git a/src/build/ifcompiler/initSymbols.C b/src/usr/hwpf/ifcompiler/initSymbols.C index 77f55258b..6e8b8bc38 100644..100755 --- a/src/build/ifcompiler/initSymbols.C +++ b/src/usr/hwpf/ifcompiler/initSymbols.C @@ -21,6 +21,7 @@ // andrewg 09/19/11 Updates based on review // camvanng 11/08/11 Added support for attribute enums // andrewg 11/09/11 Multi-dimensional array and move to common fapi include +// mjjones 11/17/11 Output attribute listing // End Change Log ********************************************************************************* /** @@ -772,6 +773,24 @@ string Symbols::listing() // ------------------------------------------------------------------------------------------------ +string Symbols::attr_listing() +{ + ostringstream oss; + + // Set up tag table if not already setup + string any = "ANY"; + get_tag(use_symbol(any)); + + for(SYMBOL_USED::iterator i = iv_used_var.begin() + 1; i != iv_used_var.end(); ++i) + { + oss << find_text(*i) << endl; + } + + return oss.str(); +} + +// ------------------------------------------------------------------------------------------------ + string Symbols::not_found_listing() { ostringstream oss; diff --git a/src/build/ifcompiler/initSymbols.H b/src/usr/hwpf/ifcompiler/initSymbols.H index 80a3fbb31..efef0dcbe 100755 --- a/src/build/ifcompiler/initSymbols.H +++ b/src/usr/hwpf/ifcompiler/initSymbols.H @@ -23,6 +23,7 @@ // andrewg 09/19/11 Updates based on review // camvanng 11/08/11 Added support for attribute enums // andrewg 11/09/11 Multi-dimensional array and move to common fapi include +// mjjones 11/17/11 Output attribute listing // End Change Log ********************************************************************************* /** @@ -178,6 +179,7 @@ namespace init string listing(); ///< listing of used vars & lits + string attr_listing(); ///< listing of used HWPF attributes uint32_t bin_vars(BINSEQ & blist); ///< binary byte output of used vars. ret # vars uint32_t bin_lits(BINSEQ & blist); ///< binary byte sequence of used lits ret # lits diff --git a/src/usr/hwpf/makefile b/src/usr/hwpf/makefile index 7749368ec..6a031cde9 100644 --- a/src/usr/hwpf/makefile +++ b/src/usr/hwpf/makefile @@ -21,29 +21,137 @@ # # IBM_PROLOG_END ROOTPATH = ../../.. -MODULE = hwpf +SUBDIRS = fapi.d hwp.d plat.d test.d + +#------------------------------------------------------------------------------ +# This makefile controls the generation of HWPF files +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# Source XML files +#------------------------------------------------------------------------------ +HWP_ERROR_XML_FILES = hwp/fapiHwpErrorInfo.xml +HWP_ATTR_XML_FILES = hwp/fapiHwpAttributeInfo.xml + +#------------------------------------------------------------------------------ +# Initfiles +#------------------------------------------------------------------------------ +HWP_INITFILES = hwp/initfiles/sample.initfile + +#------------------------------------------------------------------------------ +# Generated files +#------------------------------------------------------------------------------ +# Initfile compiler files +IF_CMP_YACC_C_TARGET = y.tab.c +IF_CMP_YACC_H_TARGET = y.tab.h +IF_CMP_FLEX_TARGET = lex.yy.c +IF_CMP_COMPILER_TARGET = ifcompiler + +# The FAPI return code and error info files generated from Error XML files FAPI_ERROR_TARGETS = fapiHwpReturnCodes.H fapiHwpErrorInfo.H -FAPI_ATTR_TARGETS = fapiAttributeIds.H fapiAttributeService.C -FAPI_HWP_ERROR_TAGS = fapiHwpReasonCodes.H -GENFILES = ${FAPI_ERROR_TARGETS} ${FAPI_ATTR_TARGETS} ${FAPI_HWP_ERROR_TAGS} +# The PLAT error tag file generated from Error XML files +PLAT_ERROR_TAG_TARGET = fapiHwpReasonCodes.H -SUBDIRS = fapi.d hwp.d plat.d test.d +# The FAPI attribute id file generated from Attribute XML files +FAPI_ATTR_ID_TARGET = fapiAttributeIds.H + +# The binary, list and attr files generated from Initfiles +# Generation depends on ifcompiler and fapiAttributeIds.H +HWP_IF_NAMES = $(notdir ${HWP_INITFILES}) +HWP_IF_BASENAMES = $(basename ${HWP_IF_NAMES}) +HWP_IF_BIN_TARGETS = $(addsuffix .if, ${HWP_IF_BASENAMES}) +HWP_IF_LST_TARGETS = $(addsuffix .if.list, ${HWP_IF_BASENAMES}) +HWP_IF_ATT_TARGETS = $(addsuffix .if.attr, ${HWP_IF_BASENAMES}) +HWP_IF_ALL_TARGETS = ${HWP_IF_BIN_TARGETS} ${HWP_IF_LST_TARGETS} \ + ${HWP_IF_ATT_TARGETS} + +# The FAPI Initfile attribute service +# Generation depends on the Initfile <name>.if.attr files +FAPI_ATTR_IF_TARGET = fapiAttributeService.C + +GENFILES = ${IF_CMP_YACC_C_TARGET} \ + ${IF_CMP_YACC_H_TARGET} \ + ${IF_CMP_FLEX_TARGET} \ + ${IF_CMP_COMPILER_TARGET} \ + ${FAPI_ERROR_TARGETS} \ + ${PLAT_ERROR_TAG_TARGET} \ + ${FAPI_ATTR_ID_TARGET} \ + ${HWP_IF_ALL_TARGETS} \ + ${FAPI_ATTR_IF_TARGET} + +EXTRA_PARTS = ${ROOTPATH}/img/${HWP_IF_BIN_TARGETS} include ${ROOTPATH}/config.mk -# fapiParseErrorInfo.pl produces multiple output files: FAPI_ERROR_TARGETS -$(call GENTARGET, $(FAPI_ERROR_TARGETS)) : \ - fapi/fapiParseErrorInfo.pl hwp/fapiHwpErrorInfo.xml - $< $(dir $@) $(filter-out $<,$^) +#------------------------------------------------------------------------------ +# The Initfile compiler +#------------------------------------------------------------------------------ +$(call GENTARGET, ${IF_CMP_YACC_C_TARGET} ${IF_CMP_YACC_H_TARGET}) : \ + ifcompiler/initCompiler.y + yacc -d -o ${GENDIR}/${IF_CMP_YACC_C_TARGET} $^ + +$(call GENTARGET, ${IF_CMP_FLEX_TARGET}) : \ + ifcompiler/initCompiler.lex + flex -o$@ $^ + +IF_COMPILER_C_FILES = ifcompiler/initCompiler.C \ + ifcompiler/initRpn.C \ + ifcompiler/initScom.C \ + ifcompiler/initSymbols.C + +IF_COMPILER_H_FILES = ifcompiler/initCompiler.H \ + ifcompiler/initRpn.H \ + ifcompiler/initScom.H \ + ifcompiler/initSymbols.H + +$(call GENTARGET, ${IF_CMP_COMPILER_TARGET}) : \ + ${GENDIR}/${IF_CMP_YACC_C_TARGET} \ + ${GENDIR}/${IF_CMP_YACC_H_TARGET} \ + ${GENDIR}/${IF_CMP_FLEX_TARGET} \ + ${IF_COMPILER_C_FILES} \ + ${IF_COMPILER_H_FILES} + g++ ${IF_COMPILER_C_FILES} ${GENDIR}/${IF_CMP_FLEX_TARGET} \ + ${GENDIR}/${IF_CMP_YACC_C_TARGET} -I ifcompiler -I ${GENDIR} \ + -I ${ROOTPATH}/src/include/usr/hwpf/hwp -o $@ + +#------------------------------------------------------------------------------ +# The FAPI return code and error info files generated from Error XML files +#------------------------------------------------------------------------------ +$(call GENTARGET, ${FAPI_ERROR_TARGETS}) : \ + fapi/fapiParseErrorInfo.pl ${HWP_ERROR_XML_FILES} + $< $(dir $@) ${HWP_ERROR_XML_FILES} + +#------------------------------------------------------------------------------ +# The PLAT error tag file generated from Error XML files +#------------------------------------------------------------------------------ +$(call GENTARGET, ${PLAT_ERROR_TAG_TARGET}) : \ + plat/fapiCreateHwpErrorTags.pl ${HWP_ERROR_XML_FILES} + $< $(dir $@) ${HWP_ERROR_XML_FILES} + +#------------------------------------------------------------------------------ +# The FAPI attribute id file generated from Attribute XML files +#------------------------------------------------------------------------------ +$(call GENTARGET, ${FAPI_ATTR_ID_TARGET}) : \ + fapi/fapiParseAttributeInfo.pl ${HWP_ATTR_XML_FILES} + $< $(dir $@) ${HWP_ATTR_XML_FILES} + +#------------------------------------------------------------------------------ +# The binary, list and attr files generated from Initfiles +#------------------------------------------------------------------------------ +$(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} -# fapiParseAttributeInfo.pl produces multiple output files: FAPI_ATTR_TARGETS -$(call GENTARGET, $(FAPI_ATTR_TARGETS)) : \ - fapi/fapiParseAttributeInfo.pl hwp/fapiHwpAttributeInfo.xml - $< $(dir $@) $(filter-out $<,$^) +${EXTRA_PARTS}: ${IMGDIR}/% : ${GENDIR}/% + cp -f $^ $@ -$(call GENTARGET, $(FAPI_HWP_ERROR_TAGS)) : \ - plat/fapiCreateHwpErrorTags.pl hwp/fapiHwpErrorInfo.xml - $< $(dir $@) $(filter-out $<,$^) +#------------------------------------------------------------------------------ +# The FAPI Initfile attribute service +#------------------------------------------------------------------------------ +$(call GENTARGET, ${FAPI_ATTR_IF_TARGET}) : \ + fapi/fapiCreateIfAttrService.pl ${HWP_ATTR_XML_FILES} \ + $(addprefix ${GENDIR}/, $(HWP_IF_ATT_TARGETS)) + $< $(dir $@) $(addprefix ${GENDIR}/, $(HWP_IF_ATT_TARGETS)) -a ${HWP_ATTR_XML_FILES} diff --git a/src/usr/initservice/extinitsvc/extinitsvctasks.H b/src/usr/initservice/extinitsvc/extinitsvctasks.H index 9ac783eb9..2ca99207f 100644 --- a/src/usr/initservice/extinitsvc/extinitsvctasks.H +++ b/src/usr/initservice/extinitsvc/extinitsvctasks.H @@ -56,20 +56,7 @@ const TaskInfo g_exttaskinfolist[] = { }, /** - * @brief hwpf task, - */ - { - "libhwpf.so" , // taskname - NULL, // no pointer to fn - { - INIT_TASK, // task type - EXT_IMAGE, // Extended Module - START_HWPF_ERRL_ID, // module id - } - }, - - /** - * @brief fabi task, + * @brief fapi task, */ { "libfapi.so" , // taskname |