diff options
author | Mike Jones <mjjones@us.ibm.com> | 2011-07-05 13:10:01 -0500 |
---|---|---|
committer | MIKE J. JONES <mjjones@us.ibm.com> | 2011-07-12 11:19:33 -0500 |
commit | e3fc77c59a071c009e13acdf4c4b2ce6a718a570 (patch) | |
tree | b6797ecc6735caf1d21866d10f51bd57aee9f68c | |
parent | 0849df559aaa0fb758dfa92148f9e7a2c3d10105 (diff) | |
download | talos-hostboot-e3fc77c59a071c009e13acdf4c4b2ce6a718a570.tar.gz talos-hostboot-e3fc77c59a071c009e13acdf4c4b2ce6a718a570.zip |
HWPF const fixes and perl script updates
Change-Id: Icb0393cac0e9143638b8d6811cc528404d29977c
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/186
Tested-by: Jenkins Server
Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com>
-rw-r--r-- | src/include/usr/hwpf/fapi/fapiReturnCode.H | 10 | ||||
-rw-r--r-- | src/include/usr/hwpf/fapi/fapiReturnCodeDataRef.H | 16 | ||||
-rw-r--r-- | src/include/usr/hwpf/fapi/fapiTarget.H | 8 | ||||
-rw-r--r-- | src/include/usr/hwpf/fapi/fapiUtil.H | 3 | ||||
-rwxr-xr-x | src/usr/hwpf/fapi/fapiParseAttributeInfo.pl | 21 | ||||
-rwxr-xr-x | src/usr/hwpf/fapi/fapiParseErrorInfo.pl | 94 | ||||
-rw-r--r-- | src/usr/hwpf/fapi/fapiReturnCode.C | 20 | ||||
-rw-r--r-- | src/usr/hwpf/fapi/fapiReturnCodeDataRef.C | 10 | ||||
-rw-r--r-- | src/usr/hwpf/fapi/fapiTarget.C | 14 | ||||
-rw-r--r-- | src/usr/hwpf/makefile | 6 | ||||
-rw-r--r-- | src/usr/hwpf/plat/fapiPlatReturnCodeDataRef.C | 4 |
11 files changed, 140 insertions, 66 deletions
diff --git a/src/include/usr/hwpf/fapi/fapiReturnCode.H b/src/include/usr/hwpf/fapi/fapiReturnCode.H index 29b448add..d7e35b772 100644 --- a/src/include/usr/hwpf/fapi/fapiReturnCode.H +++ b/src/include/usr/hwpf/fapi/fapiReturnCode.H @@ -4,6 +4,14 @@ * @brief Defines the ReturnCode class that is a generic return code. */ +/* + * Change Log ****************************************************************** + * Flag Defect/Feature User Date Description + * ------ -------------- ---------- ----------- ---------------------------- + * mjjones 04/13/2011 Created. + * mjjones 07/05/2011. Removed const from data + */ + #ifndef FAPIRETURNCODE_H_ #define FAPIRETURNCODE_H_ @@ -146,7 +154,7 @@ public: * * param[in] i_pData Pointer to ReturnCodeData (on the heap) */ - void setData(const void * i_pData); + void setData(void * i_pData); /** * @brief Gets the creator of the return code diff --git a/src/include/usr/hwpf/fapi/fapiReturnCodeDataRef.H b/src/include/usr/hwpf/fapi/fapiReturnCodeDataRef.H index 683438add..855191b95 100644 --- a/src/include/usr/hwpf/fapi/fapiReturnCodeDataRef.H +++ b/src/include/usr/hwpf/fapi/fapiReturnCodeDataRef.H @@ -5,6 +5,14 @@ * reference count to a platform specific ReturnCodeData object. */ +/* + * Change Log ****************************************************************** + * Flag Defect/Feature User Date Description + * ------ -------------- ---------- ----------- ---------------------------- + * mjjones 04/13/2011 Created. + * mjjones 07/05/2011. Removed const from data + */ + #ifndef FAPIRETURNCODEDATAREF_H_ #define FAPIRETURNCODEDATAREF_H_ @@ -39,7 +47,7 @@ public: * * @param[in] i_pData Pointer to platform specific ReturnCodeData */ - explicit ReturnCodeDataRef(const void * i_pData); + explicit ReturnCodeDataRef(void * i_pData); /** * @brief Destructor @@ -67,7 +75,7 @@ public: * @return void *. Pointer to ReturnCodeData. If NULL then no data (must * have been released) */ - const void * getData() const; + void * getData() const; /** * @brief Get a pointer to any ReturnCodeData and release ownership from @@ -78,7 +86,7 @@ public: * @return void *. Pointer to ReturnCodeData. If NULL then no data (must * have been released) */ - const void * releaseData(); + void * releaseData(); private: @@ -98,7 +106,7 @@ private: uint32_t iv_refCount; // Pointer to platform specific ReturnCodeData - const void * iv_pData; + void * iv_pData; }; } diff --git a/src/include/usr/hwpf/fapi/fapiTarget.H b/src/include/usr/hwpf/fapi/fapiTarget.H index d79beee4f..1256380b3 100644 --- a/src/include/usr/hwpf/fapi/fapiTarget.H +++ b/src/include/usr/hwpf/fapi/fapiTarget.H @@ -11,7 +11,7 @@ * ------ -------------- ---------- ----------- ---------------------------- * mjjones 04/13/2011 Created. Based on Hlava prototype * mjjones 06/29/2011 Removed incorrect MSB from 2 enums - * + * mjjones 07/05/2011. Removed const from handle */ #ifndef FAPITARGET_H_ @@ -74,7 +74,7 @@ public: * @param[in] i_pHandle Pointer to platform specific Target handle */ Target(const TargetType i_type, - const void * i_pHandle); + void * i_pHandle); /** * @brief Copy Constructor @@ -131,7 +131,7 @@ public: * * @param[in] i_pHandle Pointer to platform specific handle */ - void set(const void * i_pHandle); + void set(void * i_pHandle); /** * @brief Get the target type @@ -196,7 +196,7 @@ private: TargetType iv_type; // Pointer to platform specific Target Handle - const void * iv_pHandle; + void * iv_pHandle; }; } diff --git a/src/include/usr/hwpf/fapi/fapiUtil.H b/src/include/usr/hwpf/fapi/fapiUtil.H index 843465142..0540a79cf 100644 --- a/src/include/usr/hwpf/fapi/fapiUtil.H +++ b/src/include/usr/hwpf/fapi/fapiUtil.H @@ -9,8 +9,9 @@ * Flag Defect/Feature User Date Description * ------ -------------- ---------- ----------- ---------------------------- * mjjones 04/13/2011 Created. - * camvanng 05/31/2011 Removed fapiOutputx macros + * camvanng 05/31/2011 Removed fapiOutputx macros * mjjones 06/30/2011 Removed #include + * mjjones 07/05/2011 Removed rogue tab * */ diff --git a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl index 0153bfb2f..4f50e56ca 100755 --- a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl +++ b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl @@ -17,12 +17,13 @@ # mjjones 06/06/11 Minor updates for integration # mjjones 06/10/11 Added "use strict;" # mjjones 06/23/11 Parse more info +# mjjones 07/05/11 Take output dir as parameter # # End Change Log ****************************************************** # # Usage: -# fapiParseAttributeInfo.pl <filename1> <filename2> .... <filenameN> +# fapiParseAttributeInfo.pl <output dir> <filename1> <filename2> ... use strict; @@ -30,9 +31,9 @@ use strict; # Print Command Line Help #------------------------------------------------------------------------------ my $numArgs = $#ARGV + 1; -if ($numArgs < 1) +if ($numArgs < 2) { - print ("Usage: fapiParseAttributeInfo.pl <filename1> <filename2> .... <filenameN>\n"); + print ("Usage: fapiParseAttributeInfo.pl <output dir> <filename1> <filename2> ...\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); @@ -50,7 +51,10 @@ my $xml = new XML::Simple (KeyAttr=>[]); #------------------------------------------------------------------------------ # Open output file for writing #------------------------------------------------------------------------------ -open(OUTFILE, ">fapiAttributeIds.H"); +my $outputFile = $ARGV[0]; +$outputFile .= "/"; +$outputFile .= "fapiAttributeIds.H"; +open(OUTFILE, ">", $outputFile); #------------------------------------------------------------------------------ # Print Start of file information @@ -73,9 +77,10 @@ print OUTFILE "enum AttributeId\n{\n"; #------------------------------------------------------------------------------ # For each XML file #------------------------------------------------------------------------------ -my $infile; -foreach $infile(@ARGV) +foreach my $argnum (1 .. $#ARGV) { + my $infile = $ARGV[$argnum]; + # read XML file my $attributes = $xml->XMLin($infile); @@ -115,8 +120,10 @@ print OUTFILE " *\/\n"; #------------------------------------------------------------------------------ # For each XML file #------------------------------------------------------------------------------ -foreach $infile(@ARGV) +foreach my $argnum (1 .. $#ARGV) { + my $infile = $ARGV[$argnum]; + # read XML file my $attributes = $xml->XMLin($infile); diff --git a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl index e0dc8b652..858059567 100755 --- a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl +++ b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl @@ -1,31 +1,64 @@ #!/usr/bin/perl # +# Purpose: This perl script will parse HWP Error XML files, +# pull out the error Return Codes and create a header file fapiHwpReturnCodes.H +# containing an enumeration of them. +# +# Author: CamVan Nguyen +# Last Updated: 06/03/2011 +# +# Version: 1.0 +# +# Change Log ********************************************************** +# +# Flag Track# Userid Date Description +# ---- -------- -------- -------- ----------- +# camvanng 06/03/11 Created +# mjjones 06/06/11 Minor updates for integration +# mjjones 06/10/11 Added "use strict;" +# mjjones 07/05/11 Take output dir as parameter +# +# End Change Log ****************************************************** + +# # Usage: -# fapiParseErrorInfo.pl <filename1> <filename2> .... <filenameN> +# fapiParseErrorInfo.pl <output dir> <filename1> <filename2> ... use strict; +#------------------------------------------------------------------------------ +# Print Command Line Help +#------------------------------------------------------------------------------ my $numArgs = $#ARGV + 1; -#print $numArgs, "\n"; - -if ($numArgs < 1) +if ($numArgs < 2) { - print ("Usage: fapiParseErrorInfo.pl <filename1> <filename2> .... <filenameN>\n"); - print (" This perl script will parse HWP Error XML files,\n"); - print (" pull out the error Return Codes and create a header file\n"); - print (" hwp/fapiHwpReturnCodes.H containing an enumeration of them.\n"); + print ("Usage: fapiParseErrorInfo.pl <output dir> <filename1> <filename2> ...\n"); + print (" This perl script will parse HWP Error XML files and add an\n"); + print (" enumeration of return codes to a file called fapiHwpReturnCodes.H\n"); exit(1); } - - -# use module +#------------------------------------------------------------------------------ +# 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 -open(OUTFILE, ">fapiHwpReturnCodes.H"); +#------------------------------------------------------------------------------ +# Open output file for writing +#------------------------------------------------------------------------------ +my $outputFile = $ARGV[0]; +$outputFile .= "/"; +$outputFile .= "fapiHwpReturnCodes.H"; +open(OUTFILE, ">", $outputFile); + +#------------------------------------------------------------------------------ +# Print Start of file information +#------------------------------------------------------------------------------ print OUTFILE "// fapiHwpReturnCodes.H\n"; print OUTFILE "// This file is generated by perl script fapiParseErrorInfo.pl\n\n"; print OUTFILE "#ifndef FAPIHWPRETURNCODES_H_\n"; @@ -38,27 +71,27 @@ print OUTFILE " *\/\n"; print OUTFILE "enum HwpReturnCode\n"; print OUTFILE "{\n"; -# create object -my $xml = new XML::Simple (KeyAttr=>[]); -my $infile; - -#for each Hwp Attribute XML file -foreach $infile(@ARGV) +#------------------------------------------------------------------------------ +# For each XML file +#------------------------------------------------------------------------------ +foreach my $argnum (1 .. $#ARGV) { - #print filename - #print $ifile, "\n\n"; + my $infile = $ARGV[$argnum]; # read XML file my $errors = $xml->XMLin($infile); - # print output - #print Dumper($errors); - #print "\n"; + # Uncomment to get debug output of all attributes + #print "\nFile: ", $infile, "\n", Dumper($errors), "\n"; - # print return code to file - my $err; - foreach $err (@{$errors->{hwpError}}) + #-------------------------------------------------------------------------- + # For each Attribute + #-------------------------------------------------------------------------- + foreach my $err (@{$errors->{hwpError}}) { + #-------------------------------------------------------------------------- + # Print the return code + #-------------------------------------------------------------------------- if ($err->{id}) { print OUTFILE " ", $err->{id}, ",\n"; @@ -71,9 +104,14 @@ foreach $infile(@ARGV) }; } +#------------------------------------------------------------------------------ +# Print End of file information +#------------------------------------------------------------------------------ print OUTFILE "};\n\n"; print OUTFILE "}\n\n"; print OUTFILE "#endif\n"; -#close output file +#------------------------------------------------------------------------------ +# Close output file +#------------------------------------------------------------------------------ close(OUTFILE); diff --git a/src/usr/hwpf/fapi/fapiReturnCode.C b/src/usr/hwpf/fapi/fapiReturnCode.C index b32ae0f2f..1720f31c4 100644 --- a/src/usr/hwpf/fapi/fapiReturnCode.C +++ b/src/usr/hwpf/fapi/fapiReturnCode.C @@ -4,6 +4,14 @@ * @brief Implements the ReturnCode class. */ +/* + * Change Log ****************************************************************** + * Flag Defect/Feature User Date Description + * ------ -------------- ---------- ----------- ---------------------------- + * mjjones 04/13/2011 Created. + * mjjones 07/05/2011. Removed const from data + */ + #include <fapiReturnCode.H> #include <fapiReturnCodeDataRef.H> @@ -108,7 +116,7 @@ ReturnCode::operator uint32_t() const //****************************************************************************** void * ReturnCode::getData() const { - const void * l_pData = NULL; + void * l_pData = NULL; if (iv_pDataRef) { @@ -116,8 +124,7 @@ void * ReturnCode::getData() const l_pData = iv_pDataRef->getData(); } - // Remove the constness and return - return const_cast<void *>(l_pData); + return l_pData; } //****************************************************************************** @@ -125,7 +132,7 @@ void * ReturnCode::getData() const //****************************************************************************** void * ReturnCode::releaseData() { - const void * l_pData = NULL; + void * l_pData = NULL; if (iv_pDataRef) { @@ -136,14 +143,13 @@ void * ReturnCode::releaseData() (void) removeData(); } - // Remove the constness and return - return const_cast<void *>(l_pData); + return l_pData; } //****************************************************************************** // setData function //****************************************************************************** -void ReturnCode::setData(const void * i_pData) +void ReturnCode::setData(void * i_pData) { // Remove interest in pointed to ReturnCodeDataRef (void) removeData(); diff --git a/src/usr/hwpf/fapi/fapiReturnCodeDataRef.C b/src/usr/hwpf/fapi/fapiReturnCodeDataRef.C index 9aaa16381..0682388ac 100644 --- a/src/usr/hwpf/fapi/fapiReturnCodeDataRef.C +++ b/src/usr/hwpf/fapi/fapiReturnCodeDataRef.C @@ -11,7 +11,7 @@ * mjjones 04/13/2011 Created. * camvanng 05/31/2011 Added debug traces * mjjones 06/30/2011 Added #include - * + * mjjones 07/05/2011 Removed const from data */ #include <fapiReturnCodeDataRef.H> @@ -24,7 +24,7 @@ namespace fapi //****************************************************************************** // Constructor //****************************************************************************** -ReturnCodeDataRef::ReturnCodeDataRef(const void * i_pData) : +ReturnCodeDataRef::ReturnCodeDataRef(void * i_pData) : iv_refCount(1), iv_pData(i_pData) { @@ -78,7 +78,7 @@ bool ReturnCodeDataRef::decRefCountCheckZero() //****************************************************************************** // getData function //****************************************************************************** -const void * ReturnCodeDataRef::getData() const +void * ReturnCodeDataRef::getData() const { return iv_pData; } @@ -86,9 +86,9 @@ const void * ReturnCodeDataRef::getData() const //****************************************************************************** // releaseData function //****************************************************************************** -const void * ReturnCodeDataRef::releaseData() +void * ReturnCodeDataRef::releaseData() { - const void * l_pData = iv_pData; + void * l_pData = iv_pData; iv_pData = NULL; return l_pData; } diff --git a/src/usr/hwpf/fapi/fapiTarget.C b/src/usr/hwpf/fapi/fapiTarget.C index 463a13ed3..ae6869f46 100644 --- a/src/usr/hwpf/fapi/fapiTarget.C +++ b/src/usr/hwpf/fapi/fapiTarget.C @@ -4,6 +4,14 @@ * @brief Implements the FAPI part of the Target class. */ +/* + * Change Log ****************************************************************** + * Flag Defect/Feature User Date Description + * ------ -------------- ---------- ----------- ---------------------------- + * mjjones 04/13/2011 Created. Based on Hlava prototype + * mjjones 07/05/2011. Removed const from handle + */ + #include <fapiTarget.H> namespace fapi @@ -22,7 +30,7 @@ Target::Target() : // Constructor. //****************************************************************************** Target::Target(const TargetType i_type, - const void * i_pHandle) : + void * i_pHandle) : iv_type(i_type), iv_pHandle(i_pHandle) { @@ -88,13 +96,13 @@ bool Target::operator!=(const Target & i_right) const //****************************************************************************** void * Target::get() const { - return const_cast<void *>(iv_pHandle); + return iv_pHandle; } //****************************************************************************** // Set the handle. //****************************************************************************** -void Target::set(const void * i_pHandle) +void Target::set(void * i_pHandle) { iv_pHandle = i_pHandle; } diff --git a/src/usr/hwpf/makefile b/src/usr/hwpf/makefile index be8828a60..55de95dc0 100644 --- a/src/usr/hwpf/makefile +++ b/src/usr/hwpf/makefile @@ -8,9 +8,7 @@ SUBDIRS = fapi.d hwp.d plat.d test.d include ${ROOTPATH}/config.mk ${GENDIR}/fapiHwpReturnCodes.H : fapi/fapiParseErrorInfo.pl hwp/fapiHwpErrorInfo.xml - $^ - mv $(notdir $@) $@ + $< ${GENDIR} $(filter-out $<,$^) ${GENDIR}/fapiAttributeIds.H : fapi/fapiParseAttributeInfo.pl hwp/fapiHwpAttributeInfo.xml - $^ - mv $(notdir $@) $@ + $< ${GENDIR} $(filter-out $<,$^) diff --git a/src/usr/hwpf/plat/fapiPlatReturnCodeDataRef.C b/src/usr/hwpf/plat/fapiPlatReturnCodeDataRef.C index 9906f781f..02e9caeb3 100644 --- a/src/usr/hwpf/plat/fapiPlatReturnCodeDataRef.C +++ b/src/usr/hwpf/plat/fapiPlatReturnCodeDataRef.C @@ -21,8 +21,8 @@ void ReturnCodeDataRef::deleteData() { FAPI_DBG("ReturnCodeDataRef::deleteData"); - // FSP platform uses iv_pData to point at a FipS error log. - delete (reinterpret_cast<errlHndl_t>(const_cast<void *>(iv_pData))); + // HostBoot platform uses iv_pData to point at an error log. + delete (static_cast<errlHndl_t>(iv_pData)); } } |