diff options
author | Dan Crowell <dcrowell@us.ibm.com> | 2016-04-08 21:03:51 -0500 |
---|---|---|
committer | Stephen Cprek <smcprek@us.ibm.com> | 2016-04-21 13:51:32 -0500 |
commit | 76f1c48130a060fbe83c851fce2474c17b2df9b2 (patch) | |
tree | e258515dcbdab5817603c9d290befe2324df7d59 /src/usr/hwpf/fapi | |
parent | 3967f43b9478d7e6b58180dd0b331e61412997cd (diff) | |
download | talos-hostboot-76f1c48130a060fbe83c851fce2474c17b2df9b2.tar.gz talos-hostboot-76f1c48130a060fbe83c851fce2474c17b2df9b2.zip |
Removing some more old fapi1 and hwp code
Deleted all of the old fapi1 code
Moved potentially reuseable occ code to a new dir
Deleted a variety of p8 hwp files
Change-Id: I8b6ab72fef3f1413d919bdd21bc88f2c4f59c5c3
RTC: 146345
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/23075
Tested-by: Jenkins Server
Tested-by: FSP CI Jenkins
Reviewed-by: Matt Derksen <v2cibmd@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/fapi')
-rw-r--r-- | src/usr/hwpf/fapi/fapi.mk | 39 | ||||
-rwxr-xr-x | src/usr/hwpf/fapi/fapiCreateFapiSpyIds.pl | 299 | ||||
-rwxr-xr-x | src/usr/hwpf/fapi/fapiCreateIfAttrService.pl | 312 | ||||
-rwxr-xr-x | src/usr/hwpf/fapi/fapiCreateL3DeltaVals.pl | 271 | ||||
-rwxr-xr-x | src/usr/hwpf/fapi/fapiCreatePllRingAttrVals.pl | 689 | ||||
-rwxr-xr-x | src/usr/hwpf/fapi/fapiCreateTpDbgAttrVals.pl | 249 | ||||
-rw-r--r-- | src/usr/hwpf/fapi/fapiErrorInfo.C | 369 | ||||
-rw-r--r-- | src/usr/hwpf/fapi/fapiHwAccess.C | 672 | ||||
-rwxr-xr-x | src/usr/hwpf/fapi/fapiParseAttributeInfo.pl | 799 | ||||
-rwxr-xr-x | src/usr/hwpf/fapi/fapiParseErrorInfo.pl | 1229 | ||||
-rw-r--r-- | src/usr/hwpf/fapi/fapiReturnCode.C | 632 | ||||
-rw-r--r-- | src/usr/hwpf/fapi/fapiReturnCodeDataRef.C | 180 | ||||
-rw-r--r-- | src/usr/hwpf/fapi/fapiTarget.C | 191 | ||||
-rw-r--r-- | src/usr/hwpf/fapi/makefile | 32 | ||||
-rw-r--r-- | src/usr/hwpf/fapi/runtime/makefile | 32 |
15 files changed, 0 insertions, 5995 deletions
diff --git a/src/usr/hwpf/fapi/fapi.mk b/src/usr/hwpf/fapi/fapi.mk deleted file mode 100644 index 663cc5713..000000000 --- a/src/usr/hwpf/fapi/fapi.mk +++ /dev/null @@ -1,39 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/hwpf/fapi/fapi.mk $ -# -# OpenPOWER HostBoot Project -# -# COPYRIGHT International Business Machines Corp. 2014 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. See the License for the specific language governing -# permissions and limitations under the License. -# -# IBM_PROLOG_END_TAG -EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer -EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi -EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat -EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/include - -CFLAGS += -D_NO_SPY_ACCESS=1 - -OBJS += fapiReturnCode.o -OBJS += fapiReturnCodeDataRef.o -OBJS += fapiTarget.o -OBJS += fapiHwAccess.o -OBJS += fapiErrorInfo.o -OBJS += fapiAttributeService.o -OBJS += fapiChipEcFeature.o -OBJS += fapiCollectRegFfdc.o - diff --git a/src/usr/hwpf/fapi/fapiCreateFapiSpyIds.pl b/src/usr/hwpf/fapi/fapiCreateFapiSpyIds.pl deleted file mode 100755 index d21199a23..000000000 --- a/src/usr/hwpf/fapi/fapiCreateFapiSpyIds.pl +++ /dev/null @@ -1,299 +0,0 @@ -#!/usr/bin/perl -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/hwpf/fapi/fapiCreateFapiSpyIds.pl $ -# -# OpenPOWER HostBoot Project -# -# COPYRIGHT International Business Machines Corp. 2012,2014 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. See the License for the specific language governing -# permissions and limitations under the License. -# -# IBM_PROLOG_END_TAG -use strict; -use warnings; - - -#------------------------------------------------------------------------------ -# Print Command Line Help -#------------------------------------------------------------------------------ -my $numArgs = $#ARGV+1; -print $numArgs; - -if ($numArgs < 2) -{ - print ("Usage: fapiCreateFapiSpyIds.pl <input file> <output directory>\n"); - print (" This script will parse the spy id files and create a set of nested\n"); - print (" structures in the file fapiSpyIds.H which the FSP will use.\n"); - exit(1); -} - -#------------------------------------------------------------------------------ -# Globals -#------------------------------------------------------------------------------ -my $spyIdFile = $ARGV[0]; -my $outDir = $ARGV[1]; -my $outFile = "fapiSpyIds.H"; -my $UTFile = "fapiSpyIdsUT.C"; -$outFile = $outDir . $outFile; -my %structureNames; -my $somenumber; -my %currentmembers; - -#------------------------------------------------------------------------------ -# Prototypes -#------------------------------------------------------------------------------ -sub buildStructures( \@ ); -sub createTest(); -sub addTest($$); -sub closeTest(); - -#------------------------------------------------------------------------------ -# Open input and output files for our use. -#------------------------------------------------------------------------------ -open(IDFILE, "<", $spyIdFile) or die "ERROR $? : cant open $spyIdFile : $!"; -open(OUTFILE, ">", $outFile) or die "ERROR $? : can't open $outFile : $!"; -open(UTFILE, ">", $UTFile) or die "ERROR $? : can't open $outFile : $!"; - -# direct the printf output to the file -select OUTFILE; -#select STDOUT; - -createTest(); -# read in the entire file to an array -my (@lines) = <IDFILE>; - -#------------------------------------------------------------------------------ -# Process every line in the file one at a time -#------------------------------------------------------------------------------ -foreach my $line (@lines) -{ - $line =~s/^\s+|\s+$//g; - my @tokens = split(/,/, $line ); - - $tokens[1]=~s/\}//; - $tokens[1]=~s/\"//g; - - # replace a # with __P__ - $tokens[1]=~s/\#/__P__/g; - - # fix a case like this ABC.2CD ==> ABC._2CD - $tokens[1]=~s/(\.)([0-9])/$1_$2/; - - #get rid of the parens - $tokens[0]=~s/\{//; - - my $structure=$tokens[1]; - my $number=$tokens[0]; - - #create a hash for later use - $structureNames{ $structure } = $number; - -} - -#sort the hash based on the structure name -my @keys = sort { ( $a cmp $b); } ( keys %structureNames ); - -my @array = @keys; - -#init the key to some value.. -my $current = @keys; -my @name; -my @spaces; - -push(@spaces," "); -push(@spaces," "); - -# start the file off with a namespace -printf "#ifndef __FAPI_SPY_IDS_H__\n"; -printf "#define __FAPI_SPY_IDS_H__ \n\n"; -printf "namespace FAPI_SPY_NAMES \n { \n\n"; - -# look at every entry in the array of names.. -foreach my $value (@array) -{ - # segment the name and then search for all - # entries which have the first value the same - # and then process those values - my @members = split(/\./, $value ); - my $member = $members[0]; - @name = (); - - my $size = @members; - - #once we go in here we wont need to look at this value again - if( $member ne $current ) - { - push(@name,$member); - - if( $size > 1 ) - { - - # add some readability; - printf "@spaces"; - my $extern = "extern struct " . $member . "_component \n"; - printf "$extern"; - printf "@spaces"; - printf"{\n"; - # grab every value out of the array which matches our query - my @selected = @keys; - @selected = grep( m/^$member\b/, @selected); - # modify the stucture names to remove the first member - my @filtered = map { (my $new = $_) =~ s/$member\.//; $new} @selected; - $current = $member; - # passing the shortend structure names - buildStructures( @filtered ); - printf "@spaces"; - printf"} $member;\n"; - } - else - { - # make the structure back into a name and use it go get - # the value from the hash we made eariler -- its a global - my $name = join(".", @name ); - my $number = 0; - $number = $structureNames{ $name }; - my $struct = "struct " . $member . "_comp"; - addTest( $name, $number ); - printf "@spaces"; - printf "$struct\n"; - printf "@spaces"; - printf "{\n"; - printf "@spaces"; - printf" static const unsigned int value = $number;\n"; - printf "@spaces"; - printf "} $member;\n"; - } - } - -} -# close out the namespace in the file -printf "};\n"; -printf "#endif\n"; -close OUTFILE; -close IDFILE; -closeTest(); -#done - -#------------------------------------------------------------------------------ -# Subroutines -#------------------------------------------------------------------------------ -sub buildStructures( \@ ) -{ - my( $structures ) = @_; - - my @structures = @$structures; - - my $current = 0; - my $member = 0; - - push( @spaces, " " ); - push( @spaces, " " ); - - foreach my $value (@structures ) - { - my @members = split(/\./, $value ); - my $member = $members[0]; - push( @name, $member ); - - my $size = @members; - #once we go in here we wont need to look at this value again - if( $member ne $current ) - { - if( $size > 1 ) - { - $somenumber += 1; - my $struct = "struct " . $member . "_comp" . $somenumber . "\n"; - printf "@spaces"; - printf $struct; - printf "@spaces"; - printf "{\n"; - # grab every value out of the array which matches our query - my @selected = grep( m/^$member\b/, @structures); - my @filtered = map { (my $new = $_) =~ s/$member\.//; $new} @selected; - $current = $member; - buildStructures( @filtered ); - #take off the last struture member name - #from the array - printf "@spaces"; - printf ("} $member;\n"); - } - else - { - # make the structure back into a name and use it go get - # the value from the hash we made eariler -- its a global - my $name = join(".", @name ); - my $number = 0; - $number = $structureNames{ $name }; - my $struct = "struct " . $member . "_comp"; - addTest( $name, $number ); - printf "@spaces"; - printf "$struct\n"; - printf "@spaces"; - printf "{\n"; - printf "@spaces"; - printf" static const unsigned int value = $number;\n"; - printf "@spaces"; - printf "} $member;\n"; - } - } - pop(@name); - } - pop( @spaces ); - pop( @spaces ); - -} - - -sub createTest() -{ - printf( UTFILE "#include <fapiSpyIds.H>\n"); - printf( UTFILE "#include \"s1_reduced.h\"\n\n"); - printf( UTFILE "#include <iostream>\n\n"); - printf( UTFILE "#define fspSpyId(DATA) FAPI_SPY_NAMES::DATA.value\n"); - printf( UTFILE "int main( void )\n { \n"); - printf( UTFILE "unsigned int totalTests = 0; \n"); - printf( UTFILE "unsigned int failedTests = 0; \n"); -} -sub closeTest() -{ - - printf( UTFILE "if( failedTests )\n { \n"); - printf( UTFILE "std::cout << failedTests << \" of \" << totalTests << \" tests failed \" << std::endl;" ); - printf( UTFILE "}\n"); - printf( UTFILE "else { std::cout << \"+++++ SUCCESS +++++\" << std::endl; \ - std::cout << totalTests << \" TESTS PASSED\" << std::endl; }" ); - printf( UTFILE "\n\n}\n"); - close(UTFILE); -} - -sub addTest( $$ ) -{ - my( $name, $number ) = @_; - - # create a name which the FSP understands - my $fspName = $name; - $fspName =~ s/__P__/_/g; - $fspName =~ s/\._/\./g; - $fspName =~ s/\./_/g; - - $fspName = "SPY_" . $fspName; - - $fspName =~ s/ //g; -# $fspName =~ s/__/_/g; - - printf( UTFILE "totalTests++; if ( fspSpyId( $name ) != $fspName)\n"); - printf( UTFILE "{ std::cout << \"spy values dont match\" << std::endl; failedTests++; }\n"); - -} diff --git a/src/usr/hwpf/fapi/fapiCreateIfAttrService.pl b/src/usr/hwpf/fapi/fapiCreateIfAttrService.pl deleted file mode 100755 index e1dc082af..000000000 --- a/src/usr/hwpf/fapi/fapiCreateIfAttrService.pl +++ /dev/null @@ -1,312 +0,0 @@ -#!/usr/bin/perl -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/hwpf/fapi/fapiCreateIfAttrService.pl $ -# -# OpenPOWER HostBoot Project -# -# Contributors Listed Below - COPYRIGHT 2011,2014 -# [+] International Business Machines Corp. -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. See the License for the specific language governing -# permissions and limitations under the License. -# -# IBM_PROLOG_END_TAG -# $Id: fapiCreateIfAttrService.pl,v 1.9 2014/04/21 18:35:11 mjjones Exp $ -# 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 -# mjjones 12/12/11 Support all attributes if no if-attr -# files specified (for Cronus) -# mjjones 01/13/12 Use new ReturnCode interfaces -# mjjones 02/08/12 Handle attribute files with 1 entry -# mjjones 06/12/12 Handle privileged attributes -# mjjones 09/28/12 Minor change to add FFDC on error -# mjjones 10/26/12 Output attrId/targType on error -# -# End Change Log ****************************************************** - -use strict; - -#------------------------------------------------------------------------------ -# Print Command Line Help -#------------------------------------------------------------------------------ -my $numArgs = $#ARGV + 1; -if ($numArgs < 3) -{ - 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 if-attr files (containing the\n"); - print (" attributes used by the initfile) and attribute XML files\n"); - print (" (containing all HWPF attributes) and create the\n"); - print (" fapiGetInitFileAttr() function in a file called\n"); - print (" fapiAttributeService.C. Only the attributes specified in\n"); - print (" the if-attr files are supported. If no if-attr files are\n"); - print (" specified then all attributes are supported\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"; -print ASFILE "#include <fapiChipEcFeature.H>\n"; -print ASFILE "#include <fapiPlatTrace.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 $numIfAttrFiles = 0; -my @attrIds; - -#------------------------------------------------------------------------------ -# Element names -#------------------------------------------------------------------------------ -my $attribute = 'attribute'; - -#------------------------------------------------------------------------------ -# 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. - #---------------------------------------------------------------------- - $numIfAttrFiles++; - 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. The ForceArray option ensures that there is an - # array of attributes even if there is only one attribute in the file - #---------------------------------------------------------------------- - my $attributes = $xml->XMLin($infile, ForceArray => [$attribute]); - - #---------------------------------------------------------------------- - # 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. If no if-attr - # files were specified then support all attributes - #------------------------------------------------------------------ - my $match = 0; - - if ($numIfAttrFiles) - { - foreach my $attrId (@attrIds) - { - if ($attr->{id} eq $attrId) - { - $match = 1; - last; - } - } - } - else - { - $match = 1; - } - - 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"; - - if (exists $attr->{privileged}) - { - print ASFILE " l_rc = FAPI_ATTR_GET_PRIVILEGED($attr->{id}, i_pTarget, l_attr);\n"; - } - else - { - 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 ID: 0x%x\", i_id);\n"; -print ASFILE " l_rc.setFapiError(FAPI_RC_INVALID_ATTR_GET);\n"; -print ASFILE " l_rc.addEIFfdc(0, &i_id, sizeof(i_id));\n"; -print ASFILE " }\n\n"; -print ASFILE " if (l_rc)\n"; -print ASFILE " {\n"; -print ASFILE " if (i_pTarget)\n"; -print ASFILE " {\n"; -print ASFILE " FAPI_ERR(\"fapiGetInitFileAttr: Error getting attr ID 0x%x from targType 0x%x\",\n"; -print ASFILE " i_id, i_pTarget->getType());\n"; -print ASFILE " }\n"; -print ASFILE " else\n"; -print ASFILE " {\n"; -print ASFILE " FAPI_ERR(\"fapiGetInitFileAttr: Error getting attr ID 0x%x from system target\",\n"; -print ASFILE " i_id);\n"; -print ASFILE " }\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/fapiCreateL3DeltaVals.pl b/src/usr/hwpf/fapi/fapiCreateL3DeltaVals.pl deleted file mode 100755 index 3ec91df6d..000000000 --- a/src/usr/hwpf/fapi/fapiCreateL3DeltaVals.pl +++ /dev/null @@ -1,271 +0,0 @@ -#!/usr/bin/perl -w -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/hwpf/fapi/fapiCreateL3DeltaVals.pl $ -# -# OpenPOWER HostBoot Project -# -# Contributors Listed Below - COPYRIGHT 2013,2015 -# [+] International Business Machines Corp. -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. See the License for the specific language governing -# permissions and limitations under the License. -# -# IBM_PROLOG_END_TAG -# $Id: fapiCreateL3DeltaVals.pl,v 1.4 2014/12/17 23:43:11 thi Exp $ -# -# Purpose: This perl script will parse HWP Attribute XML files -# and add attribute information to a file called fapiL3DeltaDataAttr.H -# -# Author: Dale Peterson -# Last Updated: 09/20/2013 -# -# Version: 1.0 -# -# Change Log ********************************************************** -# -# Flag Track# Userid Date Description -# ---- -------- -------- -------- ----------- -# 873826 dpeterso 09/16/13 Based on fapiCreatePllRingAttrVals.pl -# 920311 whs 03/23/14 PROC_EX_FUNC_L3_LENGTH from -# mrw to hwp accessor -# -# -# End Change Log ****************************************************** - -use strict; -use Cwd 'chdir'; -use Env; - -sub help; - -my $ProgName = "fapiCreateL3DeltaVals.pl"; -my $ringAttrFile; -my $outputPwd; -my $DEBUG = 0; -my $VERBOSE = 0; -my $chip = ""; -my $ec = ""; -my $revision = ""; -my $fileName = "fapiL3DeltaDataAttr.H"; - -my @fileList = (); -#Pull out the args passed in -&parseArgs; - -my $outputFile = "$outputPwd" . "$fileName"; -my $line = ""; - -my $count = 0; -my $dataCount = 0; - -# Start to generate header file. - -open (OUTFILE, ">$outputFile") or die "Couldn't open $outputFile for output. \n"; - -#Initial data types and definitions here - -print OUTFILE "// fapiL3DeltaDataAttr.H\n"; -print OUTFILE "// This file is generated by perl script fapiCreateL3DeltaVals.pl\n"; -print OUTFILE "\n"; -print OUTFILE "\n"; -print OUTFILE "#ifndef FAPIL3DELTADATAATTR_H_\n"; -print OUTFILE "#define FAPIL3DELTADATAATTR_H_\n"; -print OUTFILE "//----------------------------------------------------------------------\n"; -print OUTFILE "// Includes\n"; -print OUTFILE "//----------------------------------------------------------------------\n"; -print OUTFILE "#include <stdlib.h>\n"; -print OUTFILE "\n"; -print OUTFILE "#include <fapiAttributeIds.H>\n"; -print OUTFILE "\n"; -print OUTFILE "#define DELTA_DATA_SIZE 64\n"; - - -# Create array structure for L3_DELTA_DATA attribute -print OUTFILE "struct L3_DELTA_DATA_ATTR {\n"; -print OUTFILE " uint8_t l_ATTR_SELECT;\n"; -print OUTFILE " uint8_t l_ATTR_CHIPTYPE;\n"; -print OUTFILE " uint8_t l_ATTR_EC;\n"; -print OUTFILE " uint32_t l_ATTR_BIT_LENGTH;\n"; -print OUTFILE " uint32_t l_ATTR_L3_DELTA_DATA[DELTA_DATA_SIZE];\n"; -print OUTFILE "};\n"; -print OUTFILE "\n"; -print OUTFILE "\n" . "const L3_DELTA_DATA_ATTR L3_DELTA_DATA_array [] = {\n"; - -# Loop over all attribute files -foreach $ringAttrFile (@fileList) -{ - if ($ringAttrFile =~ m"(\S+/)?(\S+?)_(\d+?)_winkle_ring.attributes") { - $chip = $2; - $ec = $3; - } else - { - die "$ProgName ERROR : Couldn't parse chip type and ec from file $ringAttrFile \n\n"; - } - my $count = 0; - my $dataCount = 0; - my $dataArrayString = ""; - my $selectVal = 0; - my $lengthVal = 0; - -# open the winkle ring attribute file - open (FILE, "$ringAttrFile") or die "Couldn't open $ringAttrFile for input.\n"; - - if ($ringAttrFile =~ m"\S+/(\S+)") { - my $fileName = $1; - my $temp = `head -1 $ringAttrFile`; - if ($temp =~ m"Id: $fileName,v (\S+)") { - $revision = $1; - } - } - - if (($DEBUG) || ($VERBOSE)) - { - print "Chip: $chip \n"; - print "EC: $ec \n"; - print "File: $ringAttrFile \n"; - print "Output File: $outputFile\n"; - } - - - #Embed some version info - print OUTFILE "/**\n"; - print OUTFILE " \@kdbfile $ringAttrFile\n"; - print OUTFILE " \@chip $chip\n"; - print OUTFILE " \@ec $ec\n"; - print OUTFILE " \@version $revision\n"; - print OUTFILE "*/\n"; - - while (<FILE>) - { - # Each section we are interested in begins with ===BEGIN and ends with ===END - if (/\===BEGIN/../\===END/) { - # Keep track of how many instances we have in the file and reset some sub-counters. - if (/\===BEGIN/) - { - $count++; - $dataCount = 0; - } - - # Store select value in array - if ($_ =~ m"^#SELECT=(\d)") - { - $selectVal = $1; - } - if ($_ =~ m"^ATTR_PROC_EX_FUNC_L3_LENGTH u32\s+(\d+)\s+") - { - $lengthVal = $1; - - if ($selectVal != ($count-1)) - { - die "$ProgName ERROR: Select value in file $ringAttrFile does not appear to be sequential. There may be a script problem or a corrupted ring attribute file.\n"; - } - - my $chipEnum = 0; - # Map chip type to fapi attribute enum values (p8=01, s1=02 - if ($chip eq "s1") - { - $chipEnum = "fapi::ENUM_ATTR_NAME_MURANO"; - } - elsif ($chip eq "p8") - { - $chipEnum = "fapi::ENUM_ATTR_NAME_VENICE"; - } - elsif ($chip eq "n1") - { - $chipEnum = "fapi::ENUM_ATTR_NAME_NAPLES"; - } - else - { - die "$ProgName ERROR: Chip type $chip not supported by this script. Either the ring attribute file is in error or support for the new chip type needs to be added.\n"; - } - print OUTFILE "{\n"; - print OUTFILE " $selectVal, \t// ATTR_PROC_PBIEX_ASYNC_SEL \n"; - print OUTFILE " $chipEnum, \t// CHIP TYPE \n"; - print OUTFILE " 0x$ec, \t// EC LEVEL \n"; - print OUTFILE " $lengthVal, \t// RING LENGTH \n"; - print OUTFILE " {\n"; - } - - # Store values in array - if ($_ =~ m"^ATTR_PROC_EX_FUNC_L3_DELTA_DATA\[(\d+)\]\s+\S+\s+(\S+)") - { - if ($dataCount != $1) - { - die "$ProgName: ERROR: Data array index value in file $ringAttrFile does not appear to be sequential. There may be a script problem or a corrupted ring attribute file.\n"; - } - $dataCount++; - $dataArrayString = $dataArrayString . $2 . ", "; - # If this is the last entry in the array (delta data size = 64 - if ($dataCount eq 64) - { - print OUTFILE " $dataArrayString\n"; - print OUTFILE " }, // ATTR_PROC_EX_FUNC_L3_DELTA_DATA\n"; - print OUTFILE "},\n"; - $dataArrayString = ""; - } - } - } - } - - close (FILE); - -} -print OUTFILE "}; \n\n"; - -print OUTFILE "#endif // FAPIL3DELTADATAATTR_H_\n"; -close (OUTFILE); -exit 0; - -sub help { - printf("Usage: $ProgName <output directory> [<attributes-file1> [<attributes-file2> ...]] [--help|-h]\n"); - printf("Generates C header file from KB winkle_ring.attributes file(s). \n"); - printf("Example: $ProgName \$PWD p8_10_winkle_ring.attributes s1_10_winkle_ring.attributes -v\n\n"); - exit(0); -} - -sub parseArgs { - #Note that arg 0 MUST be output dir. If no args are specified, usage is printed. - if (!defined $ARGV[0]) - { - &help; - } - - # Output directory is first parameter - $outputPwd = $ARGV[0]; - $outputPwd .= "/"; - - foreach my $argnum (1 .. $#ARGV) - { - my $Arg = $ARGV[$argnum]; - - if ($Arg =~ m"^--debug" || $Arg =~ m"^-d") - { - $DEBUG = 1; - } - elsif ($Arg =~ m"^--verbose" || $Arg =~ m"^-v") - { - $VERBOSE = 1; - } - elsif ($Arg =~ m"^--help" || $Arg =~ m"^-h") - { - &help; - exit 1; - } - else - { - push(@fileList,$Arg); - } - } -} diff --git a/src/usr/hwpf/fapi/fapiCreatePllRingAttrVals.pl b/src/usr/hwpf/fapi/fapiCreatePllRingAttrVals.pl deleted file mode 100755 index 552d76e58..000000000 --- a/src/usr/hwpf/fapi/fapiCreatePllRingAttrVals.pl +++ /dev/null @@ -1,689 +0,0 @@ -#!/usr/bin/perl -w -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/hwpf/fapi/fapiCreatePllRingAttrVals.pl $ -# -# OpenPOWER HostBoot Project -# -# COPYRIGHT International Business Machines Corp. 2013,2014 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. See the License for the specific language governing -# permissions and limitations under the License. -# -# IBM_PROLOG_END_TAG -# $Id: fapiCreatePllRingAttrVals.pl,v 1.4 2014/01/13 15:49:47 dedahle Exp $ -# -# Purpose: This perl script will parse HWP Attribute XML files -# and add attribute information to a file called fapiAttributeIds.H -# -# Author: Kahn Evans -# Last Updated: 09/16/2013 -# -# Version: 1.0 -# -# Change Log ********************************************************** -# -# Flag Track# Userid Date Description -# ---- -------- -------- -------- ----------- -# dpeterso 09/16/13 Modified Kahn Evans/John Farrugia script to gen .H -# -# -# End Change Log ****************************************************** - -use strict; -use Cwd 'chdir'; -use Env; - -sub help; - -my $ProgName = "fapicreatePllRingAttrVals.pl"; -my @args = @ARGV; -my $Arg = ""; -#my $ekbPathHead = "/cronus/ekb"; -my $ekbPathHead = "."; -my $kbPath = "$ekbPathHead/eclipz/chips/"; -#my $kbPath = "/cronus/ekb/eclipz/chips/"; -my $pllFile; -my $callingPwd; -my $DEBUG = 0; -my $VERBOSE = 0; -my $chip = ""; -my $capChip = ""; -my $ec = ""; -my $fileName = "fapiPllRingAttr.H"; - -my %cronusNameToFapi = ( - ATTR_MSS_FREQ => "MEMB_MEM_FREQ", - ATTR_FREQ_X_mem => "MEMB_NEST_FREQ", - ATTR_FREQ_A => "PU_ABUS_FREQ", - ATTR_FREQ_PB => "PU_DMI_FREQ", - ATTR_NEST_FREQ_MHZ => "PU_NEST_FREQ", - ATTR_FREQ_PCIE => "PU_PCIE_FREQ", - ATTR_NO_FAPI_ATTR_ALWAYS_100 => "PU_PCIE_REF_CLOCK", - ATTR_FREQ_PROC_REFCLOCK => "PU_REF_CLOCK", - ATTR_FREQ_X => "PU_XBUS_FREQ", - ); - -# Frequencies to query for each attribute type -# NOTE: For each attribute the frequencies must be listed in alphabetical order -my %attrToFreqs = ( - ATTR_PROC_AB_BNDY_PLL => [ "ATTR_FREQ_A" ], - ATTR_PROC_AB_BNDY_PLL_FOR_DCCAL => [ "ATTR_FREQ_A" ], - ATTR_PROC_AB_BNDY_PLL_FOR_RUNTIME => [ "ATTR_FREQ_A" ], - ATTR_PROC_PB_BNDY_DMIPLL => [ "ATTR_FREQ_PB" ], - ATTR_PROC_PB_BNDY_DMIPLL_FOR_DCCAL => [ "ATTR_FREQ_PB" ], - ATTR_PROC_PB_BNDY_DMIPLL_FOR_RUNTIME => [ "ATTR_FREQ_PB" ], - ATTR_PROC_PCI_BNDY_PLL => [ "ATTR_FREQ_PCIE" ], - ATTR_PROC_PERV_BNDY_PLL => [ "ATTR_NEST_FREQ_MHZ", "ATTR_NO_FAPI_ATTR_ALWAYS_100", "ATTR_FREQ_PROC_REFCLOCK", "ATTR_FREQ_X" ], - ATTR_MEMB_TP_BNDY_PLL => [ "ATTR_MSS_FREQ", "ATTR_FREQ_X_mem" ], - ATTR_MEMB_TP_BNDY_PLL_FOR_DCCAL => [ "ATTR_MSS_FREQ", "ATTR_FREQ_X_mem" ], - ATTR_MEMB_TP_BNDY_PLL_FOR_RUNTIME => [ "ATTR_MSS_FREQ", "ATTR_FREQ_X_mem" ], - ATTR_MEMB_TP_BNDY_PLL_NEST4000_MEM1066 => [ "ATTR_MSS_FREQ", "ATTR_FREQ_X_mem" ], - ATTR_MEMB_TP_BNDY_PLL_NEST4000_MEM1333 => [ "ATTR_MSS_FREQ", "ATTR_FREQ_X_mem" ], - ATTR_MEMB_TP_BNDY_PLL_NEST4000_MEM1600 => [ "ATTR_MSS_FREQ", "ATTR_FREQ_X_mem" ], - ATTR_MEMB_TP_BNDY_PLL_NEST4000_MEM1866 => [ "ATTR_MSS_FREQ", "ATTR_FREQ_X_mem" ], - ATTR_MEMB_TP_BNDY_PLL_NEST4800_MEM1066 => [ "ATTR_MSS_FREQ", "ATTR_FREQ_X_mem" ], - ATTR_MEMB_TP_BNDY_PLL_NEST4800_MEM1333 => [ "ATTR_MSS_FREQ", "ATTR_FREQ_X_mem" ], - ATTR_MEMB_TP_BNDY_PLL_NEST4800_MEM1600 => [ "ATTR_MSS_FREQ", "ATTR_FREQ_X_mem" ], - ATTR_MEMB_TP_BNDY_PLL_NEST4800_MEM1866 => [ "ATTR_MSS_FREQ", "ATTR_FREQ_X_mem" ], - ); - -# Get the path the script was called from so we can get back to it later -$callingPwd = $ARGV[0]; -$callingPwd .= "/"; - -my $fileString = ""; -#Pull out the args passed in -&parseArgs; - -#Full path of the file -$pllFile = "$kbPath" . "$chip\/" . "working\/ec_" . "$ec\/" . "$chip" . "_" . "$ec" . "_pll_ring.attributes"; - -#output file path and name -if ($chip ne ""){ - $capChip = ucfirst($chip); - $fileName = $capChip . "Ec" . "$ec" . "Pll.H"; -} - -my $outputFile = "$callingPwd" . "$fileName"; -my $line = ""; - -# Start to generate header file. - -open (OUTFILE, ">$outputFile") or die "Couldn't open $outputFile for output. \n"; - -#Initial data types and definitions here - -print OUTFILE "// fapiPllRingAttr.H\n"; -print OUTFILE "// This file is generated by perl script fapiCreatePllRingAttrVals.pl\n"; -print OUTFILE "\n"; -print OUTFILE "#ifndef FAPIPLLRINGATTR_H_\n"; -print OUTFILE "#define FAPIPLLRINGATTR_H_\n"; -print OUTFILE "//----------------------------------------------------------------------\n"; -print OUTFILE "// Includes\n"; -print OUTFILE "//----------------------------------------------------------------------\n"; -print OUTFILE "#include <stdlib.h>\n"; -print OUTFILE "\n"; -print OUTFILE "#include <fapiAttributeIds.H>\n"; -print OUTFILE "\n"; -print OUTFILE "using namespace fapi;\n"; -print OUTFILE "\n"; -print OUTFILE "#define MAX_PLL_RING_SIZE_BYTES 256\n"; -print OUTFILE "\n"; - - -# Create array structures for PLL attributes based on the number of keys -my %freqCountHash = (); -foreach my $val (sort (values %attrToFreqs)) { - my $numKeys = scalar @$val; - if (!$freqCountHash{$numKeys}) { - $freqCountHash{$numKeys} = 1; - print OUTFILE "struct PLL_RING_ATTR_WITH_" . $numKeys . "_KEYS {\n"; - for (my $i=1; $i <= $numKeys; $i++) { - print OUTFILE " uint32_t l_freq_" . $i . ";\n"; - } - print OUTFILE " uint16_t l_ATTR_PLL_RING_BIT_LENGTH;\n"; - print OUTFILE " uint8_t l_ATTR_PLL_RING_BYTE_LENGTH;\n"; - print OUTFILE " uint8_t l_ATTR_PLL_RING_DATA [MAX_PLL_RING_SIZE_BYTES];\n"; - print OUTFILE " uint8_t l_ATTR_PLL_RING_FLUSH [MAX_PLL_RING_SIZE_BYTES];\n"; - print OUTFILE "};\n"; - print OUTFILE "\n"; - } -} - -print OUTFILE "\n"; - -$fileString = "ls -1 $fileString |"; - -open(ALLFILES, "$fileString") or die die "$ProgName ERROR : Couldn't open list of files $fileString\n"; - -# Loop over all attribute files found -while (defined($line = <ALLFILES>)) -{ - $pllFile = $line; - if ($pllFile =~ m"\S+/(\S+?)_(\d+?)_pll_ring.attributes") - { - $chip = $1; - $capChip = ucfirst($chip); - $ec = $2; - } else { - die "$ProgName ERROR : Couldn't parse chip type and ec from file $pllFile \n\n"; - } - - my $count = 0; - my @envType ; - my @freqVals; - my @freqType; - my @uniqFreqType; - my $uniqFreqTypeCount = 0; - my @pllDataName; - my @pllFlushName; - my @pllDataArrayNames; - my @pllDataArrayVals; - my @pllFlushArrayNames; - my @pllFlushArrayVals; - my @pllRingLength; - my @pllDataSize; - my @pllFlushSize; - my @freqValSize; - my @uniqAttrs; - my @uniqAttrSize; - my @uniqFlushAttrs; - my @uniqFlushAttrSize; - my $uniqAttrCount = 0; - my $uniqFlushAttrCount = 0; - my $freqCount = 0; - my $dataCount = 0; - my $flushCount = 0; - my $haveHwVals = 0; - - # open the pll attribute file - open (FILE, "$pllFile") or die "Couldn't open $pllFile for input.\n"; - - - if (($DEBUG) || ($VERBOSE)) - { - print "Chip: $chip \n"; - print "EC: $ec \n"; - print "File: $pllFile \n"; - print "Output File: $outputFile\n"; - } - - while (<FILE>) - { - # Each section we are interested in begins with ===BEGIN and ends with ===END - if (/\===BEGIN/../\===END/) - { - # Keep track of how many instances we have in the file and reset some sub-counters. - if (/\===BEGIN/) - { - $count++; - $freqCount = 0; - $dataCount = 0; - $flushCount = 0; - } - # Determine if we are dealing with SIM or HW and store it in an array - if (m/\#ENV\=/) - { - my $env = $_; - chomp $env; - $env =~ tr/\#ENV\=//d ; - push(@envType,$env); - if ($env eq "HW") { - $haveHwVals = 1; - } - } - - # Determine any frequency dependent values and store them in arrays - # Also keep track of the size. - if ((m/\#PU_/) || (m/\#MEMB_/)) - { - $freqCount++; - my $freq = $_; - chomp $freq; - ($freqType[$count - 1][$freqCount - 1], $freqVals[$count - 1][$freqCount - 1]) = split " = ",$freq; - # Strip the # off the name and convert to lower case - $freqType[$count - 1][$freqCount - 1] =~ tr/\#//d ; - $freqValSize[$count - 1] = $freqCount; - - # Determine if this is the first instance of a particular name - # If it is, then store it away in the uniq array. - if ($uniqFreqTypeCount == 0) - { - $uniqFreqType[$uniqFreqTypeCount] = $freqType[$count - 1][$freqCount - 1]; - $uniqFreqTypeCount++; - } - else - { - my $uniqFreq = 1; - for (my $i=0; $i < $uniqFreqTypeCount; $i++) - { - if ($freqType[$count - 1][$freqCount - 1] eq $uniqFreqType[$i]) - { - $uniqFreq = 0; - } - } - if ($uniqFreq == 1) - { - $uniqFreqType[$uniqFreqTypeCount] = $freqType[$count - 1][$freqCount - 1]; - $uniqFreqTypeCount++; - } - } - - } - - # Determine the PLL_DATA name and store in an array - if ((m/_DATA/) && (m/\#/)) - { - my ($pllName, $garbage) = split " = ",$_; - #Remove the leading # - $pllName =~ tr/\#//d; - #Remove whitespace at the end. - $pllName =~ s/\s+$//; - push(@pllDataName,$pllName); - - # Determine if this is the first instance of a particular name - # If it is, then store it away in the uniq array. - if ($count == 1) - { - $uniqAttrs[$count - 1] = $pllName; - $uniqAttrCount++; - } - else - { - my $uniq = 1; - for (my $i=0; $i < $uniqAttrCount; $i++) - { - if ($pllName eq $uniqAttrs[$i]) - { - $uniq = 0; - } - } - if ($uniq == 1) - { - $uniqAttrs[$uniqAttrCount] = $pllName; - $uniqAttrCount++; - } - } - - } - - - # Determine the PLL_FLUSH name and store in an array - if ((m/_FLUSH/) && (m/\#/) && !(m/GEN_FLUSH/)) - { - my ($pllFlush, $garbage) = split " = ",$_; - #Remove # at the beginning - $pllFlush =~ tr/\#//d; - #Remove whitespace at the end. - $pllFlush =~ s/\s+$//; - push(@pllFlushName,$pllFlush); - - # Determine if this is the first instance of a particular name - # If it is, then store it away in the uniq array. - if ($count == 1) - { - $uniqFlushAttrs[$count - 1] = $pllFlush; - $uniqFlushAttrCount++; - } - else - { - my $uniqFlush = 1; - for (my $i=0; $i < $uniqFlushAttrCount; $i++) - { - if ($pllFlush eq $uniqFlushAttrs[$i]) - { - $uniqFlush = 0; - } - } - if ($uniqFlush == 1) - { - $uniqFlushAttrs[$uniqFlushAttrCount] = $pllFlush; - $uniqFlushAttrCount++; - } - } - - - } - # No flush values exist. Create a blank entry to prevent errors during flush looping output. - elsif (m/GEN_FLUSH\=NO/) { - my $pllFlush = ""; - push(@pllFlushName,$pllFlush); - - } - - #Store bit length in an array.. - if ($_ =~ m/_LENGTH\s+u\d+\s+(\d+)/) - { - $pllRingLength[$count - 1] = $1; - } - - #Determine the actual data names and values and store them in arrays. - #Also keep track of the size. - if ((m/_DATA/) && (m/\[/)) - { - my $garbage; - $dataCount++; - chomp $_; - ($pllDataArrayNames[$count - 1][$dataCount - 1], $garbage, $pllDataArrayVals[$count - 1][$dataCount - 1]) = split " ",$_; - $pllDataSize[$count - 1] = $dataCount; - } - - #Determine the actual flush names and values and store them in arrays. - #Also keep track of the size. - if ((m/_FLUSH/) && (m/\[/)) - { - my $garbage; - $flushCount++; - chomp $_; - ($pllFlushArrayNames[$count - 1][$flushCount - 1], $garbage, $pllFlushArrayVals[$count - 1][$flushCount - 1]) = split " ",$_; - $pllFlushSize[$count - 1] = $flushCount; - } - - } - - } - close (FILE); - - #Fill in some other values now that we need - for (my $q=0; $q < $uniqAttrCount; $q++) - { - for (my $r=0; $r < $count; $r++) - { - if ($uniqAttrs[$q] eq $pllDataName[$r]) - { - $uniqAttrSize[$q] = $pllDataSize[$r]; - last; - } - } - } - - for (my $q=0; $q < $uniqFlushAttrCount; $q++) - { - for (my $r=0; $r < $count; $r++) - { - if ($uniqFlushAttrs[$q] eq $pllFlushName[$r]) - { - $uniqFlushAttrSize[$q] = $pllFlushSize[$r]; - last; - } - } - } - - - #Embed some version info - print OUTFILE "/**\n"; - print OUTFILE " \@kdbfile $pllFile\n"; - print OUTFILE " \@chip $chip\n"; - print OUTFILE " \@ec $ec\n"; - print OUTFILE "*/\n"; - print OUTFILE "\n"; - - - ################################################################################# - # First loop over all instances of each uniq attribute within the pll data - # Then loop over all HW and SIM instances - # Then check the frequency dependencies - # Output the attr values - # Repeat all of the above for pll flush values. - ################################################################################# - - - #First display the HW attr values - ### PLL_DATA VALUES ### - for (my $x = 0; $x < $uniqAttrCount; $x++) - { - my %freqHash = (); - my $firstAttr = 1; - my $simString = "\n"; - my $freqString = ""; - my $isDefHw = 0; - my $isDefSim = 0; - my $arrayIndex = 0; - my @freqList = (); - my $attr_prefix = ""; - my $y = 0; - - if ($uniqAttrs[$x] =~ m"(\S+)_DATA") - { - $attr_prefix = $1; - $y = scalar @{$attrToFreqs{$attr_prefix}}; - } - print OUTFILE "\n" . "const PLL_RING_ATTR_WITH_" . $y . "_KEYS $capChip" . "_" . $ec . "_" . "$uniqAttrs[$x]_array [] = {\n"; - - for (my $y=0 ; $y < $count; $y++) { - if ($pllDataName[$y] eq $uniqAttrs[$x]) - { - if ($envType[$y] eq "HW") - { - #This attribute has HW values. - $isDefHw = 1; - if ($firstAttr == 1) - { - print OUTFILE "#ifdef HW\n"; - $firstAttr = 0; - $arrayIndex = 0; - } else - { - $arrayIndex++; - } - print OUTFILE " { // Entry $arrayIndex\n"; - %freqHash = (); - for (my $q=0; $q < $uniqFreqTypeCount; $q++) - { - $freqHash{$uniqFreqType[$q]} = 0; - } - for (my $z=0; $z < $freqValSize[$y]; $z++) { - $freqHash{$freqType[$y][$z]} = $freqVals[$y][$z]; - } - # foreach my $freq (sort keys %freqHash) { - if ($uniqAttrs[$x] =~ m"(\S+)_DATA") - { - my $attr_prefix = $1; - for (my $freqIdx = 0; $freqIdx <= $#{$attrToFreqs{$attr_prefix}}; $freqIdx++) - { - # Frequency is supported for this attribute - print OUTFILE " $freqHash{$cronusNameToFapi{$attrToFreqs{$attr_prefix}[$freqIdx]}}, \t// $attrToFreqs{$attr_prefix}[$freqIdx] = $cronusNameToFapi{$attrToFreqs{$attr_prefix}[$freqIdx]} \n"; - } - } - print OUTFILE " $pllRingLength[$y], \t// $pllDataName[$y] ring length\n"; - print OUTFILE " $pllDataSize[$y], \t// $pllDataName[$y] array length\n"; - # Add attr values here - print OUTFILE " { "; - for (my $attr_num = 0; $attr_num < $pllDataSize[$y]-1; $attr_num++) - { - print OUTFILE "$pllDataArrayVals[$y][$attr_num], "; - } - print OUTFILE " }, \t// $pllDataName[$y]\n"; - - if (defined $pllFlushSize[$y]) - { - print OUTFILE " { "; - for (my $attr_num = 0; $attr_num < $pllFlushSize[$y]-1; $attr_num++) - { - print OUTFILE "$pllFlushArrayVals[$y][$attr_num], "; - } - print OUTFILE " }, \t// $pllFlushName[$y]\n"; - } - - print OUTFILE " },\n"; - - } # end envType condition - - # For SIM values, there are a couple of assumptions: - # 1. No frequency values - # 2. Only one set of values per attribute - elsif ($envType[$y] eq "SIM") - { - $isDefSim = 1; - $simString = " \{ // Entry 0\n"; - %freqHash = (); - for (my $q=0; $q < $uniqFreqTypeCount; $q++) - { - $freqHash{$uniqFreqType[$q]} = 0; - } - # foreach my $freq (sort keys %freqHash) { - if ($uniqAttrs[$x] =~ m"(\S+)_DATA") - { - my $attr_prefix = $1; - for (my $freqIdx = 0; $freqIdx <= $#{$attrToFreqs{$attr_prefix}}; $freqIdx++) - { - # Frequency is supported for this attribute - # if ($attrToFreqs{$attr_prefix}[$freqIdx] eq $cronusNameToFapi{$freq}) { - $simString = $simString . " $freqHash{$cronusNameToFapi{$attrToFreqs{$attr_prefix}[$freqIdx]}}, \t// $attrToFreqs{$attr_prefix}[$freqIdx] = $cronusNameToFapi{$attrToFreqs{$attr_prefix}[$freqIdx]} \n"; - } - } - $simString = $simString . " $pllRingLength[$y], \t\t// $pllDataName[$y] ring length\n"; - $simString = $simString . " $pllDataSize[$y], \t\t// $pllDataName[$y] array length\n"; - $simString = $simString . " { "; - for (my $attr_num = 0; $attr_num < $pllDataSize[$y]-1; $attr_num++) - { - $simString = $simString . "$pllDataArrayVals[$y][$attr_num], "; - } - # Print final byte - $simString = $simString . " }, \t// $pllDataName[$y]\n"; - if (defined $pllFlushSize[$y]) - { - # $simString = $simString . " $pllFlushSize[$y], \t\t// $pllFlushName[$y]_LENGTH\n"; - $simString = $simString . " { "; - if ( $pllDataName[$y] =~ m"ATTR_PROC_PB_BNDY_DMIPLL_FOR_DCCAL") - { - print " pllFlushSize[y] = $pllFlushSize[$y] y = $y array size = $#pllFlushSize \n"; - } - for (my $attr_num = 0; $attr_num < $pllFlushSize[$y]-1; $attr_num++) - { - if ( $pllDataName[$y] =~ m"ATTR_PROC_PB_BNDY_DMIPLL_FOR_DCCAL") - { - print " pllFlushSize[y] = $pllFlushSize[$y] y = $y \n"; - } - $simString = $simString . "$pllFlushArrayVals[$y][$attr_num], "; - } - # Print final byte - $simString = $simString . " }, \t// $pllFlushName[$y]\n"; - } - $simString = $simString . " },\n"; - - } # end sim condition - else - { - # We shouldn't be here - print "fapicreatePllRingAttrVals.pl:ERROR: Unexpected environment type. Should only be HW or SIM. \n"; - exit(1); - } - - } # end pllDataName condition - - } # end for loop over all attributes - - - #This is where we insert the SIM values. - if (($isDefHw == 1) && ($isDefSim == 1)) - { - $simString = "#else\n" . $simString; - } - - print OUTFILE "$simString\n"; - - #Only display this if we had HW values. - if ($isDefHw == 1) - { - print OUTFILE "#endif\n"; - } - - print OUTFILE " };\n"; - - } # end for loop over uniq attributes - - if ($VERBOSE) - { - print "Number of sections in file: $count \n"; - print "Number of Freqs: @freqValSize \n"; - print "Number of Data Vals: @pllDataSize \n"; - print "Number of Flush Vals: @pllFlushSize \n"; - print "Uniq Freq Types: @uniqFreqType \n"; - print "Number of Uniq Freq Types: $uniqFreqTypeCount \n"; - print "Uniq Attrs: @uniqAttrs \n"; - print "Uniq Attr Size: @uniqAttrSize \n"; - print "Uniq Flush Attrs: @uniqFlushAttrs \n"; - print "Uniq Flush Attr Size: @uniqFlushAttrSize \n"; - print "Number of Uniq Attrs: $uniqAttrCount \n"; - print "Number of Uniq Flush Attrs: $uniqFlushAttrCount \n"; - - print "envType: @envType \n \n"; - print "pllDataName: @pllDataName \n \n"; - print "pllFlushName: @pllFlushName \n \n"; - - my $item1, my $item2; - print "\nfreqType: \n"; - foreach $item1 (@freqType) - { - foreach $item2 (@{$item1}) - { - print "$item2 "; - } - print "\n"; - } - print "\nfreqVals: \n"; - foreach $item1 (@freqVals) - { - foreach $item2 (@{$item1}) - { - print "$item2 "; - } - print "\n"; - } - - } - -} - -print OUTFILE "#endif // FAPIPLLRINGATTR_H_\n"; -close (OUTFILE); - - - -sub help { - printf("Usage: fapicreatePllRingAttrVals.pl <output directory> [<attributes-file1> [<attributes-file2> ...] [-help|-h]\n"); - printf("Generates C header file from KB pll_ring.attributes file(s). \n"); - printf(" fapicreatePllRingAttrVals.pl -v\n"); - exit(0); -} - - - - -sub parseArgs { - #Note that arg 0 MUST be output dir - foreach my $argnum (1 .. $#ARGV) - { - my $infile = $ARGV[$argnum]; - - if ($Arg =~ m"^-debug" || $Arg =~ m"^-d") - { - $DEBUG = 1; - } - elsif ($Arg =~ m"^-verbose" || $Arg =~ m"^-v") - { - $VERBOSE = 1; - } - elsif ($Arg =~ m"^-help" || $Arg =~ m"^-h") - { - &help; - exit 1; - } - else - { - $fileString = "$fileString " . "$infile"; - } - } -} diff --git a/src/usr/hwpf/fapi/fapiCreateTpDbgAttrVals.pl b/src/usr/hwpf/fapi/fapiCreateTpDbgAttrVals.pl deleted file mode 100755 index f2c8d3f50..000000000 --- a/src/usr/hwpf/fapi/fapiCreateTpDbgAttrVals.pl +++ /dev/null @@ -1,249 +0,0 @@ -#!/usr/bin/perl -w -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: /afs/awd.austin.ibm.com/proj/p9/eclipz/KnowledgeBase/.cvsroot/eclipz/hwpf/working/hwp/tp_dbg_data_accessors/fapiCreateTpDbgAttrVals.pl,v $ -# -# OpenPOWER HostBoot Project -# -# Contributors Listed Below - COPYRIGHT 2013,2015 -# [+] International Business Machines Corp. -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. See the License for the specific language governing -# permissions and limitations under the License. -# -# IBM_PROLOG_END_TAG -# $Id: fapiCreateTpDbgAttrVals.pl,v 1.1 2015/05/07 20:11:12 thi Exp $ -# -# Purpose: This perl script will parse HWP Attribute XML files -# and add attribute information to a file called fapiTpDbgAttr.H -# -# Version: 1.0 -# -# Change Log ********************************************************** -# -# Flag Track# Userid Date Description -# ---- -------- -------- -------- ----------- -# 941745 thi 04/17/15 Created -# -# End Change Log ****************************************************** - -use strict; -use Cwd 'chdir'; -use Env; - -sub help; - -my $ProgName = "fapiCreateTpDbgAttrVals.pl"; -my $spyAttrFile; -my $outputPwd; -my $DEBUG = 0; -my $VERBOSE = 0; -my $chip = ""; -my $ec = ""; -my $revision = ""; -my $fileName = "fapiTpDbgDataAttr.H"; - -my @fileList = (); -#Pull out the args passed in -&parseArgs; - -my $outputFile = "$outputPwd" . "$fileName"; -my $line = ""; - -my $dataCount = 0; - -# Start to generate header file. - -open (OUTFILE, ">$outputFile") or die "Couldn't open $outputFile for output. \n"; - -#Initial data types and definitions here - -print OUTFILE "// fapiTpDbgDataAttr.H\n"; -print OUTFILE "// This file is generated by perl script fapiCreateTpDbgAttrVals.pl\n"; -print OUTFILE "\n"; -print OUTFILE "\n"; -print OUTFILE "#ifndef FAPI_TP_DBG_DATA_ATTR_H\n"; -print OUTFILE "#define FAPI_TP_DBG_DATA_ATTR_H\n"; -print OUTFILE "//----------------------------------------------------------------------\n"; -print OUTFILE "// Includes\n"; -print OUTFILE "//----------------------------------------------------------------------\n"; -print OUTFILE "#include <stdlib.h>\n"; -print OUTFILE "\n"; -print OUTFILE "#include <fapiAttributeIds.H>\n"; -print OUTFILE "\n"; -print OUTFILE "#define SPY_OFFSET_SIZE 24\n"; - - -# Create array structure for TP_DBG_DATA attribute -print OUTFILE "struct TP_DBG_DATA_ATTR {\n"; -print OUTFILE " uint8_t l_ATTR_CHIPTYPE;\n"; -print OUTFILE " uint8_t l_ATTR_EC;\n"; -print OUTFILE " uint32_t l_ATTR_RING_LENGTH;\n"; -print OUTFILE " uint32_t l_ATTR_SPY_LENGTH;\n"; -print OUTFILE " uint32_t l_ATTR_TP_DBG_DATA[SPY_OFFSET_SIZE];\n"; -print OUTFILE "};\n"; -print OUTFILE "\n"; -print OUTFILE "\n" . "const TP_DBG_DATA_ATTR TP_DBG_DATA_array [] = {\n"; - -# Loop over all attribute files -foreach $spyAttrFile (@fileList) -{ - if ($spyAttrFile =~ m"(\S+/)?(\S+?)_(\d+?)_tp_dbg_data.attributes") { - $chip = $2; - $ec = $3; - } else - { - die "$ProgName ERROR : Couldn't parse chip type and ec from file $spyAttrFile \n\n"; - } - my $dataArrayString = ""; - my $ringLengthVal = 0; - my $spyLengthVal = 0; - -# open the winkle ring attribute file - open (FILE, "$spyAttrFile") or die "Couldn't open $spyAttrFile for input.\n"; - - if ($spyAttrFile =~ m"\S+/(\S+)") { - my $fileName = $1; - my $temp = `head -1 $spyAttrFile`; - if ($temp =~ m"Id: $fileName,v (\S+)") { - $revision = $1; - } - } - - if (($DEBUG) || ($VERBOSE)) - { - print "Chip: $chip \n"; - print "EC: $ec \n"; - print "File: $spyAttrFile \n"; - print "Output File: $outputFile\n"; - } - - - #Embed some version info - print OUTFILE "/**\n"; - print OUTFILE " \@kdbfile $spyAttrFile\n"; - print OUTFILE " \@chip $chip\n"; - print OUTFILE " \@ec $ec\n"; - print OUTFILE " \@version $revision\n"; - print OUTFILE "*/\n"; - - while (<FILE>) - { - # Store select value in array - if ($_ =~ m"^ATTR_PROC_PERV_VITL_LENGTH u32\s+(\d+)\s+") - { - $dataCount = 0; - $ringLengthVal = $1; - - my $chipEnum = 0; - # Map chip type to fapi attribute enum values (p8=01, s1=02 - if ($chip eq "s1") - { - $chipEnum = "fapi::ENUM_ATTR_NAME_MURANO"; - } - elsif ($chip eq "p8") - { - $chipEnum = "fapi::ENUM_ATTR_NAME_VENICE"; - } - elsif ($chip eq "n1") - { - $chipEnum = "fapi::ENUM_ATTR_NAME_NAPLES"; - } - else - { - die "$ProgName ERROR: Chip type $chip not supported by this script. Either the spy attribute file is in error or support for the new chip type needs to be added.\n"; - } - print OUTFILE "{\n"; - print OUTFILE " $chipEnum, \t// CHIP TYPE \n"; - print OUTFILE " 0x$ec, \t// EC LEVEL \n"; - print OUTFILE " $ringLengthVal, \t// ATTR_PROC_PERV_VITL_LENGTH \n"; - } - - if ($_ =~ m"^ATTR_PROC_TP_VITL_SPY_LENGTH u32\s+(\d+)\s+") - { - $spyLengthVal = $1; - print OUTFILE " $spyLengthVal, \t// ATTR_PROC_TP_VITL_SPY_LENGTH \n"; - print OUTFILE " {\n"; - } - - # Store values in array - if ($_ =~ m"^ATTR_PROC_TP_VITL_SPY_OFFSETS\[(\d+)\]\s+\S+\s+(\S+)") - { - if ($dataCount != $1) - { - die "$ProgName: ERROR: Data array index value in file $spyAttrFile does not appear to be sequential. There may be a script problem or a corrupted spy attribute file.\n"; - } - $dataCount++; - $dataArrayString = $dataArrayString . $2 . ", "; - # If this is the last entry in the array (delta data size = 24) - if ($dataCount eq 24) - { - print OUTFILE " $dataArrayString\n"; - print OUTFILE " }, // ATTR_PROC_TP_VITL_SPY_OFFSETS\n"; - print OUTFILE "},\n"; - $dataArrayString = ""; - } - } - } - - close (FILE); - -} -print OUTFILE "}; \n\n"; - -print OUTFILE "#endif // FAPI_TP_DBG_DATA_ATTR_H\n"; -close (OUTFILE); -exit 0; - -sub help { - printf("Usage: $ProgName <output directory> [<attributes-file1> [<attributes-file2> ...]] [--help|-h]\n"); - printf("Generates C header file from KB tp_dbg_data.attributes file(s). \n"); - printf("Example: $ProgName \$PWD p8_20_tp_dbg_data.attributes -v\n\n"); - exit(0); -} - -sub parseArgs { - #Note that arg 0 MUST be output dir. If no args are specified, usage is printed. - if (!defined $ARGV[0]) - { - &help; - } - - # Output directory is first parameter - $outputPwd = $ARGV[0]; - $outputPwd .= "/"; - - foreach my $argnum (1 .. $#ARGV) - { - my $Arg = $ARGV[$argnum]; - - if ($Arg =~ m"^--debug" || $Arg =~ m"^-d") - { - $DEBUG = 1; - } - elsif ($Arg =~ m"^--verbose" || $Arg =~ m"^-v") - { - $VERBOSE = 1; - } - elsif ($Arg =~ m"^--help" || $Arg =~ m"^-h") - { - &help; - exit 1; - } - else - { - push(@fileList,$Arg); - } - } -} diff --git a/src/usr/hwpf/fapi/fapiErrorInfo.C b/src/usr/hwpf/fapi/fapiErrorInfo.C deleted file mode 100644 index d674d2907..000000000 --- a/src/usr/hwpf/fapi/fapiErrorInfo.C +++ /dev/null @@ -1,369 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/fapi/fapiErrorInfo.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -// $Id: fapiErrorInfo.C,v 1.13 2015/01/16 11:27:43 sangeet2 Exp $ -// $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/hwpf/working/fapi/fapiErrorInfo.C,v $ - -/** - * @file fapiErrorInfo.C - * - * @brief Implements the ErrorInfo structs and classes - */ - -/* - * Change Log ****************************************************************** - * Flag Defect/Feature User Date Description - * ------ -------------- ---------- ----------- ---------------------------- - * mjjones 08/05/2011 Created - * mjjones 08/24/2011 Added ErrorInfoGard. - * mjjones 09/22/2011 Major updates - * mjjones 03/16/2012 Add FfdcType. Remove copy - * ctor and assignment operator - * mjjones 08/14/2012 Merge Callout/Deconfig/Gard - * structures into one - * mjjones 09/19/2012 Replace FFDC type with ID - * mjjones 03/22/2013 Support Procedure Callouts - * mjjones 05/20/2013 Support Bus Callouts - * mjjones 06/24/2013 Support Children CDGs - * mjjones 08/26/2013 Support HW Callouts - * rjknight 09/24/2013 Support dimm callouts - * based on mba parent target - * whs 03/11/2014 Add FW traces to error logs - * sangeet2 01/16/2015 Modify ErrorInfoHwCallout - */ - -#include <fapiErrorInfo.H> -#include <string.h> -#include <fapiUtil.H> - -namespace fapi -{ - -//****************************************************************************** -// ErrorInfoFfdc Constructor -//****************************************************************************** -ErrorInfoFfdc::ErrorInfoFfdc(const uint32_t i_ffdcId, - const void * i_pFfdc, - const uint32_t i_size) -: iv_ffdcId(i_ffdcId), iv_size(i_size) -{ - iv_pFfdc = reinterpret_cast<uint8_t *>(fapiMalloc(i_size)); - if(iv_pFfdc != NULL) - { - memcpy(iv_pFfdc, i_pFfdc, i_size); - } - else - { - FAPI_ERR("ErrorInfoFfdc - could not allocate storage"); - iv_size = 0; - } -} - -//****************************************************************************** -// ErrorInfoFfdc Destructor -//****************************************************************************** -ErrorInfoFfdc::~ErrorInfoFfdc() -{ - fapiFree(iv_pFfdc); - iv_pFfdc = NULL; -} - -//****************************************************************************** -// ErrorInfoFfdc getData function -//****************************************************************************** -const void * ErrorInfoFfdc::getData(uint32_t & o_size) const -{ - o_size = iv_size; - return iv_pFfdc; -} - -//****************************************************************************** -// ErrorInfoFfdc new Operator Overload -//****************************************************************************** -#ifdef FAPI_CUSTOM_MALLOC -void * ErrorInfoFfdc::operator new(size_t i_sz) -{ - return fapiMalloc(i_sz); -} -#endif - -//****************************************************************************** -// ErrorInfoFfdc delete Operator Overload -//****************************************************************************** -#ifdef FAPI_CUSTOM_MALLOC -void ErrorInfoFfdc::operator delete(void * i_ptr) -{ - fapiFree(i_ptr); -} -#endif - -//****************************************************************************** -// ErrorInfoHwCallout Constructor -//****************************************************************************** -ErrorInfoHwCallout::ErrorInfoHwCallout( - const HwCallouts::HwCallout i_hw, - const CalloutPriorities::CalloutPriority i_calloutPriority, - const Target & i_refTarget, - const targetPos_t i_position) -: iv_hw(i_hw), iv_calloutPriority(i_calloutPriority), iv_refTarget(i_refTarget), - iv_position(i_position) -{ - -} - -//****************************************************************************** -// ErrorInfoHwCallout new Operator Overload -//****************************************************************************** -#ifdef FAPI_CUSTOM_MALLOC -void * ErrorInfoHwCallout::operator new(size_t i_sz) -{ - return fapiMalloc(i_sz); -} -#endif - -//****************************************************************************** -// ErrorInfoProcedureCallout delete Operator Overload -//****************************************************************************** -#ifdef FAPI_CUSTOM_MALLOC -void ErrorInfoHwCallout::operator delete(void * i_ptr) -{ - fapiFree(i_ptr); -} -#endif - -//****************************************************************************** -// ErrorInfoProcedureCallout Constructor -//****************************************************************************** -ErrorInfoProcedureCallout::ErrorInfoProcedureCallout( - const ProcedureCallouts::ProcedureCallout i_procedure, - const CalloutPriorities::CalloutPriority i_calloutPriority) -: iv_procedure(i_procedure), iv_calloutPriority(i_calloutPriority) -{ - -} - -//****************************************************************************** -// ErrorInfoProcedureCallout new Operator Overload -//****************************************************************************** -#ifdef FAPI_CUSTOM_MALLOC -void * ErrorInfoProcedureCallout::operator new(size_t i_sz) -{ - return fapiMalloc(i_sz); -} -#endif - -//****************************************************************************** -// ErrorInfoProcedureCallout delete Operator Overload -//****************************************************************************** -#ifdef FAPI_CUSTOM_MALLOC -void ErrorInfoProcedureCallout::operator delete(void * i_ptr) -{ - fapiFree(i_ptr); -} -#endif - -//****************************************************************************** -// ErrorInfoBusCallout Constructor -//****************************************************************************** -ErrorInfoBusCallout::ErrorInfoBusCallout( - const Target & i_target1, - const Target & i_target2, - const CalloutPriorities::CalloutPriority i_calloutPriority) -: iv_target1(i_target1), iv_target2(i_target2), - iv_calloutPriority(i_calloutPriority) -{ -} - -//****************************************************************************** -// ErrorInfoBusCallout new Operator Overload -//****************************************************************************** -#ifdef FAPI_CUSTOM_MALLOC -void * ErrorInfoBusCallout::operator new(size_t i_sz) -{ - return fapiMalloc(i_sz); -} -#endif - -//****************************************************************************** -// ErrorInfoBusCallout delete Operator Overload -//****************************************************************************** -#ifdef FAPI_CUSTOM_MALLOC -void ErrorInfoBusCallout::operator delete(void * i_ptr) -{ - fapiFree(i_ptr); -} -#endif - -//****************************************************************************** -// ErrorInfoCDG Constructor -//****************************************************************************** -ErrorInfoCDG::ErrorInfoCDG(const Target & i_target, - const bool i_callout, - const bool i_deconfigure, - const bool i_gard, - const CalloutPriorities::CalloutPriority i_priority) -: iv_target(i_target), iv_callout(i_callout), iv_calloutPriority(i_priority), - iv_deconfigure(i_deconfigure), iv_gard(i_gard) -{ - -} - -//****************************************************************************** -// ErrorInfoCDG new Operator Overload -//****************************************************************************** -#ifdef FAPI_CUSTOM_MALLOC -void * ErrorInfoCDG::operator new(size_t i_sz) -{ - return fapiMalloc(i_sz); -} -#endif - -//****************************************************************************** -// ErrorInfoCDG delete Operator Overload -//****************************************************************************** -#ifdef FAPI_CUSTOM_MALLOC -void ErrorInfoCDG::operator delete(void * i_ptr) -{ - fapiFree(i_ptr); -} -#endif - -//****************************************************************************** -// ErrorInfoChildrenCDG Constructor -//****************************************************************************** -ErrorInfoChildrenCDG::ErrorInfoChildrenCDG( - const Target & i_parent, - const TargetType i_childType, - const bool i_callout, - const bool i_deconfigure, - const bool i_gard, - const CalloutPriorities::CalloutPriority i_priority, - const uint8_t i_childPort, const uint8_t i_childNum ) -: iv_parent(i_parent), iv_childType(i_childType), iv_callout(i_callout), - iv_calloutPriority(i_priority), iv_deconfigure(i_deconfigure), - iv_gard(i_gard), iv_childPort(i_childPort), iv_childNumber(i_childNum) -{ - -} - -//****************************************************************************** -// ErrorInfoCollectTrace Constructor -//****************************************************************************** -ErrorInfoCollectTrace::ErrorInfoCollectTrace( - const CollectTraces::CollectTrace i_traceId) -: iv_eiTraceId(i_traceId) -{ -} - -//****************************************************************************** -// ErrorInfoChildrenCDG new Operator Overload -//****************************************************************************** -#ifdef FAPI_CUSTOM_MALLOC -void * ErrorInfoChildrenCDG::operator new(size_t i_sz) -{ - return fapiMalloc(i_sz); -} -#endif - -//****************************************************************************** -// ErrorInfoCDG delete Operator Overload -//****************************************************************************** -#ifdef FAPI_CUSTOM_MALLOC -void ErrorInfoChildrenCDG::operator delete(void * i_ptr) -{ - fapiFree(i_ptr); -} -#endif - -//****************************************************************************** -// ErrorInfo Destructor -//****************************************************************************** -ErrorInfo::~ErrorInfo() -{ - for (ErrorInfo::ErrorInfoFfdcItr_t l_itr = iv_ffdcs.begin(); - l_itr != iv_ffdcs.end(); ++l_itr) - { - delete (*l_itr); - (*l_itr) = NULL; - } - - for (ErrorInfoHwCalloutItr_t l_itr = iv_hwCallouts.begin(); - l_itr != iv_hwCallouts.end(); ++l_itr) - { - delete (*l_itr); - (*l_itr) = NULL; - } - - for (ErrorInfo::ErrorInfoProcedureCalloutItr_t l_itr = - iv_procedureCallouts.begin(); - l_itr != iv_procedureCallouts.end(); ++l_itr) - { - delete (*l_itr); - (*l_itr) = NULL; - } - - for (ErrorInfo::ErrorInfoBusCalloutItr_t l_itr = - iv_busCallouts.begin(); - l_itr != iv_busCallouts.end(); ++l_itr) - { - delete (*l_itr); - (*l_itr) = NULL; - } - - for (ErrorInfo::ErrorInfoCDGItr_t l_itr = iv_CDGs.begin(); - l_itr != iv_CDGs.end(); ++l_itr) - { - delete (*l_itr); - (*l_itr) = NULL; - } - - for (ErrorInfo::ErrorInfoChildrenCDGItr_t l_itr = iv_childrenCDGs.begin(); - l_itr != iv_childrenCDGs.end(); ++l_itr) - { - delete (*l_itr); - (*l_itr) = NULL; - } -} - -//****************************************************************************** -// ErrorInfo new Operator Overload -//****************************************************************************** -#ifdef FAPI_CUSTOM_MALLOC -void * ErrorInfo::operator new(size_t i_sz) -{ - return fapiMalloc(i_sz); -} -#endif - -//****************************************************************************** -// ErrorInfo delete Operator Overload -//****************************************************************************** -#ifdef FAPI_CUSTOM_MALLOC -void ErrorInfo::operator delete(void * i_ptr) -{ - fapiFree(i_ptr); -} -#endif - -} diff --git a/src/usr/hwpf/fapi/fapiHwAccess.C b/src/usr/hwpf/fapi/fapiHwAccess.C deleted file mode 100644 index 547ad9422..000000000 --- a/src/usr/hwpf/fapi/fapiHwAccess.C +++ /dev/null @@ -1,672 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/fapi/fapiHwAccess.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -// $Id: fapiHwAccess.C,v 1.14 2013/10/15 13:13:29 dcrowell Exp $ -// $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/hwpf/working/fapi/fapiHwAccess.C,v $ - -/** - * @file fapiHwAccess.C - * - * @brief Implements the fapiHwAccess.H functions at a high level, - * allowing for scand common tracing to occur before and after - * the call to the platform-specific worker. - * - * Note that platform code must provide the implementation. - */ - -/* - * Change Log ****************************************************************** - * Flag Defect/Feature User Date Description - * ------ -------------- ---------- ----------- ---------------------------- - * copelanm 09/13/2011 new for common scan traces - * mjjones 09/14/2011 Prepended fapi to functions - * and enabled all functions - * mjjones 10/13/2011 util namespace change - * mjjones 02/21/2012 Use high performance Target - * toEcmdString - * 836579 thi May 18,2012 Spy/ring supports - * mjjones 07/12/2012 Add Pulse mode option to - * Ring funcs - * rjknight 09/20/2012 Update fapiGetSpy to take - * a string as input - * F876964 jknight Apr, 02,2013 fapi get/setSpyImage - * support - * F873646 srimeesa Mar 10,2013 64Bit SPYID and - * ClockDomain ID support - * F883863 atendolk 05/06/2013 Update to support MultiScom - */ -#include <fapi.H> -#include <fapiPlatHwAccess.H> - -extern "C" -{ - -//****************************************************************************** -// fapiGetScom function -//****************************************************************************** -fapi::ReturnCode fapiGetScom(const fapi::Target& i_target, - const uint64_t i_address, - ecmdDataBufferBase & o_data) -{ - fapi::ReturnCode l_rc; - bool l_traceit = platIsScanTraceEnabled(); - - // call the platform implementation - l_rc = platGetScom( i_target, i_address, o_data ); - - if (l_rc) - { - FAPI_ERR("fapiGetScom failed - Target %s, Addr %.16llX", - i_target.toEcmdString(), i_address); - } - - if( l_traceit ) - { - FAPI_SCAN( "TRACE : GETSCOM : %s : %.16llX %.16llX", - i_target.toEcmdString(), - i_address, - o_data.getDoubleWord( 0 ) ); - } - - return l_rc; -} - - -//****************************************************************************** -// fapiPutScom function -//****************************************************************************** -fapi::ReturnCode fapiPutScom(const fapi::Target& i_target, - const uint64_t i_address, - ecmdDataBufferBase & i_data) -{ - fapi::ReturnCode l_rc; - bool l_traceit = platIsScanTraceEnabled(); - - // call the platform implementation - l_rc = platPutScom( i_target, i_address, i_data ); - - if (l_rc) - { - FAPI_ERR("fapiPutScom failed - Target %s, Addr %.16llX", - i_target.toEcmdString(), i_address); - } - - if( l_traceit ) - { - FAPI_SCAN( "TRACE : PUTSCOM : %s : %.16llX %.16llX", - i_target.toEcmdString(), - i_address, - i_data.getDoubleWord( 0 ) ); - } - - return l_rc; -} - -//****************************************************************************** -// fapiPutScomUnderMask function -//****************************************************************************** -fapi::ReturnCode fapiPutScomUnderMask(const fapi::Target& i_target, - const uint64_t i_address, - ecmdDataBufferBase & i_data, - ecmdDataBufferBase & i_mask) -{ - fapi::ReturnCode l_rc; - bool l_traceit = platIsScanTraceEnabled(); - - // call the platform implementation - l_rc = platPutScomUnderMask( i_target, i_address, i_data, i_mask ); - - if (l_rc) - { - FAPI_ERR("fapiPutScomUnderMask failed - Target %s, Addr %.16llX", - i_target.toEcmdString(), i_address); - } - - if( l_traceit ) - { - FAPI_SCAN( "TRACE : PUTSCOMMASK : %s : %.16llX %.16llX %.16llX", - i_target.toEcmdString(), - i_address, - i_data.getDoubleWord(0), - i_mask.getDoubleWord(0)); - } - - return l_rc; -} - -//****************************************************************************** -// fapiMultiScom function -//****************************************************************************** -#ifdef FAPI_SUPPORT_MULTI_SCOM -fapi::ReturnCode fapiMultiScom ( - const fapi::Target& i_target, - fapi::MultiScom& io_multiScomObj) -{ - FAPI_DBG (ENTER_MRK "fapiMultiScom - i_target: %s, # input ops: %d", - i_target.toEcmdString (), io_multiScomObj.iv_ScomList.size ()); - - fapi::ReturnCode l_rc; - - // Call the platform specific implemetation - l_rc = platMultiScom (i_target, io_multiScomObj); - - if (!l_rc.ok ()) - { - uint32_t l_retCode = l_rc; - - FAPI_ERR ("fapiMultiScom Failed with RC: 0x%.8X! i_target: %s, " - "# input ops: %d, # ops complete: %d", l_retCode, - i_target.toEcmdString (), - io_multiScomObj.iv_ScomList.size (), - io_multiScomObj.iv_NumOfCompletes); - } - - FAPI_DBG (EXIT_MRK "fapiMultiScom - i_target: %s, # input ops: %d, " - "#ops complete: %d", i_target.toEcmdString (), - io_multiScomObj.iv_ScomList.size (), - io_multiScomObj.iv_NumOfCompletes); - - return l_rc; -} -#endif // FAPI_SUPPORT_MULTI_SCOM - - -//****************************************************************************** -// fapiGetCfamRegister function -//****************************************************************************** -fapi::ReturnCode fapiGetCfamRegister(const fapi::Target& i_target, - const uint32_t i_address, - ecmdDataBufferBase & o_data) -{ - fapi::ReturnCode l_rc; - bool l_traceit = platIsScanTraceEnabled(); - - // call the platform implementation - l_rc = platGetCfamRegister( i_target, i_address, o_data ); - - if (l_rc) - { - FAPI_ERR("fapiGetCfamRegister failed - Target %s, Addr %.8X", - i_target.toEcmdString(), i_address); - } - - if( l_traceit ) - { - FAPI_SCAN( "TRACE : GETCFAMREG : %s : %.8X %.8X", - i_target.toEcmdString(), - i_address, - o_data.getWord(0) ); - } - - return l_rc; -} - -//****************************************************************************** -// fapiPutCfamRegister function -//****************************************************************************** -fapi::ReturnCode fapiPutCfamRegister(const fapi::Target& i_target, - const uint32_t i_address, - ecmdDataBufferBase & i_data) -{ - fapi::ReturnCode l_rc; - bool l_traceit = platIsScanTraceEnabled(); - - // call the platform implementation - l_rc = platPutCfamRegister( i_target, i_address, i_data ); - - if (l_rc) - { - FAPI_ERR("platPutCfamRegister failed - Target %s, Addr %.8X", - i_target.toEcmdString(), i_address); - } - - if( l_traceit ) - { - FAPI_SCAN( "TRACE : PUTCFAMREG : %s : %.8X %.8X", - i_target.toEcmdString(), - i_address, - i_data.getWord(0) ); - } - - return l_rc; -} - -//****************************************************************************** -// fapiModifyCfamRegister function -//****************************************************************************** -fapi::ReturnCode fapiModifyCfamRegister(const fapi::Target& i_target, - const uint32_t i_address, - ecmdDataBufferBase & i_data, - const fapi::ChipOpModifyMode i_modifyMode) -{ - fapi::ReturnCode l_rc; - bool l_traceit = platIsScanTraceEnabled(); - - // call the platform implementation - l_rc = platModifyCfamRegister( i_target, i_address, i_data, i_modifyMode ); - - if (l_rc) - { - FAPI_ERR("platModifyCfamRegister failed - Target %s, Addr %.8X", - i_target.toEcmdString(), i_address); - } - - if( l_traceit ) - { - // get string representation of the modify mode - const char * l_pMode = NULL; - - if (i_modifyMode == fapi::CHIP_OP_MODIFY_MODE_OR) - { - l_pMode = "OR"; - } - else if (i_modifyMode == fapi::CHIP_OP_MODIFY_MODE_AND) - { - l_pMode = "AND"; - } - else if (i_modifyMode == fapi::CHIP_OP_MODIFY_MODE_XOR) - { - l_pMode = "XOR"; - } - else - { - l_pMode = "?"; - } - - FAPI_SCAN( "TRACE : MODCFAMREG : %s : %.8X %.8X %s", - i_target.toEcmdString(), - i_address, - i_data.getWord(0), - l_pMode ); - } - - return l_rc; -} - -//////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////// -fapi::ReturnCode fapiGetRing(const fapi::Target& i_target, - const scanRingId_t i_address, - ecmdDataBufferBase & o_data, - const uint32_t i_ringMode) -{ - fapi::ReturnCode l_rc; - bool l_traceit = platIsScanTraceEnabled(); - - // call the platform implementation - l_rc = platGetRing( i_target, i_address, o_data, i_ringMode ); - - if (l_rc) - { - FAPI_ERR("fapiGetRing failed - Target %s, Addr 0x%.16llX", - i_target.toEcmdString(), i_address); - } - - if( l_traceit ) - { - FAPI_SCAN( "TRACE : GETRING : %s : %.16llX %.16llX", - i_target.toEcmdString(), - i_address, - o_data.getDoubleWord( 0 ) ); - } - - return l_rc; -} - -//////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////// -fapi::ReturnCode fapiPutRing(const fapi::Target& i_target, - const scanRingId_t i_address, - ecmdDataBufferBase & i_data, - const uint32_t i_ringMode) -{ - fapi::ReturnCode l_rc; - bool l_traceit = platIsScanTraceEnabled(); - - // call the platform implementation - l_rc = platPutRing( i_target, i_address, i_data, i_ringMode ); - - if (l_rc) - { - FAPI_ERR("fapiPutRing failed - Target %s, Addr 0x%.16llX", - i_target.toEcmdString(), i_address); - } - - if( l_traceit ) - { - FAPI_SCAN( "TRACE : PUTRING : %s : %.16llX %.16llX", - i_target.toEcmdString(), - i_address, - i_data.getDoubleWord(0)); - } - - return l_rc; -} - -//////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////// -fapi::ReturnCode fapiModifyRing(const fapi::Target& i_target, - const scanRingId_t i_address, - ecmdDataBufferBase & i_data, - const fapi::ChipOpModifyMode i_modifyMode, - const uint32_t i_ringMode) -{ - fapi::ReturnCode l_rc; - bool l_traceit = platIsScanTraceEnabled(); - - // call the platform implementation - l_rc = platModifyRing( i_target, i_address, i_data, i_modifyMode, i_ringMode ); - - if (l_rc) - { - FAPI_ERR("platModifyRing failed - Target %s, Addr 0x%.16llX," - "ModifyMode 0x%.8X", i_target.toEcmdString(), - i_address, i_modifyMode); - } - - if( l_traceit ) - { - // get string representation of the modify mode - const char * l_pMode = NULL; - - if (i_modifyMode == fapi::CHIP_OP_MODIFY_MODE_OR) - { - l_pMode = "OR"; - } - else if (i_modifyMode == fapi::CHIP_OP_MODIFY_MODE_AND) - { - l_pMode = "AND"; - } - else if (i_modifyMode == fapi::CHIP_OP_MODIFY_MODE_XOR) - { - l_pMode = "XOR"; - } - else - { - l_pMode = "?"; - } - - FAPI_SCAN( "TRACE : MODRING : %s : %.16llX %.16llX %s", - i_target.toEcmdString(), - i_address, - i_data.getDoubleWord(0), - l_pMode); - } - - return l_rc; -} - -// -------------------------------------------------------------------------- -// NOTE: -// These spy access interfaces are only used in FSP and cronus. -// HB does not allow spy access - -//////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////// -#ifdef FAPI_SUPPORT_SPY_AS_ENUM -fapi::ReturnCode _fapiGetSpy(const fapi::Target& i_target, - const spyId_t i_spyId, - ecmdDataBufferBase & o_data) -{ - fapi::ReturnCode l_rc; - bool l_traceit = platIsScanTraceEnabled(); - - // call the platform implementation - l_rc = platGetSpy( i_target, i_spyId, o_data ); - - if (l_rc) - { - FAPI_ERR("fapiGetSpy failed - Target %s, SpyId 0x%.16llX", - i_target.toEcmdString(), i_spyId); - } - - if( l_traceit ) - { - FAPI_SCAN( "TRACE : GETSPY : %s : %.16llX %.16llX", - i_target.toEcmdString(), - i_spyId, - o_data.getDoubleWord(0)); - } - - return l_rc; -} -#endif - -#ifdef FAPI_SUPPORT_SPY_AS_STRING -fapi::ReturnCode _fapiGetSpy(const fapi::Target& i_target, - const char * i_spyId, - ecmdDataBufferBase & o_data) -{ - fapi::ReturnCode l_rc; - bool l_traceit = platIsScanTraceEnabled(); - - // call the platform implementation - l_rc = platGetSpy( i_target, i_spyId, o_data ); - - if (l_rc) - { - FAPI_ERR("fapiGetSpy failed - Target %s, SpyId %s", - i_target.toEcmdString(), i_spyId); - } - - if( l_traceit ) - { - FAPI_SCAN( "TRACE : GETSPY : %s : %s %.16llX", - i_target.toEcmdString(), - i_spyId, - o_data.getDoubleWord(0)); - } - - return l_rc; -} -#endif - -#ifdef FAPI_SUPPORT_SPY_AS_ENUM -//////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////// -fapi::ReturnCode _fapiPutSpy(const fapi::Target& i_target, - const spyId_t i_spyId, - ecmdDataBufferBase & i_data) -{ - fapi::ReturnCode l_rc; - bool l_traceit = platIsScanTraceEnabled(); - - // call the platform implementation - l_rc = platPutSpy( i_target, i_spyId, i_data ); - - if (l_rc) - { - FAPI_ERR("fapiPutSpy failed - Target %s, SpyId 0x%.16llX", - i_target.toEcmdString(), i_spyId); - } - - if( l_traceit ) - { - FAPI_SCAN( "TRACE : PUTSPY : %s : %.16llX %.16llX", - i_target.toEcmdString(), - i_spyId, - i_data.getDoubleWord(0)); - } - - return l_rc; -} -#endif - -#ifdef FAPI_SUPPORT_SPY_AS_STRING -//////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////// -fapi::ReturnCode _fapiPutSpy(const fapi::Target& i_target, - const char * const i_spyId, - ecmdDataBufferBase & i_data) -{ - fapi::ReturnCode l_rc; - bool l_traceit = platIsScanTraceEnabled(); - - // call the platform implementation - l_rc = platPutSpy( i_target, i_spyId, i_data ); - - if (l_rc) - { - FAPI_ERR("fapiPutSpy failed - Target %s, SpyId %s.8X", - i_target.toEcmdString(), i_spyId); - } - - if( l_traceit ) - { - FAPI_SCAN( "TRACE : PUTSPY : %s : %s %.16llX", - i_target.toEcmdString(), - i_spyId, - i_data.getDoubleWord(0)); - } - - return l_rc; -} -#endif - -#ifdef FAPI_SUPPORT_SPY_AS_STRING -//////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////// -fapi::ReturnCode _fapiGetSpyImage(const fapi::Target& i_target, - const char * const i_spyId, - ecmdDataBufferBase & o_data, - const ecmdDataBufferBase & i_imageData) -{ - fapi::ReturnCode l_rc; - bool l_traceit = platIsScanTraceEnabled(); - - // call the platform implementation - l_rc = platGetSpyImage( i_target, i_spyId, o_data, i_imageData ); - - if (l_rc) - { - FAPI_ERR("fapiGetSpyImage failed - Target %s, SpyId %s", - i_target.toEcmdString(), i_spyId); - } - - if( l_traceit ) - { - FAPI_SCAN( "TRACE : GETSPYIMAGE : %s : %s %.16llX", - i_target.toEcmdString(), - i_spyId, - o_data.getDoubleWord(0)); - - } - - return l_rc; -} - -//////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////// -fapi::ReturnCode _fapiPutSpyImage(const fapi::Target& i_target, - const char * const i_spyId, - const ecmdDataBufferBase & i_data, - ecmdDataBufferBase & io_imageData) -{ - fapi::ReturnCode l_rc; - bool l_traceit = platIsScanTraceEnabled(); - - // call the platform implementation - l_rc = platPutSpyImage( i_target, i_spyId, i_data, io_imageData ); - - if (l_rc) - { - FAPI_ERR("fapiPutSpyImage failed - Target %s, SpyId %s", - i_target.toEcmdString(), i_spyId); - } - - if( l_traceit ) - { - FAPI_SCAN("TRACE : PUTSPYIMG : %s : %s %.16llX", - i_target.toEcmdString(), - i_spyId, - i_data.getDoubleWord(0)); - - } - - return l_rc; -} -#endif -#ifdef FAPI_SUPPORT_SPY_AS_ENUM -//////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////// -fapi::ReturnCode _fapiGetSpyImage(const fapi::Target& i_target, - const spyId_t i_spyId, - ecmdDataBufferBase & o_data, - const ecmdDataBufferBase & i_imageData) -{ - - fapi::ReturnCode l_rc; - bool l_traceit = platIsScanTraceEnabled(); - - // call the platform implementation - l_rc = platGetSpyImage( i_target, i_spyId, o_data, i_imageData ); - - if (l_rc) - { - FAPI_ERR("fapiGetSpyImage failed - Target %s, SpyId 0x%.16llX", - i_target.toEcmdString(), i_spyId); - } - - if( l_traceit ) - { - FAPI_SCAN( "TRACE : GETSPYIMG : %s : %.16llX %.16llX", - i_target.toEcmdString(), - i_spyId, - o_data.getDoubleWord(0)); - - } - - return l_rc; -} - -//////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////// -fapi::ReturnCode _fapiPutSpyImage(const fapi::Target& i_target, - const spyId_t i_spyId, - const ecmdDataBufferBase & i_data, - ecmdDataBufferBase & io_imageData) -{ - fapi::ReturnCode l_rc; - bool l_traceit = platIsScanTraceEnabled(); - - // call the platform implementation - l_rc = platPutSpyImage( i_target, i_spyId, i_data, io_imageData ); - - if (l_rc) - { - FAPI_ERR("fapiPutSpyImage failed - Target %s, SpyId 0x%.16llX", - i_target.toEcmdString(), i_spyId); - } - - if( l_traceit ) - { - FAPI_SCAN( "TRACE : PUTSPYIMG : %s : %.16llX %.16llX", - i_target.toEcmdString(), - i_spyId, - i_data.getDoubleWord(0)); - - } - - return l_rc; -} -#endif -} // extern "C" diff --git a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl deleted file mode 100755 index 0e28afbf0..000000000 --- a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl +++ /dev/null @@ -1,799 +0,0 @@ -#!/usr/bin/perl -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/hwpf/fapi/fapiParseAttributeInfo.pl $ -# -# OpenPOWER HostBoot Project -# -# Contributors Listed Below - COPYRIGHT 2011,2015 -# [+] International Business Machines Corp. -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. See the License for the specific language governing -# permissions and limitations under the License. -# -# IBM_PROLOG_END_TAG -# $Id: fapiParseAttributeInfo.pl,v 1.21 2014/01/20 20:35:30 mjjones Exp $ -# -# Purpose: This perl script will parse HWP Attribute XML files -# and add attribute information to a file called fapiAttributeIds.H -# -# Author: CamVan Nguyen -# Last Updated: 06/23/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 06/23/11 Parse more info -# mjjones 07/05/11 Take output dir as parameter -# mjjones 09/06/11 Remove string/defaultVal support -# mjjones 10/07/11 Create fapiAttributeService.C -# mjjones 10/17/11 Support enums with values -# mjjones 10/18/11 Support multiple attr files and -# multi-line descriptions -# 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 -# mjjones 12/16/11 Generate fapiAttributePlatCheck.H -# Generate fapiAttributesSupported.html -# mjjones 02/08/12 Handle attribute files with 1 entry -# mjjones 03/22/12 Generate hash values for enums -# mjjones 04/10/12 Process Chip EC Feature attributes -# mjjones 05/15/12 Detect duplicate attr ids and append -# ULL after 64bit enumerator -# mjjones 05/21/12 Detect duplicate ids/hashes across files -# mjjones 05/21/12 Ignore newlines and whitespace when -# parsing enumerations -# mjjones 06/12/12 Add new include file to fapiChipEcFeature.C -# mjjones 08/08/12 Output target types and if PlatInit -# mjjones 09/28/12 Minor change to add FFDC on error -# mjjones 11/05/12 Generate fapiAttributeIds.txt -# Generate fapiAttributeEnums.txt -# mjjones 03/21/13 Add fapi namespace to Chip EC Feature macro -# mjjones 02/27/13 Generate fapiAttrInfo.csv -# Generate fapiAttrEnumInfo.csv -# mjjones 04/11/13 Allow platform to override Chip EC Feature -# mjjones 05/02/13 Allow Chip EC feature to be queried from -# chiplet -# -# End Change Log ****************************************************** - -use strict; - -#------------------------------------------------------------------------------ -# Print Command Line Help -#------------------------------------------------------------------------------ -my $numArgs = $#ARGV + 1; -if ($numArgs < 2) -{ - print ("Usage: fapiParseAttributeInfo.pl <output dir> <attr-xml-file1> [<attr-xml-file2> ...]\n"); - print (" This perl script will parse attribute XML files and create the following files:\n"); - print (" - fapiAttributeIds.H. Contains IDs, type, value enums and other information\n"); - print (" - fapiChipEcFeature.C. Contains a function to query chip EC features\n"); - print (" - fapiAttributePlatCheck.H. Contains compile time checks that all attributes are\n"); - print (" handled by the platform\n"); - print (" - fapiAttributesSupported.html Contains the HWPF attributes supported\n"); - print (" - fapiAttrInfo.csv Used to process Attribute Override Text files\n"); - print (" - fapiAttrEnumInfo.csv Used to process Attribute Override Text files\n"); - exit(1); -} - -#------------------------------------------------------------------------------ -# Specify perl modules to use -#------------------------------------------------------------------------------ -use Digest::MD5 qw(md5_hex); -use XML::Simple; -my $xml = new XML::Simple (KeyAttr=>[]); - -# Uncomment to enable debug output -#use Data::Dumper; - -#------------------------------------------------------------------------------ -# Set PREFERRED_PARSER to XML::Parser. Otherwise it uses XML::SAX which contains -# bugs that result in XML parse errors that can be fixed by adjusting white- -# space (i.e. parse errors that do not make sense). -#------------------------------------------------------------------------------ -$XML::Simple::PREFERRED_PARSER = 'XML::Parser'; - -#------------------------------------------------------------------------------ -# Open output files for writing -#------------------------------------------------------------------------------ -my $aiFile = $ARGV[0]; -$aiFile .= "/"; -$aiFile .= "fapiAttributeIds.H"; -open(AIFILE, ">", $aiFile); - -my $ecFile = $ARGV[0]; -$ecFile .= "/"; -$ecFile .= "fapiChipEcFeature.C"; -open(ECFILE, ">", $ecFile); - -my $acFile = $ARGV[0]; -$acFile .= "/"; -$acFile .= "fapiAttributePlatCheck.H"; -open(ACFILE, ">", $acFile); - -my $asFile = $ARGV[0]; -$asFile .= "/"; -$asFile .= "fapiAttributesSupported.html"; -open(ASFILE, ">", $asFile); - -my $itFile = $ARGV[0]; -$itFile .= "/"; -$itFile .= "fapiAttrInfo.csv"; -open(ITFILE, ">", $itFile); - -my $etFile = $ARGV[0]; -$etFile .= "/"; -$etFile .= "fapiAttrEnumInfo.csv"; -open(ETFILE, ">", $etFile); - -my $fmFile = $ARGV[0]; -$fmFile .= "/"; -$fmFile .= "fapiAttrOverrideData.H"; -open(FMFILE, ">", $fmFile); - -my $feFile = $ARGV[0]; -$feFile .= "/"; -$feFile .= "fapiAttrOverrideEnums.H"; -open(FEFILE, ">", $feFile); - - -#------------------------------------------------------------------------------ -# Print Start of file information to fapiAttributeIds.H -#------------------------------------------------------------------------------ -print AIFILE "// fapiAttributeIds.H\n"; -print AIFILE "// This file is generated by perl script fapiParseAttributeInfo.pl\n\n"; -print AIFILE "#ifndef FAPIATTRIBUTEIDS_H_\n"; -print AIFILE "#define FAPIATTRIBUTEIDS_H_\n\n"; -print AIFILE "#include <fapiTarget.H>\n\n"; -print AIFILE "namespace fapi\n"; -print AIFILE "{\n\n"; -print AIFILE "\/**\n"; -print AIFILE " * \@brief Enumeration of attribute IDs\n"; -print AIFILE " *\/\n"; -print AIFILE "enum AttributeId\n{\n"; - -#------------------------------------------------------------------------------ -# Print Start of file information to fapiChipEcFeature.C -#------------------------------------------------------------------------------ -print ECFILE "// fapiChipEcFeature.C\n"; -print ECFILE "// This file is generated by perl script fapiParseAttributeInfo.pl\n"; -print ECFILE "// It implements the fapiQueryChipEcFeature function\n\n"; -print ECFILE "#include <fapiChipEcFeature.H>\n"; -print ECFILE "#include <fapiAttributeService.H>\n"; -print ECFILE "#include <fapiSystemConfig.H>\n"; -print ECFILE "#include <fapiPlatTrace.H>\n\n"; -print ECFILE "namespace fapi\n"; -print ECFILE "{\n\n"; -print ECFILE "fapi::ReturnCode fapiQueryChipEcFeature(fapi::AttributeId i_id,\n"; -print ECFILE " const fapi::Target * i_pTarget,\n"; -print ECFILE " uint8_t & o_hasFeature)\n"; -print ECFILE "{\n"; -print ECFILE " o_hasFeature = false;\n"; -print ECFILE " fapi::ReturnCode l_rc;\n"; -print ECFILE " uint8_t l_chipName = 0;\n"; -print ECFILE " uint8_t l_chipEc = 0;\n"; -print ECFILE " fapi::Target l_target = *i_pTarget;\n\n"; -print ECFILE " if (i_pTarget->isChiplet())\n"; -print ECFILE " {\n"; -print ECFILE " l_rc = fapiGetParentChip(*i_pTarget, l_target);\n\n"; -print ECFILE " if (l_rc)\n"; -print ECFILE " {\n"; -print ECFILE " FAPI_ERR(\"fapiQueryChipEcFeature: error getting parent chip\");\n"; -print ECFILE " }\n"; -print ECFILE " }\n\n"; -print ECFILE " if (!l_rc)\n"; -print ECFILE " {\n"; -print ECFILE " l_rc = FAPI_ATTR_GET_PRIVILEGED(ATTR_NAME, &l_target, l_chipName);\n\n"; -print ECFILE " if (l_rc)\n"; -print ECFILE " {\n"; -print ECFILE " FAPI_ERR(\"fapiQueryChipEcFeature: error getting chip name\");\n"; -print ECFILE " }\n"; -print ECFILE " else\n"; -print ECFILE " {\n"; -print ECFILE " l_rc = FAPI_ATTR_GET_PRIVILEGED(ATTR_EC, &l_target, l_chipEc);\n\n"; -print ECFILE " if (l_rc)\n"; -print ECFILE " {\n"; -print ECFILE " FAPI_ERR(\"fapiQueryChipEcFeature: error getting chip ec\");\n"; -print ECFILE " }\n"; -print ECFILE " else\n"; -print ECFILE " {\n"; -print ECFILE " switch (i_id)\n"; -print ECFILE " {\n"; - -#------------------------------------------------------------------------------ -# Print Start of file information to fapiAttributePlatCheck.H -#------------------------------------------------------------------------------ -print ACFILE "// fapiAttributePlatCheck.H\n"; -print ACFILE "// This file is generated by perl script fapiParseAttributeInfo.pl\n"; -print ACFILE "// A platform can include it to ensure that it handles all HWPF\n"; -print ACFILE "// attributes\n\n"; -print ACFILE "#ifndef FAPIATTRIBUTEPLATCHECK_H_\n"; -print ACFILE "#define FAPIATTRIBUTEPLATCHECK_H_\n\n"; - -#------------------------------------------------------------------------------ -# Print Start of file information to fapiAttributesSupported.html -#------------------------------------------------------------------------------ -print ASFILE "<html>\n"; -print ASFILE "<body>\n\n"; -print ASFILE "<!-- fapiAttributesSupported.html -->\n"; -print ASFILE "<!-- This file is generated by perl script fapiParseAttributeInfo.pl -->\n"; -print ASFILE "<!-- It lists all HWPF attributes supported -->\n\n"; -print ASFILE "<h4>HWPF Attributes supported by this build.</h4>\n"; -print ASFILE "<table border=\"4\">\n"; -print ASFILE "<tr><th>Attribute ID</th><th>Attribute Description</th></tr>"; - -#------------------------------------------------------------------------------ -# Print Start of file information to fapiAttrInfo.csv -#------------------------------------------------------------------------------ -print ITFILE "# fapiAttrInfo.csv\n"; -print ITFILE "# This file is generated by perl script fapiParseAttributeInfo.pl\n"; -print ITFILE "# It lists information about FAPI attributes and is used to\n"; -print ITFILE "# process FAPI Attribute text files (overrides/syncs)\n"; -print ITFILE "# Format:\n"; -print ITFILE "# <FAPI-ATTR-ID-STR>,<LAYER-ATTR-ID-STR>,<ATTR-ID-VAL>,<ATTR-TYPE>\n"; -print ITFILE "# Note that for the AttributeTanks at the FAPI layer, the\n"; -print ITFILE "# FAPI-ATTR-ID-STR and LAYER-ATTR-ID-STR will be identical\n"; - -#------------------------------------------------------------------------------ -# Print Start of file information to fapiAttrEnumInfo.csv -#------------------------------------------------------------------------------ -print ETFILE "# fapiAttrEnumInfo.csv\n"; -print ETFILE "# This file is generated by perl script fapiParseAttributeInfo.pl\n"; -print ETFILE "# It lists information about FAPI attribute enumeratorss and is\n"; -print ETFILE "# used to process FAPI Attribute text files (overrides/syncs)\n"; -print ETFILE "# Format:\n"; -print ETFILE "# <ENUM-STR>,<ENUM-VAL>\n"; - -#------------------------------------------------------------------------------- -# Print header of getFapiAttrData.C -# ------------------------------------------------------------------------------ -print FMFILE "const AttributeData g_FapiAttrs[] = {\n"; -my %attrOverrideData = (); - -#------------------------------------------------------------------------------- -# Print header of getFapiAttrEnumData.C -# ------------------------------------------------------------------------------ -print FEFILE "const AttributeEnum g_FapiEnums[] = {\n"; -my @attrOverrideEnums = (); - -my %attrIdHash; # Records which Attribute IDs have been used -my %attrValHash; # Records which Attribute values have been used - -#------------------------------------------------------------------------------ -# For each XML file -#------------------------------------------------------------------------------ -foreach my $argnum (1 .. $#ARGV) -{ - my $infile = $ARGV[$argnum]; - - # read XML file. The ForceArray option ensures that there is an array of - # elements even if there is only one such element in the file - my $attributes = $xml->XMLin($infile, ForceArray => ['attribute']); - - # Uncomment to get debug output of all attributes - #print "\nFile: ", $infile, "\n", Dumper($attributes), "\n"; - - #-------------------------------------------------------------------------- - # For each Attribute - #-------------------------------------------------------------------------- - foreach my $attr (@{$attributes->{attribute}}) - { - #---------------------------------------------------------------------- - # Print the Attribute ID and calculated value to fapiAttributeIds.H and - # fapiAttributeIds.txt. The value for an attribute is a hash value - # generated from the attribute name, this ties a specific value to a - # specific attribute name. This is done for Cronus so that if a HWP is - # not recompiled against a new eCMD/Cronus version where the attributes - # have changed then there will not be a mismatch in enumerator values. - # This is a 28bit hash value because the Initfile compiler has a - # requirement that the top nibble of the 32 bit attribute ID be zero to - # store flags - #---------------------------------------------------------------------- - if (! exists $attr->{id}) - { - print ("fapiParseAttributeInfo.pl ERROR. Att 'id' missing\n"); - exit(1); - } - - if (exists($attrIdHash{$attr->{id}})) - { - # Two different attributes with the same id! - print ("fapiParseAttributeInfo.pl ERROR. Duplicate attr id ", - $attr->{id}, "\n"); - exit(1); - } - - # Calculate a 28 bit hash value. - my $attrHash128Bit = md5_hex($attr->{id}); - my $attrHash28Bit = substr($attrHash128Bit, 0, 7); - - # Print the attribute ID/value to fapiAttributeIds.H - print AIFILE " $attr->{id} = 0x$attrHash28Bit,\n"; - - if (exists($attrValHash{$attrHash28Bit})) - { - # Two different attributes generate the same hash-value! - print ("fapiParseAttributeInfo.pl ERROR. Duplicate attr id hash value for ", - $attr->{id}, "\n"); - exit(1); - } - - $attrIdHash{$attr->{id}} = $attrHash28Bit; - $attrValHash{$attrHash28Bit} = 1; - }; -} - -#------------------------------------------------------------------------------ -# Print AttributeId enumeration end to fapiAttributeIds.H -#------------------------------------------------------------------------------ -print AIFILE "};\n\n"; - -#------------------------------------------------------------------------------ -# Print Attribute Information comment to fapiAttributeIds.H -#------------------------------------------------------------------------------ -print AIFILE "\/**\n"; -print AIFILE " * \@brief Attribute Information\n"; -print AIFILE " *\/\n"; - -#------------------------------------------------------------------------------ -# For each XML file -#------------------------------------------------------------------------------ -foreach my $argnum (1 .. $#ARGV) -{ - my $infile = $ARGV[$argnum]; - - # read XML file. The ForceArray option ensures that there is an array of - # elements even if there is only one such element in the file - my $attributes = $xml->XMLin($infile, ForceArray => ['attribute', 'chip']); - - #-------------------------------------------------------------------------- - # For each Attribute - #-------------------------------------------------------------------------- - foreach my $attr - (@{$attributes->{attribute}}) - { - my $attrOverride = ""; - #---------------------------------------------------------------------- - # Print a comment with the attribute ID fapiAttributeIds.H - #---------------------------------------------------------------------- - print AIFILE "/* $attr->{id} */\n"; - - #---------------------------------------------------------------------- - # Print the AttributeId and description to fapiAttributesSupported.html - #---------------------------------------------------------------------- - if (! exists $attr->{description}) - { - print ("fapiParseAttributeInfo.pl ERROR. Att 'description' missing\n"); - exit(1); - } - - print ASFILE "<tr>\n"; - print ASFILE " <td>$attr->{id}</td>\n"; - print ASFILE " <td>$attr->{description}</td>\n"; - print ASFILE "</tr>\n"; - - #---------------------------------------------------------------------- - # Print the assignment of each attribute to the local l_name - #---------------------------------------------------------------------- - $attrOverride .= "\t{\n"; - $attrOverride .= "\t\t\"$attr->{id}\",\n"; - - #---------------------------------------------------------------------- - # Figure out the attribute array dimensions (if array) - #---------------------------------------------------------------------- - my $arrayDimensions = ""; - my @arrayDims = (); - if ($attr->{array}) - { - # Remove leading whitespace - my $dimText = $attr->{array}; - $dimText =~ s/^\s+//; - - # Split on commas or whitespace - @arrayDims = split(/\s*,\s*|\s+/, $dimText); - - - foreach my $val (@arrayDims) - { - $arrayDimensions .= "[${val}]"; - } - } - until ($#arrayDims == 3) - { - push @arrayDims, 1; - } - my $arrayDimString = join(", ", @arrayDims); - - #---------------------------------------------------------------------- - # Print the typedef for each attribute's val type to fapiAttributeIds.H - # Print the attribute information to fapiAttrInfo.csv - #---------------------------------------------------------------------- - if (exists $attr->{chipEcFeature}) - { - # The value type of chip EC feature attributes is uint8_t - print AIFILE "typedef uint8_t $attr->{id}_Type;\n"; - print ITFILE "$attr->{id},$attr->{id},"; - print ITFILE "0x$attrIdHash{$attr->{id}},u8\n"; - $attrOverride .= "\t\t0x$attrIdHash{$attr->{id}},\n"; - $attrOverride .= "\t\tsizeof(uint8_t),\n"; - $attrOverride .= "\t\t{ $arrayDimString }\n"; - $attrOverride .= "\t},\n"; - } - else - { - if (! exists $attr->{valueType}) - { - print ("fapiParseAttributeInfo.pl ERROR. Att 'valueType' missing\n"); - exit(1); - } - - my @sizes = ( 'uint8', 'uint32', 'uint64' ); - my $actualSize = ''; - foreach my $size (@sizes) - { - if ($attr->{valueType} eq $size) - { - $actualSize = $size; - last; - } - } - if ($actualSize ne '') - { - - print AIFILE "typedef ${actualSize}_t $attr->{id}_Type$arrayDimensions;\n"; - print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u8" . - "$arrayDimensions\n"; - $attrOverride .= "\t\t0x$attrIdHash{$attr->{id}},\n"; - $attrOverride .= "\t\tsizeof(${actualSize}_t),\n"; - } - else - { - print ("fapiParseAttributeInfo.pl ERROR. valueType not recognized: "); - print $attr->{valueType}, "\n"; - exit(1); - } - $attrOverride .= "\t\t{ $arrayDimString }\n"; - $attrOverride .= "\t},\n"; - } - - #---------------------------------------------------------------------- - # Print if the attribute is privileged - #---------------------------------------------------------------------- - if (exists $attr->{privileged}) - { - print AIFILE "const bool $attr->{id}_Privileged = true;\n"; - } - else - { - print AIFILE "const bool $attr->{id}_Privileged = false;\n"; - } - - #---------------------------------------------------------------------- - # Print the target type(s) that the attribute is associated with - #---------------------------------------------------------------------- - if (! exists $attr->{targetType}) - { - print ("fapiParseAttributeInfo.pl ERROR. Att 'targetType' missing\n"); - exit(1); - } - - print AIFILE "const TargetTypes_t $attr->{id}_TargetTypes = "; - - # Split on commas - my @targTypes = split(',', $attr->{targetType}); - - my $targTypeCount = 0; - foreach my $targType (@targTypes) - { - # Remove newlines and leading/trailing whitespace - $targType =~ s/\n//; - $targType =~ s/^\s+//; - $targType =~ s/\s+$//; - - if ($targTypeCount != 0) - { - print AIFILE " | "; - } - print AIFILE "$targType"; - $targTypeCount++; - } - print AIFILE ";\n"; - - #---------------------------------------------------------------------- - # Print if the attribute is a platInit attribute - #---------------------------------------------------------------------- - if (exists $attr->{platInit}) - { - print AIFILE "const bool $attr->{id}_PlatInit = true;\n"; - } - else - { - print AIFILE "const bool $attr->{id}_PlatInit = false;\n"; - } - - #---------------------------------------------------------------------- - # Print the value enumeration (if specified) to fapiAttributeIds.H and - # fapiAttributeEnums.txt - #---------------------------------------------------------------------- - if (exists $attr->{enum}) - { - print AIFILE "enum $attr->{id}_Enum\n{\n"; - - # Values must be separated by commas to allow for values to be - # specified: <enum>VAL_A = 3, VAL_B = 5, VAL_C = 0x23</enum> - my @vals = split(',', $attr->{enum}); - - foreach my $val (@vals) - { - # Remove newlines and leading/trailing whitespace - $val =~ s/\n//; - $val =~ s/^\s+//; - $val =~ s/\s+$//; - - my @values = split('=', ${val}); - # Remove newlines and leading/trailing whitespace - - foreach my $value (@values) - { - $value =~ s/\n//; - $value =~ s/^\s+//; - $value =~ s/\s+$//; - } - - push @attrOverrideEnums, - "\t{ \"$attr->{id}_$values[0]\", $values[1] },\n"; - - # Print the attribute enum to fapiAttributeIds.H - print AIFILE " ENUM_$attr->{id}_${val}"; - - # Print the attribute enum to fapiAttrEnumInfo.csv - my $attrEnumTxt = "$attr->{id}_${val}\n"; - - - $attrEnumTxt =~ s/ = /,/; - print ETFILE $attrEnumTxt; - - - if ($attr->{valueType} eq 'uint64') - { - print AIFILE "ULL"; - } - - print AIFILE ",\n"; - } - - print AIFILE "};\n"; - } - - #---------------------------------------------------------------------- - # Print _GETMACRO and _SETMACRO where appropriate to fapiAttributeIds.H - #---------------------------------------------------------------------- - if (exists $attr->{chipEcFeature}) - { - #------------------------------------------------------------------ - # The attribute is a Chip EC Feature, define _GETMACRO to call a - # fapi function and define _SETMACRO to something that will cause a - # compile failure if a set is attempted - #------------------------------------------------------------------ - print AIFILE "#define $attr->{id}_GETMACRO(ID, PTARGET, VAL) \\\n"; - print AIFILE " PLAT_GET_CHIP_EC_FEATURE_OVERRIDE(ID, PTARGET, VAL) ? fapi::FAPI_RC_SUCCESS : \\\n"; - print AIFILE " fapi::fapiQueryChipEcFeature(fapi::ID, PTARGET, VAL)\n"; - print AIFILE "#define $attr->{id}_SETMACRO(ID, PTARGET, VAL) "; - print AIFILE "CHIP_EC_FEATURE_ATTRIBUTE_NOT_WRITABLE\n"; - } - elsif (! exists $attr->{writeable}) - { - #------------------------------------------------------------------ - # The attribute is read-only, define the _SETMACRO to something - # that will cause a compile failure if a set is attempted - #------------------------------------------------------------------ - if (! exists $attr->{writeable}) - { - print AIFILE "#define $attr->{id}_SETMACRO ATTRIBUTE_NOT_WRITABLE\n"; - } - } - - #---------------------------------------------------------------------- - # If the attribute is a Chip EC Feature, print the chip EC feature - # query to fapiChipEcFeature.C - #---------------------------------------------------------------------- - if (exists $attr->{chipEcFeature}) - { - my $chipCount = 0; - print ECFILE " case $attr->{id}:\n"; - print ECFILE " if (\n"; - - foreach my $chip (@{$attr->{chipEcFeature}->{chip}}) - { - $chipCount++; - - if (! exists $chip->{name}) - { - print ("fapiParseAttributeInfo.pl ERROR. Att 'name' missing\n"); - exit(1); - } - - if (! exists $chip->{ec}) - { - print ("fapiParseAttributeInfo.pl ERROR. Att 'ec' missing\n"); - exit(1); - } - - if (! exists $chip->{ec}->{value}) - { - print ("fapiParseAttributeInfo.pl ERROR. Att 'value' missing\n"); - exit(1); - } - - if (! exists $chip->{ec}->{test}) - { - print ("fapiParseAttributeInfo.pl ERROR. Att 'test' missing\n"); - exit(1); - } - - my $test; - if ($chip->{ec}->{test} eq 'EQUAL') - { - $test = '=='; - } - elsif ($chip->{ec}->{test} eq 'GREATER_THAN') - { - $test = '>'; - } - elsif ($chip->{ec}->{test} eq 'GREATER_THAN_OR_EQUAL') - { - $test = '>='; - } - elsif ($chip->{ec}->{test} eq 'LESS_THAN') - { - $test = '<'; - } - elsif ($chip->{ec}->{test} eq 'LESS_THAN_OR_EQUAL') - { - $test = '<='; - } - else - { - print ("fapiParseAttributeInfo.pl ERROR. test '$chip->{ec}->{test}' unrecognized\n"); - exit(1); - } - - if ($chipCount > 1) - { - print ECFILE " ||\n"; - } - print ECFILE " ((l_chipName == $chip->{name}) &&\n"; - print ECFILE " (l_chipEc $test $chip->{ec}->{value}))\n"; - } - - print ECFILE " )\n"; - print ECFILE " {\n"; - print ECFILE " o_hasFeature = true;\n"; - print ECFILE " }\n"; - print ECFILE " break;\n"; - } - - #---------------------------------------------------------------------- - # Print the platform attribute checks to fapiAttributePlatCheck.H - #---------------------------------------------------------------------- - if (exists $attr->{writeable}) - { - print ACFILE "#ifndef $attr->{id}_SETMACRO\n"; - print ACFILE "#error Platform does not support set of HWPF attr $attr->{id}\n"; - print ACFILE "#endif\n"; - } - - print ACFILE "#ifndef $attr->{id}_GETMACRO\n"; - print ACFILE "#error Platform does not support get of HWPF attr $attr->{id}\n"; - print ACFILE "#endif\n\n"; - - #---------------------------------------------------------------------- - # Print newline between each attribute's info to fapiAttributeIds.H - #---------------------------------------------------------------------- - print AIFILE "\n"; - - #---------------------------------------------------------------------- - # Add attribute override string to map. - #---------------------------------------------------------------------- - $attrOverrideData{$attr->{id}} = $attrOverride; - }; -} - -#------------------------------------------------------------------------------ -# Print End of file information to fapiAttributeIds.H -#------------------------------------------------------------------------------ -print AIFILE "}\n\n"; -print AIFILE "#endif\n"; - -#------------------------------------------------------------------------------ -# Print End of file information to fapiChipEcFeature.C -#------------------------------------------------------------------------------ -print ECFILE " default:\n"; -print ECFILE " FAPI_ERR(\"fapiQueryChipEcFeature: Unknown feature 0x%x\",\n"; -print ECFILE " i_id);\n"; -print ECFILE " l_rc.setFapiError(FAPI_RC_INVALID_CHIP_EC_FEATURE_GET);\n"; -print ECFILE " l_rc.addEIFfdc(0, &i_id, sizeof(i_id));\n"; -print ECFILE " break;\n"; -print ECFILE " }\n\n"; -print ECFILE " if (o_hasFeature)\n"; -print ECFILE " {\n"; -print ECFILE " FAPI_INF(\"fapiQueryChipEcFeature: Chip (0x%x:0x%x) has "; -print ECFILE "feature (0x%x)\", l_chipName, l_chipEc, i_id);\n"; -print ECFILE " }\n"; -print ECFILE " else\n"; -print ECFILE " {\n"; -print ECFILE " FAPI_INF(\"fapiQueryChipEcFeature: Chip (0x%x:0x%x) does not "; -print ECFILE "have feature (0x%x)\", l_chipName, l_chipEc, i_id);\n"; -print ECFILE " }\n"; -print ECFILE " }\n"; -print ECFILE " }\n"; -print ECFILE " }\n"; -print ECFILE " return l_rc;\n"; -print ECFILE "}\n\n"; -print ECFILE "}\n"; - - -#------------------------------------------------------------------------------ -# Print End of file information to fapiAttributePlatCheck.H -#------------------------------------------------------------------------------ -print ACFILE "#endif\n"; - -#------------------------------------------------------------------------------ -# Print End of file information to fapiAttributesSupported.html -#------------------------------------------------------------------------------ -print ASFILE "</table>\n\n"; -print ASFILE "</body>\n"; -print ASFILE "</html>\n"; - -#------------------------------------------------------------------------------ -# Print content for getFapiAttrData.C -#------------------------------------------------------------------------------ -foreach my $override (sort keys %attrOverrideData) -{ - print FMFILE $attrOverrideData{$override}; -} -print FMFILE "};\n"; - -#------------------------------------------------------------------------------ -# Print footer for getFapiAttrEnumData.C -#------------------------------------------------------------------------------ -foreach my $override (sort @attrOverrideEnums) -{ - print FEFILE $override; -} -print FEFILE "};\n"; - - - -#------------------------------------------------------------------------------ -# Close output files -#------------------------------------------------------------------------------ -close(AIFILE); -close(ECFILE); -close(ACFILE); -close(ASFILE); -close(ITFILE); -close(ETFILE); -close(FMFILE); -close(FEFILE); - diff --git a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl deleted file mode 100755 index 36df57d6f..000000000 --- a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl +++ /dev/null @@ -1,1229 +0,0 @@ -#!/usr/bin/perl -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/hwpf/fapi/fapiParseErrorInfo.pl $ -# -# OpenPOWER HostBoot Project -# -# Contributors Listed Below - COPYRIGHT 2011,2015 -# [+] International Business Machines Corp. -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. See the License for the specific language governing -# permissions and limitations under the License. -# -# IBM_PROLOG_END_TAG - -# $Id: fapiParseErrorInfo.pl,v 1.34 2015/05/27 17:10:16 rjknight Exp $ -# Purpose: This perl script will parse HWP Error XML files and create required -# FAPI code. -# -# Author: CamVan Nguyen and Mike Jones -# -# 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 -# mjjones 08/08/11 Large update to create more code -# mjjones 08/24/11 Parse GARD info -# mjjones 09/22/11 New Error Info Design -# camvanng 10/20/11 Fix bug -# mjjones 12/16/11 Improved usage statement -# mjjones 02/10/12 Allow err file with one element -# mjjones 03/22/12 Generate hash values for enums -# mjjones 05/15/12 Detect duplicate error rcs -# mjjones 05/21/12 Detect duplicate ids/hashes across files -# mjjones 06/27/12 Add assembler output for SBE usage -# mjjones 09/19/12 Generate FFDC ID enumeration -# Generate fapiCollectRegFfdc.C file -# mjjones 10/23/12 Minor fix for Cronus compile failure -# mjjones 11/09/12 Generate fapiSetSbeError.H -# mjjones 01/09/13 Fix CFAM register capture -# mjjones 03/14/13 Allow 64bit literals for SCOM reg capture -# mjjones 03/22/13 Support Procedure Callouts -# mjjones 04/25/13 Allow multiple register ffdc ids in a -# collectRegisterFfdc element -# mjjones 05/20/13 Support Bus Callouts -# mjjones 06/24/13 Support Children CDGs -# mjjones 08/20/13 Use constants for Reg FFDC collection -# mjjones 08/26/13 Support HW Callouts -# dedahle 09/30/13 Support chiplet register FFDC collection -# rjknight 09/24/13 Allow callout/deconfigure/gard of -# DIMM(s) related to MBA -# dedahle 10/15/13 Support register FFDC collection based on -# present children -# whs 03/11/14 Add FW traces to error logs -# mjjones 03/20/14 Fix register FFDC collection bug when -# collecting chiplet registers -# mjjones 03/26/14 Generate HWP error on unknown SBE error -# maploetz 06/11/14 Callout deconfig/gard target on all SBE -# errors -# rjknight 05/27/15 Include hwInstance parsing for PCI clock -# callouts -# -# End Change Log ***************************************************** -# -# Usage: -# fapiParseErrorInfo.pl <output dir> <filename1> <filename2> ... - -use strict; - -#------------------------------------------------------------------------------ -# Set PREFERRED_PARSER to XML::Parser. Otherwise it uses XML::SAX which contains -# bugs that result in XML parse errors that can be fixed by adjusting white- -# space (i.e. parse errors that do not make sense). -#------------------------------------------------------------------------------ -$XML::Simple::PREFERRED_PARSER = 'XML::Parser'; - -#------------------------------------------------------------------------------ -# Specify perl modules to use -#------------------------------------------------------------------------------ -use Digest::MD5 qw(md5_hex); -use XML::Simple; -my $xml = new XML::Simple (KeyAttr=>[]); - -# Uncomment to enable debug output -#use Data::Dumper; - -#------------------------------------------------------------------------------ -# Print Command Line Help -#------------------------------------------------------------------------------ -my $numArgs = $#ARGV + 1; -if ($numArgs < 2) -{ - print ("Usage: fapiParseErrorInfo.pl <output dir> <filename1> <filename2> ...\n"); - print (" This perl script will parse HWP Error XML files and create\n"); - print (" the following files:\n"); - print (" - fapiHwpReturnCodes.H. HwpReturnCode enumeration (HWP generated errors)\n"); - print (" - fapiHwpErrorInfo.H. Error information (used by FAPI_SET_HWP_ERROR\n"); - print (" when a HWP generates an error)\n"); - print (" - fapiCollectRegFfdc.C. Function to collect register FFDC\n"); - print (" - fapiSetSbeError.H. Macro to create an SBE error\n"); - exit(1); -} - -#------------------------------------------------------------------------------ -# Hashes containing error names/enum-values -#------------------------------------------------------------------------------ -my %errNameToValueHash; -my %errValuePresentHash; - -#------------------------------------------------------------------------------ -# Hashes containing ffdc names/enum-values -#------------------------------------------------------------------------------ -my %ffdcNameToValueHash; -my %ffdcValuePresentHash; - -#------------------------------------------------------------------------------ -# Subroutine that checks if an entry exists in an array. If it doesn't exist -# then it is added. The index of the entry within the array is returned -#------------------------------------------------------------------------------ -sub addEntryToArray -{ - my ($arrayref, $entry ) = @_; - - my $match = 0; - my $index = 0; - - foreach my $element (@$arrayref) - { - if ($element eq $entry) - { - $match = 1; - last; - } - else - { - $index++; - } - } - - if (!($match)) - { - push(@$arrayref, $entry); - } - - return $index; -} - -#------------------------------------------------------------------------------ -# Subroutine that figures out an error enum value from an error name and stores -# it in global hashes -#------------------------------------------------------------------------------ -sub setErrorEnumValue -{ - my $name = $_[0]; - - #-------------------------------------------------------------------------- - # Check that the error name is not a duplicate - #-------------------------------------------------------------------------- - if (exists($errNameToValueHash{$name})) - { - # Two different errors with the same name! - print ("fapiParseErrorInfo.pl ERROR. Duplicate error name ", $name, "\n"); - exit(1); - } - - #-------------------------------------------------------------------------- - # Figure out the error enum-value. This is a hash value generated from - # the error name. A hash is used for Cronus so that if a HWP is not - # recompiled against a new eCMD/Cronus version where the errors have - # changed then there will not be a mismatch in error values. - # This is a 24bit hash value because FAPI has a requirement that the - # top byte of the 32 bit error value be zero to store flags indicating - # the creator of the error - #-------------------------------------------------------------------------- - my $errHash128Bit = md5_hex($name); - my $errHash24Bit = substr($errHash128Bit, 0, 6); - - #-------------------------------------------------------------------------- - # Check that the error enum-value is not a duplicate - #-------------------------------------------------------------------------- - if (exists($errValuePresentHash{$errHash24Bit})) - { - # Two different errors generate the same hash-value! - print ("fapiParseAttributeInfo.pl ERROR. Duplicate error hash value\n"); - exit(1); - } - - #-------------------------------------------------------------------------- - # Update the hashes with the error name and ID - #-------------------------------------------------------------------------- - $errValuePresentHash{$errHash24Bit} = 1; - $errNameToValueHash{$name} = $errHash24Bit; -} - -#------------------------------------------------------------------------------ -# Subroutine that figures out an FFDC ID value from an FFDC name and stores it -# in global hashes for use when creating the enumeration of FFDC IDs -#------------------------------------------------------------------------------ -sub setFfdcIdValue -{ - my $name = $_[0]; - - #-------------------------------------------------------------------------- - # Check that the FFDC name is not a duplicate - #-------------------------------------------------------------------------- - if (exists($ffdcNameToValueHash{$name})) - { - # Two different FFDCs with the same name! - print ("fapiParseErrorInfo.pl ERROR. Duplicate FFDC name ", $name, "\n"); - exit(1); - } - - #-------------------------------------------------------------------------- - # Figure out the FFDC enum-value. This is a hash value generated from - # the FFDC name. - #-------------------------------------------------------------------------- - my $ffdcHash128Bit = md5_hex($name); - my $ffdcHash32Bit = substr($ffdcHash128Bit, 0, 8); - - #-------------------------------------------------------------------------- - # Check that the error enum-value is not a duplicate - #-------------------------------------------------------------------------- - if (exists($ffdcValuePresentHash{$ffdcHash32Bit})) - { - # Two different FFDCs generate the same hash-value! - print ("fapiParseAttributeInfo.pl ERROR. Duplicate FFDC hash value\n"); - exit(1); - } - - #-------------------------------------------------------------------------- - # Update the hashes with the error name and ID - #-------------------------------------------------------------------------- - $ffdcValuePresentHash{$ffdcHash32Bit} = 1; - $ffdcNameToValueHash{$name} = $ffdcHash32Bit; -} - -#------------------------------------------------------------------------------ -# Open output files for writing -#------------------------------------------------------------------------------ -my $rcFile = $ARGV[0]; -$rcFile .= "/"; -$rcFile .= "fapiHwpReturnCodes.H"; -open(RCFILE, ">", $rcFile); - -my $eiFile = $ARGV[0]; -$eiFile .= "/"; -$eiFile .= "fapiHwpErrorInfo.H"; -open(EIFILE, ">", $eiFile); - -my $crFile = $ARGV[0]; -$crFile .= "/"; -$crFile .= "fapiCollectRegFfdc.C"; -open(CRFILE, ">", $crFile); - -my $sbFile = $ARGV[0]; -$sbFile .= "/"; -$sbFile .= "fapiSetSbeError.H"; -open(SBFILE, ">", $sbFile); - -#------------------------------------------------------------------------------ -# Print start of file information to fapiHwpErrorInfo.H -#------------------------------------------------------------------------------ -print EIFILE "// fapiHwpErrorInfo.H\n"; -print EIFILE "// This file is generated by perl script fapiParseErrorInfo.pl\n\n"; -print EIFILE "#ifndef FAPIHWPERRORINFO_H_\n"; -print EIFILE "#define FAPIHWPERRORINFO_H_\n\n"; -print EIFILE "/**\n"; -print EIFILE " * \@brief Error Information macros and HwpFfdcId enumeration\n"; -print EIFILE " *\/\n"; - -#------------------------------------------------------------------------------ -# Print start of file information to fapiCollectRegFfdc.C -#------------------------------------------------------------------------------ -print CRFILE "// fapiCollectRegFfdc.C\n"; -print CRFILE "// This file is generated by perl script fapiParseErrorInfo.pl\n\n"; -print CRFILE "#include <stdint.h>\n"; -print CRFILE "#include <vector>\n"; -print CRFILE "#include <ecmdDataBufferBase.H>\n"; -print CRFILE "#include <fapiCollectRegFfdc.H>\n"; -print CRFILE "#include <fapiTarget.H>\n"; -print CRFILE "#include <fapiReturnCode.H>\n"; -print CRFILE "#include <fapiHwAccess.H>\n"; -print CRFILE "#include <fapiPlatTrace.H>\n"; -print CRFILE "#include <fapiPlatRegAddresses.H>\n\n"; -print CRFILE "#include <fapiAttributeService.H>\n"; -print CRFILE "#include <fapiSystemConfig.H>\n\n"; - -print CRFILE "namespace fapi\n"; -print CRFILE "{\n"; -print CRFILE "void fapiCollectRegFfdc(const fapi::Target & i_target,\n"; -print CRFILE " const fapi::HwpFfdcId i_ffdcId,\n"; -print CRFILE " fapi::ReturnCode & o_rc,\n"; -print CRFILE " fapi::TargetType i_child,\n"; -print CRFILE " fapi::TargetType i_presChild,\n"; -print CRFILE " uint32_t i_childOffsetMult)\n"; -print CRFILE "{\n"; -print CRFILE " FAPI_INF(\"fapiCollectRegFfdc. FFDC ID: 0x%x\", i_ffdcId);\n"; -print CRFILE " fapi::ReturnCode l_rc;\n"; -print CRFILE " ecmdDataBufferBase l_buf;\n"; -print CRFILE " uint32_t l_cfamData = 0;\n"; -print CRFILE " uint64_t l_scomData = 0;\n"; -print CRFILE " std::vector<uint32_t> l_cfamAddresses;\n"; -print CRFILE " std::vector<uint64_t> l_scomAddresses;\n"; -print CRFILE " uint32_t l_ffdcSize = 0;\n\n"; -print CRFILE " switch (i_ffdcId)\n"; -print CRFILE " {\n"; - -#------------------------------------------------------------------------------ -# Print start of file information to fapiSetSbeError.H -#------------------------------------------------------------------------------ -print SBFILE "// fapiSetSbeError.H\n"; -print SBFILE "// This file is generated by perl script fapiParseErrorInfo.pl\n\n"; -print SBFILE "// When SBE code creates an error, it produces an error value\n"; -print SBFILE "// that matches a value in the HwpReturnCode enum in\n"; -print SBFILE "// fapiHwpReturnCodes.H. The SBE uses the __ASSEMBLER__\n"; -print SBFILE "// primitives in fapiHwpReturnCodes.H to do this. The function\n"; -print SBFILE "// that extracts the error value from the SBE needs to call\n"; -print SBFILE "// FAPI_SET_HWP_ERROR to create the error and get all the\n"; -print SBFILE "// actions in the error XML file performed, but that macro can\n"; -print SBFILE "// only be called with the enumerator, not the value. This\n"; -print SBFILE "// FAPI_SET_SBE_ERROR macro can be called instead, it calls\n"; -print SBFILE "// FAPI_SET_HWP_ERROR with the correct error enumerator.\n"; -print SBFILE "// Errors containing <sbeError/> in their XML are supported\n"; -print SBFILE "// in this macro.\n\n"; -print SBFILE "// Note that it is expected that this macro will be called\n"; -print SBFILE "// in one place (the function that extracts the error from\n"; -print SBFILE "// the SBE), if this changes and it is called in multiple\n"; -print SBFILE "// places then the macro could be turned into a function to\n"; -print SBFILE "// avoid the code size increase of expanding the macro in\n"; -print SBFILE "// multiple places. The function approach is slightly more\n"; -print SBFILE "// complicated, there is an extra C file and the function\n"; -print SBFILE "// must take a parameter for the generic chip ID in the error\n"; -print SBFILE "// XML.\n\n"; -print SBFILE "#ifndef FAPISETSBEERROR_H_\n"; -print SBFILE "#define FAPISETSBEERROR_H_\n\n"; -print SBFILE "#define FAPI_SET_SBE_ERROR(RC, ERRVAL)\\\n"; -print SBFILE "{\\\n"; -print SBFILE "switch (ERRVAL)\\\n"; -print SBFILE "{\\\n"; - -#------------------------------------------------------------------------------ -# For each XML file -#------------------------------------------------------------------------------ -foreach my $argnum (1 .. $#ARGV) -{ - my $infile = $ARGV[$argnum]; - my $count = 0; - - #-------------------------------------------------------------------------- - # Read XML file. The ForceArray option ensures that there is an array of - # elements even if there is only one element - #-------------------------------------------------------------------------- - my $errors = $xml->XMLin($infile, ForceArray => - ['hwpError', 'collectFfdc', 'ffdc', 'callout', 'deconfigure', 'gard', - 'registerFfdc', 'collectRegisterFfdc', 'cfamRegister', 'scomRegister', - 'id','collectTrace']); - - # Uncomment to get debug output of all errors - #print "\nFile: ", $infile, "\n", Dumper($errors), "\n"; - - #-------------------------------------------------------------------------- - # For each Error - #-------------------------------------------------------------------------- - foreach my $err (@{$errors->{hwpError}}) - { - #---------------------------------------------------------------------- - # Check that expected fields are present - #---------------------------------------------------------------------- - if (! exists $err->{rc}) - { - print ("fapiParseErrorInfo.pl ERROR. rc missing\n"); - exit(1); - } - - if (! exists $err->{description}) - { - print ("fapiParseErrorInfo.pl ERROR in $err->{rc}. description missing\n"); - exit(1); - } - - #---------------------------------------------------------------------- - # Set the error enum value in a global hash - #--------------------------------------------------------------------- - setErrorEnumValue($err->{rc}); - - #---------------------------------------------------------------------- - # If this is an SBE error, add it to fapiSetSbeError.H - #---------------------------------------------------------------------- - if (exists $err->{sbeError}) - { - print SBFILE " case fapi::$err->{rc}:\\\n"; - print SBFILE " FAPI_SET_HWP_ERROR(RC, $err->{rc});\\\n"; - print SBFILE " break;\\\n"; - } - - #---------------------------------------------------------------------- - # Print the CALL_FUNCS_TO_COLLECT_FFDC macro to fapiHwpErrorInfo.H - #---------------------------------------------------------------------- - print EIFILE "#define $err->{rc}_CALL_FUNCS_TO_COLLECT_FFDC(RC) "; - $count = 0; - - foreach my $collectFfdc (@{$err->{collectFfdc}}) - { - if ($count == 0) - { - print EIFILE "{ fapi::ReturnCode l_tempRc; "; - } - $count++; - - print EIFILE "FAPI_EXEC_HWP(l_tempRc, $collectFfdc, RC); "; - } - - if ($count > 0) - { - print EIFILE "}"; - } - - print EIFILE "\n"; - - #---------------------------------------------------------------------- - # Print the CALL_FUNCS_TO_COLLECT_REG_FFDC macro to fapiHwpErrorInfo.H - #---------------------------------------------------------------------- - print EIFILE "#define $err->{rc}_CALL_FUNCS_TO_COLLECT_REG_FFDC(RC) "; - - foreach my $collectRegisterFfdc (@{$err->{collectRegisterFfdc}}) - { - #------------------------------------------------------------------ - # Check that expected fields are present - #------------------------------------------------------------------ - if (! exists $collectRegisterFfdc->{id}[0]) - { - print ("fapiParseErrorInfo.pl ERROR in $err->{rc}. id(s) missing from collectRegisterFfdc\n"); - exit(1); - } - foreach my $id (@{$collectRegisterFfdc->{id}}) - { - #--------------------------------------------------------------------------------- - # Check FFDC register collection type: target, child, or based on present children - #--------------------------------------------------------------------------------- - if (exists $collectRegisterFfdc->{target}) - { - print EIFILE "fapiCollectRegFfdc($collectRegisterFfdc->{target}, "; - print EIFILE "fapi::$id, RC); "; - } - elsif (exists $collectRegisterFfdc->{childTargets}) - { - if (! exists $collectRegisterFfdc->{childTargets}->{parent}) - { - print ("fapiParseErrorInfo.pl ERROR: parent missing from collectRegisterFfdc\n"); - exit(1); - } - if (! exists $collectRegisterFfdc->{childTargets}->{childType}) - { - print ("fapiParseErrorInfo.pl ERROR: childType missing from collectRegisterFfdc\n"); - exit(1); - } - print EIFILE "fapiCollectRegFfdc($collectRegisterFfdc->{childTargets}->{parent}, "; - print EIFILE "fapi::$id, RC, fapi::$collectRegisterFfdc->{childTargets}->{childType}); "; - } - elsif (exists $collectRegisterFfdc->{basedOnPresentChildren}) - { - if (! exists $collectRegisterFfdc->{basedOnPresentChildren}->{target}) - { - print ("fapiParseErrorInfo.pl ERROR: target missing from collectRegisterFfdc\n"); - exit(1); - } - if (! exists $collectRegisterFfdc->{basedOnPresentChildren}->{childType}) - { - print ("fapiParseErrorInfo.pl ERROR: childType missing from collectRegisterFfdc\n"); - exit(1); - } - if (! exists $collectRegisterFfdc->{basedOnPresentChildren}->{childPosOffsetMultiplier}) - { - print ("fapiParseErrorInfo.pl ERROR: childPosOffsetMultiplier missing from collectRegisterFfdc\n"); - exit(1); - } - print EIFILE "fapiCollectRegFfdc($collectRegisterFfdc->{basedOnPresentChildren}->{target}, "; - print EIFILE "fapi::$id, RC, fapi::TARGET_TYPE_NONE, fapi::$collectRegisterFfdc->{basedOnPresentChildren}->{childType}, "; - print EIFILE "$collectRegisterFfdc->{basedOnPresentChildren}->{childPosOffsetMultiplier});"; - } - else - { - print ("fapiParseErrorInfo.pl ERROR: Invalid collectRegisterFfdc configuration\n"); - exit(1); - } - } - } - - print EIFILE "\n"; - - #---------------------------------------------------------------------- - # Print the ADD_ERROR_INFO macro to fapiHwpErrorInfo.H - #---------------------------------------------------------------------- - print EIFILE "#define $err->{rc}_ADD_ERROR_INFO(RC) "; - - # Array of EI Objects - my @eiObjects; - - my $eiObjectStr = "const void * l_objects[] = {"; - my $eiEntryStr = ""; - my $eiEntryCount = 0; - my %cdgTargetHash; # Records the callout/deconfigure/gards for Targets - my %cdgChildHash; # Records the callout/deconfigure/gards for Children - - # collect firmware trace - foreach my $collectTrace (@{$err->{collectTrace}}) - { - # Add an EI entry to eiEntryStr - $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi::ReturnCode::EI_TYPE_COLLECT_TRACE; \\\n"; - $eiEntryStr .= " l_entries[$eiEntryCount].collect_trace.iv_eieTraceId = fapi::CollectTraces::$collectTrace; \\\n"; - $eiEntryCount++; - } - - # Local FFDC - foreach my $ffdc (@{$err->{ffdc}}) - { - # Set the FFDC ID value in a global hash. The name is <rc>_<ffdc> - my $ffdcName = $err->{rc} . "_"; - $ffdcName = $ffdcName . $ffdc; - setFfdcIdValue($ffdcName); - - # Add the FFDC data to the EI Object array if it doesn't already exist - my $objNum = addEntryToArray(\@eiObjects, $ffdc); - - # Add an EI entry to eiEntryStr - $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi::ReturnCode::EI_TYPE_FFDC; \\\n"; - $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcObjIndex = $objNum; \\\n"; - $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcId = fapi::$ffdcName; \\\n"; - $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcSize = fapi::ReturnCodeFfdc::getErrorInfoFfdcSize($ffdc); \\\n"; - $eiEntryCount++; - } - - # Procedure/Target/Bus/Child callouts - foreach my $callout (@{$err->{callout}}) - { - if (! exists $callout->{priority}) - { - print ("fapiParseErrorInfo.pl ERROR in $err->{rc}. Callout priority missing\n"); - exit(1); - } - - my $elementsFound = 0; - if (exists $callout->{hw}) - { - # HW Callout - if (! exists $callout->{hw}->{hwid}) - { - print ("fapiParseErrorInfo.pl ERROR in $err->{rc}. HW Callout hwid missing\n"); - exit(1); - } - - # Check that there is a reference target - if (! exists $callout->{hw}->{refTarget}) - { - print ("fapiParseErrorInfo.pl ERROR in $err->{rc}. Callout missing refTarget\n"); - exit(1); - } - - # Add an EI entry to eiEntryStr - $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi::ReturnCode::EI_TYPE_HW_CALLOUT; \\\n"; - $eiEntryStr .= " l_entries[$eiEntryCount].hw_callout.iv_hw = fapi::HwCallouts::$callout->{hw}->{hwid}; \\\n"; - $eiEntryStr .= " l_entries[$eiEntryCount].hw_callout.iv_calloutPriority = fapi::CalloutPriorities::$callout->{priority}; \\\n"; - if (exists $callout->{hw}->{refTarget}) - { - # Add the Targets to the objectlist if they don't already exist - my $objNum = addEntryToArray(\@eiObjects, $callout->{hw}->{refTarget}); - $eiEntryStr .= " l_entries[$eiEntryCount].hw_callout.iv_refObjIndex = $objNum; \\\n"; - } - else - { - $eiEntryStr .= " l_entries[$eiEntryCount].hw_callout.iv_refObjIndex = 0xff; \\\n"; - } - - if (exists $callout->{hw}->{hwInstance}) - { - # Add the Targets to the objectlist if they don't already exist - my $objNum = addEntryToArray(\@eiObjects, $callout->{hw}->{hwInstance}); - $eiEntryStr .= " l_entries[$eiEntryCount].hw_callout.iv_objPosIndex = $objNum; \\\n"; - } - else - { - $eiEntryStr .= " l_entries[$eiEntryCount].hw_callout.iv_objPosIndex = 0xff; \\\n" - } - - $eiEntryCount++; - $elementsFound++; - } - if (exists $callout->{procedure}) - { - # Procedure Callout - # Add an EI entry to eiEntryStr - $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi::ReturnCode::EI_TYPE_PROCEDURE_CALLOUT; \\\n"; - $eiEntryStr .= " l_entries[$eiEntryCount].proc_callout.iv_procedure = fapi::ProcedureCallouts::$callout->{procedure}; \\\n"; - $eiEntryStr .= " l_entries[$eiEntryCount].proc_callout.iv_calloutPriority = fapi::CalloutPriorities::$callout->{priority}; \\\n"; - $eiEntryCount++; - $elementsFound++; - } - if (exists $callout->{bus}) - { - # A Bus Callout consists of two targets separated by - # commas/spaces - my @targets = split(/\s*,\s*|\s+/, $callout->{bus}); - - if (scalar @targets != 2) - { - print ("fapiParseErrorInfo.pl ERROR in $err->{rc}. did not find two targets in bus callout\n"); - exit(1); - } - - # Check the type of the Targets - print EIFILE "fapi::fapiCheckType<const fapi::Target *>(&$targets[0]); \\\n"; - print EIFILE "fapi::fapiCheckType<const fapi::Target *>(&$targets[1]); \\\n"; - - # Add the Targets to the objectlist if they don't already exist - my $objNum1 = addEntryToArray(\@eiObjects, $targets[0]); - my $objNum2 = addEntryToArray(\@eiObjects, $targets[1]); - - # Add an EI entry to eiEntryStr - $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi::ReturnCode::EI_TYPE_BUS_CALLOUT; \\\n"; - $eiEntryStr .= " l_entries[$eiEntryCount].bus_callout.iv_endpoint1ObjIndex = $objNum1; \\\n"; - $eiEntryStr .= " l_entries[$eiEntryCount].bus_callout.iv_endpoint2ObjIndex = $objNum2; \\\n"; - $eiEntryStr .= " l_entries[$eiEntryCount].bus_callout.iv_calloutPriority = fapi::CalloutPriorities::$callout->{priority}; \\\n"; - $eiEntryCount++; - $elementsFound++; - } - if (exists $callout->{target}) - { - # Add the Target to cdgTargetHash to be processed with any - # deconfigure and GARD requests - $cdgTargetHash{$callout->{target}}{callout} = 1; - $cdgTargetHash{$callout->{target}}{priority} = - $callout->{priority}; - - $elementsFound++; - } - if (exists $callout->{childTargets}) - { - # Check that the parent and childType subelements exist - if (! exists $callout->{childTargets}->{parent}) - { - print ("fapiParseErrorInfo.pl ERROR in $err->{rc}. Child Callout parent missing\n"); - exit(1); - } - - if (! exists $callout->{childTargets}->{childType}) - { - print ("fapiParseErrorInfo.pl ERROR in $err->{rc}. Child Callout childType missing\n"); - exit(1); - } - - # Add the child info to cdgChildHash to be processed with - # any deconfigure and GARD requests - my $parent = $callout->{childTargets}->{parent}; - my $childType = $callout->{childTargets}->{childType}; - $cdgChildHash{$parent}{$childType}{callout} = 1; - $cdgChildHash{$parent}{$childType}{priority} = - $callout->{priority}; - - $elementsFound++; - - if (exists $callout->{childTargets}->{childPort}) - { - my $childPort = $callout->{childTargets}->{childPort}; - - $cdgChildHash{$parent}{$childType}{childPort} = $childPort; - } - - if (exists $callout->{childTargets}->{childNumber}) - { - my $childNum = $callout->{childTargets}->{childNumber}; - $cdgChildHash{$parent}{$childType}{childNumber} = $childNum; - } - - } - if ($elementsFound == 0) - { - print ("fapiParseErrorInfo.pl ERROR in $err->{rc}. Callout incomplete\n"); - exit(1); - } - elsif ($elementsFound > 1) - { - print ("fapiParseErrorInfo.pl ERROR in $err->{rc}. Callout has multiple elements\n"); - exit(1); - } - } # callout - - # Target/Child deconfigures - foreach my $deconfigure (@{$err->{deconfigure}}) - { - my $elementsFound = 0; - if (exists $deconfigure->{target}) - { - # Add the Target to cdgTargetHash to be processed with any - # callout and GARD requests - $cdgTargetHash{$deconfigure->{target}}{deconf} = 1; - $elementsFound++; - } - if (exists $deconfigure->{childTargets}) - { - # Check that the parent and childType subelements exist - if (! exists $deconfigure->{childTargets}->{parent}) - { - print ("fapiParseErrorInfo.pl ERROR in $err->{rc}. Child Deconfigure parent missing\n"); - exit(1); - } - if (! exists $deconfigure->{childTargets}->{childType}) - { - print ("fapiParseErrorInfo.pl ERROR in $err->{rc}. Child Deconfigure childType missing\n"); - exit(1); - } - - # Add the child info to cdgChildHash to be processed with - # any callout and GARD requests - my $parent = $deconfigure->{childTargets}->{parent}; - my $childType = $deconfigure->{childTargets}->{childType}; - $cdgChildHash{$parent}{$childType}{deconf} = 1; - - $elementsFound++; - - if ( exists $deconfigure->{childTargets}->{childPort}) - { - my $childPort = $deconfigure->{childTargets}->{childPort}; - - $cdgChildHash{$parent}{$childType}{childPort} = $childPort; - } - - if ( exists $deconfigure->{childTargets}->{childNumber}) - { - my $childNum = $deconfigure->{childTargets}->{childNumber}; - $cdgChildHash{$parent}{$childType}{childNumber} = $childNum; - - } - } - - if ($elementsFound == 0) - { - print ("fapiParseErrorInfo.pl ERROR in $err->{rc}. Deconfigure incomplete\n"); - exit(1); - } - elsif ($elementsFound > 1) - { - print ("fapiParseErrorInfo.pl ERROR in $err->{rc}. Deconfigure has multiple elements\n"); - exit(1); - } - } # deconfigure - - # Target/Child Gards - foreach my $gard (@{$err->{gard}}) - { - my $elementsFound = 0; - if (exists $gard->{target}) - { - # Add the Target to cdgTargetHash to be processed with any - # callout and deconfigure requests - $cdgTargetHash{$gard->{target}}{gard} = 1; - $elementsFound++; - } - if (exists $gard->{childTargets}) - { - # Check that the parent and childType subelements exist - if (! exists $gard->{childTargets}->{parent}) - { - print ("fapiParseErrorInfo.pl ERROR in $err->{rc}. Child GARD parent missing\n"); - exit(1); - } - if (! exists $gard->{childTargets}->{childType}) - { - print ("fapiParseErrorInfo.pl ERROR in $err->{rc}. Child GARD childType missing\n"); - exit(1); - } - - # Add the child info to cdgChildHash to be processed with - # any callout and deconfigure requests - my $parent = $gard->{childTargets}->{parent}; - my $childType = $gard->{childTargets}->{childType}; - $cdgChildHash{$parent}{$childType}{gard} = 1; - - $elementsFound++; - - if ( exists $gard->{childTargets}->{childPort}) - { - my $childPort = $gard->{childTargets}->{childPort}; - - $cdgChildHash{$parent}{$childType}{childPort} = $childPort; - - } - - if ( exists $gard->{childTargets}->{childNumber}) - { - my $childNum = $gard->{childTargets}->{childNumber}; - $cdgChildHash{$parent}{$childType}{childNumber} = $childNum; - } - } - if ($elementsFound == 0) - { - print ("fapiParseErrorInfo.pl ERROR in $err->{rc}. GARD incomplete\n"); - exit(1); - } - elsif ($elementsFound > 1) - { - print ("fapiParseErrorInfo.pl ERROR in $err->{rc}. GARD has multiple elements\n"); - exit(1); - } - } # gard - - # Process the callout, deconfigures and GARDs for each Target - foreach my $cdg (keys %cdgTargetHash) - { - # Check the type - print EIFILE "fapi::fapiCheckType<const fapi::Target *>(&$cdg); \\\n"; - - my $callout = 0; - my $priority = 'LOW'; - my $deconf = 0; - my $gard = 0; - - if (exists $cdgTargetHash{$cdg}->{callout}) - { - $callout = 1; - } - if (exists $cdgTargetHash{$cdg}->{priority}) - { - $priority = $cdgTargetHash{$cdg}->{priority}; - } - if (exists $cdgTargetHash{$cdg}->{deconf}) - { - $deconf = 1; - } - if (exists $cdgTargetHash{$cdg}->{gard}) - { - $gard = 1; - } - - # Add the Target to the objectlist if it doesn't already exist - my $objNum = addEntryToArray(\@eiObjects, $cdg); - - # Add an EI entry to eiEntryStr - $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi::ReturnCode::EI_TYPE_CDG; \\\n"; - $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_targetObjIndex = $objNum; \\\n"; - $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_callout = $callout; \\\n"; - $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_deconfigure = $deconf; \\\n"; - $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_gard = $gard; \\\n"; - $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_calloutPriority = fapi::CalloutPriorities::$priority; \\\n"; - $eiEntryCount++; - } - - # Process the callout, deconfigures and GARDs for Child Targets - foreach my $parent (keys %cdgChildHash) - { - # Check the type - print EIFILE "fapi::fapiCheckType<const fapi::Target *>(&$parent); \\\n"; - - foreach my $childType (keys %{$cdgChildHash{$parent}}) - { - my $callout = 0; - my $priority = 'LOW'; - my $deconf = 0; - my $gard = 0; - my $childPort = 0xFF; - my $childNumber = 0xFF; - - if (exists $cdgChildHash{$parent}{$childType}->{callout}) - { - $callout = 1; - } - if (exists $cdgChildHash{$parent}->{$childType}->{priority}) - { - $priority = - $cdgChildHash{$parent}->{$childType}->{priority}; - } - if (exists $cdgChildHash{$parent}->{$childType}->{deconf}) - { - $deconf = 1; - } - if (exists $cdgChildHash{$parent}->{$childType}->{childPort}) - { - $childPort = - $cdgChildHash{$parent}->{$childType}->{childPort} ; - } - if (exists $cdgChildHash{$parent}->{$childType}->{childNumber}) - { - $childNumber = - $cdgChildHash{$parent}->{$childType}->{childNumber} ; - } - if (exists $cdgChildHash{$parent}->{$childType}->{gard}) - { - $gard = 1; - } - - - # Add the Target to the objectlist if it doesn't already exist - my $objNum = addEntryToArray(\@eiObjects, $parent); - - # Add an EI entry to eiEntryStr - $eiEntryStr .= - " l_entries[$eiEntryCount].iv_type = fapi::ReturnCode::EI_TYPE_CHILDREN_CDG; \\\n"; - $eiEntryStr .= - " l_entries[$eiEntryCount].children_cdg.iv_parentObjIndex = $objNum; \\\n"; - $eiEntryStr .= - " l_entries[$eiEntryCount].children_cdg.iv_callout = $callout; \\\n"; - $eiEntryStr .= - " l_entries[$eiEntryCount].children_cdg.iv_deconfigure = $deconf; \\\n"; - $eiEntryStr .= - " l_entries[$eiEntryCount].children_cdg.iv_childType = fapi::$childType; \\\n"; - $eiEntryStr .= - " l_entries[$eiEntryCount].children_cdg.iv_childPort = $childPort; \\\n"; - $eiEntryStr .= - " l_entries[$eiEntryCount].children_cdg.iv_childNumber = $childNumber; \\\n"; - $eiEntryStr .= - " l_entries[$eiEntryCount].children_cdg.iv_gard = $gard; \\\n"; - $eiEntryStr .= - " l_entries[$eiEntryCount].children_cdg.iv_calloutPriority = fapi::CalloutPriorities::$priority; \\\n"; - $eiEntryCount++; - } - } - - # Add all objects to $eiObjectStr - my $objCount = 0; - - foreach my $eiObject (@eiObjects) - { - if ($objCount > 0) - { - $eiObjectStr .= ", "; - } - $eiObjectStr .= "&$eiObject"; - $objCount++; - } - $eiObjectStr .= "};"; - - # Print info to file - if ($eiEntryCount > 0) - { - print EIFILE "\\\n{ \\\n $eiObjectStr \\\n"; - print EIFILE " fapi::ReturnCode::ErrorInfoEntry l_entries[$eiEntryCount]; \\\n"; - print EIFILE "$eiEntryStr"; - print EIFILE " RC.addErrorInfo(l_objects, l_entries, $eiEntryCount); \\\n}"; - } - print EIFILE "\n\n"; - } - - #-------------------------------------------------------------------------- - # For each registerFfdc. - #-------------------------------------------------------------------------- - foreach my $registerFfdc (@{$errors->{registerFfdc}}) - { - #---------------------------------------------------------------------- - # Check that expected fields are present - #---------------------------------------------------------------------- - if (! exists $registerFfdc->{id}[0]) - { - print ("fapiParseErrorInfo.pl ERROR. id missing from registerFfdc\n"); - exit(1); - } - - if (scalar @{$registerFfdc->{id}} > 1) - { - print ("fapiParseErrorInfo.pl ERROR. multiple ids in registerFfdc\n"); - exit(1); - } - - #---------------------------------------------------------------------- - # Set the FFDC ID value in a global hash - #---------------------------------------------------------------------- - setFfdcIdValue($registerFfdc->{id}[0]); - - #---------------------------------------------------------------------- - # Generate code to capture the registers in fapiCollectRegFfdc.C - #---------------------------------------------------------------------- - print CRFILE " case $registerFfdc->{id}[0]:\n"; - - # Look for CFAM Register addresses - foreach my $cfamRegister (@{$registerFfdc->{cfamRegister}}) - { - print CRFILE " l_cfamAddresses.push_back($cfamRegister);\n"; - print CRFILE " l_ffdcSize += sizeof(l_cfamData);\n"; - } - - # Look for SCOM Register addresses - foreach my $scomRegister (@{$registerFfdc->{scomRegister}}) - { - print CRFILE " l_scomAddresses.push_back($scomRegister);\n"; - print CRFILE " l_ffdcSize += sizeof(l_scomData);\n"; - } - - print CRFILE " break;\n"; - } - -} - -#------------------------------------------------------------------------------ -# Print end of file information to fapiCollectRegFfdc.C -#------------------------------------------------------------------------------ -print CRFILE " default:\n"; -print CRFILE " FAPI_ERR(\"fapiCollectRegFfdc.C: Invalid FFDC ID 0x%x\", "; -print CRFILE "i_ffdcId);\n"; -print CRFILE " return;\n"; -print CRFILE " }\n\n"; -print CRFILE " uint8_t * l_pBuf = NULL;\n"; -print CRFILE " uint8_t * l_pData = NULL;\n"; -print CRFILE " std::vector<fapi::Target> l_targets;\n"; -print CRFILE " uint32_t l_chipletPos32 = 0;\n"; -#--------------------------------------------------------------------------------------------------------- -# Populate chiplet vectors (if required by register collection method) and adjust buffer sizes accordingly -#--------------------------------------------------------------------------------------------------------- -print CRFILE " if (fapi::TARGET_TYPE_NONE != i_child)\n"; -print CRFILE " {\n"; -print CRFILE " l_rc = fapiGetChildChiplets(i_target, i_child, l_targets, TARGET_STATE_FUNCTIONAL);\n"; -print CRFILE " if (l_rc)\n"; -print CRFILE " {\n"; -print CRFILE " FAPI_ERR(\"fapiCollectRegFfdc.C: Error: fapiGetChildChiplets: failed to get chiplets.\");\n"; -print CRFILE " return;\n"; -print CRFILE " }\n"; -print CRFILE " if (l_targets.empty())\n"; -print CRFILE " {\n"; -print CRFILE " FAPI_INF(\"fapiCollectRegFfdc.C: Error: No functional chiplets found. \");\n"; -print CRFILE " return;\n"; -print CRFILE " }\n"; -print CRFILE " l_ffdcSize += sizeof(l_chipletPos32);\n"; -print CRFILE " l_ffdcSize *= l_targets.size();\n"; -print CRFILE " l_pBuf = new uint8_t[l_ffdcSize];\n"; -print CRFILE " l_pData = l_pBuf;\n"; -print CRFILE " }\n"; -print CRFILE " else if (fapi::TARGET_TYPE_NONE != i_presChild)\n"; -print CRFILE " {\n"; -print CRFILE " l_rc = fapiGetChildChiplets(i_target, i_presChild, l_targets, TARGET_STATE_PRESENT);\n"; -print CRFILE " if (l_rc)\n"; -print CRFILE " {\n"; -print CRFILE " FAPI_ERR(\"fapiCollectRegFfdc.C: Error: fapiGetChildChiplets: failed to get chiplets.\");\n"; -print CRFILE " return;\n"; -print CRFILE " }\n"; -print CRFILE " if (l_targets.empty())\n"; -print CRFILE " {\n"; -print CRFILE " FAPI_INF(\"fapiCollectRegFfdc.C: Error: No functional chiplets found. \");\n"; -print CRFILE " return;\n"; -print CRFILE " }\n"; -print CRFILE " l_ffdcSize += sizeof(l_chipletPos32);\n"; -print CRFILE " l_ffdcSize *= l_targets.size();\n"; -print CRFILE " l_pBuf = new uint8_t[l_ffdcSize];\n"; -print CRFILE " l_pData = l_pBuf;\n"; -print CRFILE " }\n"; -print CRFILE " else\n"; -print CRFILE " {\n"; -print CRFILE " l_ffdcSize += sizeof(l_chipletPos32);\n"; -print CRFILE " l_pBuf = new uint8_t[l_ffdcSize];\n"; -print CRFILE " l_pData = l_pBuf;\n"; -print CRFILE " l_targets.push_back(i_target);\n"; -print CRFILE " }\n\n"; -#--------------------------------------------------------------------------------------------------------- -# Obtain target position and insert as the first word in the buffer -#--------------------------------------------------------------------------------------------------------- -print CRFILE " bool l_targIsChiplet = i_target.isChiplet();\n\n"; -print CRFILE " for (std::vector<fapi::Target>::const_iterator targetIter = l_targets.begin();\n"; -print CRFILE " targetIter != l_targets.end(); ++targetIter)\n"; -print CRFILE " {\n"; -print CRFILE " if ((fapi::TARGET_TYPE_NONE != i_child) ||\n"; -print CRFILE " (fapi::TARGET_TYPE_NONE != i_presChild) ||\n"; -print CRFILE " (true == l_targIsChiplet))\n"; -print CRFILE " {\n"; -print CRFILE " uint8_t l_chipletPos = 0;\n"; -print CRFILE " l_rc = FAPI_ATTR_GET(ATTR_CHIP_UNIT_POS, &(*targetIter), l_chipletPos);\n"; -print CRFILE " if (l_rc)\n"; -print CRFILE " {\n"; -print CRFILE " FAPI_ERR(\"fapiCollectRegFfdc.C: Error getting chiplet position\");\n"; -print CRFILE " l_chipletPos = 0xFF;\n"; -print CRFILE " }\n"; - #------------------------------------------------------------------------- - # We print the target's position in the error log whether the target is a - # chip or chiplet, so we need to store the chiplet position in a uint32_t - # to have consitency in the buffer as ATTR_POS below returns a uint32_t - #------------------------------------------------------------------------- -print CRFILE " l_chipletPos32 = l_chipletPos;\n"; -print CRFILE " }\n"; -print CRFILE " else\n"; -print CRFILE " {\n"; -print CRFILE " l_rc = FAPI_ATTR_GET(ATTR_POS, &(*targetIter), l_chipletPos32);\n"; -print CRFILE " if (l_rc)\n"; -print CRFILE " {\n"; -print CRFILE " FAPI_ERR(\"fapiCollectRegFfdc.C: Error getting chip position\");\n"; -print CRFILE " l_chipletPos32 = 0xFFFFFFFF;\n"; -print CRFILE " }\n"; -print CRFILE " }\n"; -print CRFILE " *(reinterpret_cast<uint32_t *>(l_pData)) = l_chipletPos32;\n"; -print CRFILE " l_pData += sizeof(l_chipletPos32);\n"; -#--------------------------------------------------------------------------------------------------------- -# Instert cfam data (if any) related to this chip / chiplet into the buffer -# If collecting FFDC based on present children, adjust the register address by the appropriate offset -#--------------------------------------------------------------------------------------------------------- -print CRFILE " for (std::vector<uint32_t>::const_iterator cfamIter = l_cfamAddresses.begin();\n"; -print CRFILE " cfamIter != l_cfamAddresses.end(); ++cfamIter)\n"; -print CRFILE " {\n"; -print CRFILE " if (fapi::TARGET_TYPE_NONE != i_presChild)\n"; -print CRFILE " {\n"; -print CRFILE " l_rc = fapiGetCfamRegister(i_target, (*cfamIter + (l_chipletPos32 * i_childOffsetMult)), l_buf);\n"; -print CRFILE " }\n"; -print CRFILE " else\n"; -print CRFILE " {\n"; -print CRFILE " l_rc = fapiGetCfamRegister(*targetIter, *cfamIter, l_buf);\n"; -print CRFILE " }\n"; -print CRFILE " if (l_rc)\n"; -print CRFILE " {\n"; -print CRFILE " FAPI_ERR(\"fapiCollectRegFfdc.C: CFAM error for 0x%x\","; -print CRFILE "*cfamIter);\n"; -print CRFILE " l_cfamData = 0xbaddbadd;\n"; -print CRFILE " }\n"; -print CRFILE " else\n"; -print CRFILE " {\n"; -print CRFILE " l_cfamData = l_buf.getWord(0);\n"; -print CRFILE " }\n"; -print CRFILE " *(reinterpret_cast<uint32_t *>(l_pData)) = l_cfamData;\n"; -print CRFILE " l_pData += sizeof(l_cfamData);\n"; -print CRFILE " }\n\n"; -#--------------------------------------------------------------------------------------------------------- -# Instert any scom data (if any) related to this chip / chiplet into the buffer -# If collecting FFDC based on present children, adjust the register address by the appropriate offset -#--------------------------------------------------------------------------------------------------------- -print CRFILE " for (std::vector<uint64_t>::const_iterator scomIter = l_scomAddresses.begin();\n"; -print CRFILE " scomIter != l_scomAddresses.end(); ++scomIter)\n"; -print CRFILE " {\n"; -print CRFILE " if (fapi::TARGET_TYPE_NONE != i_presChild)\n"; -print CRFILE " {\n"; -print CRFILE " l_rc = fapiGetScom(i_target, (*scomIter + (l_chipletPos32 * i_childOffsetMult)), l_buf);\n"; -print CRFILE " }\n"; -print CRFILE " else\n"; -print CRFILE " {\n"; -print CRFILE " l_rc = fapiGetScom(*targetIter, *scomIter, l_buf);\n"; -print CRFILE " }\n"; -print CRFILE " if (l_rc)\n"; -print CRFILE " {\n"; -print CRFILE " FAPI_ERR(\"fapiCollectRegFfdc.C: SCOM error for 0x%llx\","; -print CRFILE "*scomIter);\n"; -print CRFILE " l_scomData = 0xbaddbaddbaddbaddULL;\n"; -print CRFILE " }\n"; -print CRFILE " else\n"; -print CRFILE " {\n"; -print CRFILE " l_scomData = l_buf.getDoubleWord(0);\n"; -print CRFILE " }\n"; -print CRFILE " *(reinterpret_cast<uint64_t *>(l_pData)) = l_scomData;\n"; -print CRFILE " l_pData += sizeof(l_scomData);\n"; -print CRFILE " }\n"; -print CRFILE " }\n\n"; -print CRFILE " o_rc.addEIFfdc(i_ffdcId, l_pBuf, l_ffdcSize);\n"; -print CRFILE " delete [] l_pBuf;\n"; -print CRFILE "}\n"; -print CRFILE "}\n"; - -#------------------------------------------------------------------------------ -# Print the fapiHwpReturnCodes.H file -#------------------------------------------------------------------------------ -print RCFILE "// fapiHwpReturnCodes.H\n"; -print RCFILE "// This file is generated by perl script fapiParseErrorInfo.pl\n\n"; -print RCFILE "#ifndef FAPIHWPRETURNCODES_H_\n"; -print RCFILE "#define FAPIHWPRETURNCODES_H_\n\n"; -print RCFILE "#ifndef __ASSEMBLER__\n"; -print RCFILE "namespace fapi\n"; -print RCFILE "{\n\n"; -print RCFILE "/**\n"; -print RCFILE " * \@brief Enumeration of HWP return codes\n"; -print RCFILE " *\/\n"; -print RCFILE "enum HwpReturnCode\n"; -print RCFILE "{\n"; -foreach my $key (keys %errNameToValueHash) -{ - print RCFILE " $key = 0x$errNameToValueHash{$key},\n"; -} -print RCFILE "};\n\n"; -print RCFILE "}\n\n"; -print RCFILE "#else\n"; -foreach my $key (keys %errNameToValueHash) -{ - print RCFILE " .set $key, 0x$errNameToValueHash{$key}\n"; -} -print RCFILE "#endif\n"; -print RCFILE "#endif\n"; - -#------------------------------------------------------------------------------ -# Print the HwpFfdcId enumeration to fapiHwpErrorInfo.H -#------------------------------------------------------------------------------ -print EIFILE "namespace fapi\n"; -print EIFILE "{\n\n"; -print EIFILE "/**\n"; -print EIFILE " * \@brief Enumeration of FFDC identifiers\n"; -print EIFILE " *\/\n"; -print EIFILE "enum HwpFfdcId\n"; -print EIFILE "{\n"; -foreach my $key (keys %ffdcNameToValueHash) -{ - print EIFILE " $key = 0x$ffdcNameToValueHash{$key},\n"; -} -print EIFILE "};\n\n"; -print EIFILE "}\n\n"; - -#------------------------------------------------------------------------------ -# Print end of file information to fapiHwpErrorInfo.H -#------------------------------------------------------------------------------ -print EIFILE "\n\n#endif\n"; - -#------------------------------------------------------------------------------ -# Print end of file information to fapiSetSbeError.H -#------------------------------------------------------------------------------ -print SBFILE " default:\\\n"; -print SBFILE " FAPI_SET_HWP_ERROR(RC, RC_SBE_UNKNOWN_ERROR);\\\n"; -print SBFILE " break;\\\n"; -print SBFILE "}\\\n"; -print SBFILE "}\n\n"; -print SBFILE "#endif\n"; - -#------------------------------------------------------------------------------ -# Close output files -#------------------------------------------------------------------------------ -close(RCFILE); -close(EIFILE); -close(CRFILE); -close(SBFILE); diff --git a/src/usr/hwpf/fapi/fapiReturnCode.C b/src/usr/hwpf/fapi/fapiReturnCode.C deleted file mode 100644 index a969e785e..000000000 --- a/src/usr/hwpf/fapi/fapiReturnCode.C +++ /dev/null @@ -1,632 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/fapi/fapiReturnCode.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -// $Id: fapiReturnCode.C,v 1.22 2015/01/16 11:31:38 sangeet2 Exp $ -// $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/hwpf/working/fapi/fapiReturnCode.C,v $ - -/** - * @file fapiReturnCode.C - * - * @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 - * mjjones 07/25/2011 Added support for FFDC and - * Error Target - * camvanng 09/06/2011 Clear Plat Data, Hwp FFDC data, - * and Error Target if - * FAPI_RC_SUCCESS is assigned to - * ReturnCode - * mjjones 09/22/2011 Added ErrorInfo Support - * mjjones 01/12/2012 Enforce correct usage - * mjjones 02/22/2012 Allow user to add Target FFDC - * mjjones 03/16/2012 Add type to FFDC data - * mjjones 03/16/2012 Allow different PLAT errors - * mjjones 04/20/2012 Remove deprecated int assign - * mjjones 05/02/2012 Only trace setEcmdError on err - * mjjones 07/11/2012 Remove a trace - * brianh 07/31/2012 performance/size optimizations - * mjjones 08/14/2012 Use new ErrorInfo structure - * mjjones 09/19/2012 Add FFDC ID to error info - * mjjones 03/22/2013 Support Procedure Callouts - * mjjones 05/20/2013 Support Bus Callouts - * mjjones 06/24/2013 Support Children CDGs - * mjjones 08/26/2013 Support HW Callouts - * whs 03/11/2014 Add FW traces to error logs - * whs 07/23/2014 Reduce traces - * sangeet2 01/16/2015 Support "position" attribute - * for osc callout - */ - -#include <fapiReturnCode.H> -#include <fapiReturnCodeDataRef.H> -#include <fapiPlatTrace.H> -#include <fapiTarget.H> -#include <fapiUtil.H> -#include <fapiErrorInfo.H> - -namespace fapi -{ - -//****************************************************************************** -// Constructor -//****************************************************************************** -ReturnCode::ReturnCode(const ReturnCodes i_rcValue) : - iv_rcValue(i_rcValue), iv_pDataRef(NULL) -{ - if (i_rcValue != FAPI_RC_SUCCESS) - { - FAPI_ERR("ctor: Creating error 0x%x", i_rcValue); - } -} - -//****************************************************************************** -// Copy Constructor -//****************************************************************************** -ReturnCode::ReturnCode(const ReturnCode & i_right) : - iv_rcValue(i_right.iv_rcValue), iv_pDataRef(i_right.iv_pDataRef) -{ - // Note shallow copy of data ref pointer. Both ReturnCodes now point to any - // associated data. If there is data, increment the data ref count - if (iv_pDataRef) - { - iv_pDataRef->incRefCount(); - } -} - -//****************************************************************************** -// Destructor -//****************************************************************************** -ReturnCode::~ReturnCode() -{ - // Forget about any associated data - forgetData(); -} - -//****************************************************************************** -// Assignment Operator -//****************************************************************************** -ReturnCode & ReturnCode::operator=(const ReturnCode & i_right) -{ - // Test for self assignment - if (this != &i_right) - { - // Forget about any associated data - forgetData(); - - // Note shallow copy of data ref pointer. Both ReturnCodes now point to - // any associated data. If there is data, increment the data ref count - iv_rcValue = i_right.iv_rcValue; - iv_pDataRef = i_right.iv_pDataRef; - - if (iv_pDataRef) - { - iv_pDataRef->incRefCount(); - } - } - - return *this; -} - -//****************************************************************************** -// setFapiError function -//****************************************************************************** -void ReturnCode::setFapiError(const ReturnCodes i_rcValue) -{ - FAPI_ERR("setFapiError: Creating FAPI error 0x%x", i_rcValue); - iv_rcValue = i_rcValue; - - // Forget about any associated data (this is a new error) - forgetData(); - - // Errors generated by FAPI code are a small set, all are firmware issues - addEIProcedureCallout(ProcedureCallouts::CODE, CalloutPriorities::HIGH); -} - -//****************************************************************************** -// setEcmdError function -//****************************************************************************** -void ReturnCode::setEcmdError(const uint32_t i_rcValue) -{ - // Some HWPs perform an ecmdDataBaseBufferBase operation, then call this - // function then check if the ReturnCode indicates an error. Therefore only - // trace an error if there actually is an error - if (i_rcValue != 0) - { - FAPI_ERR("setEcmdError: Creating ECMD error 0x%x", i_rcValue); - } - iv_rcValue = i_rcValue; - - // Forget about any associated data (this is a new error) - forgetData(); - - // Callout firmware - addEIProcedureCallout(ProcedureCallouts::CODE, CalloutPriorities::HIGH); -} - -//****************************************************************************** -// setPlatError function -//****************************************************************************** -void ReturnCode::setPlatError(void * i_pData, - const ReturnCodes i_rcValue) -{ - FAPI_ERR("setPlatError: Creating PLAT error 0x%x", i_rcValue); - iv_rcValue = i_rcValue; - - // Forget about any associated data (this is a new error) - forgetData(); - - if (i_pData) - { - getCreateReturnCodeDataRef().setPlatData(i_pData); - } -} - -//****************************************************************************** -// _setHwpError function -//****************************************************************************** -void ReturnCode::_setHwpError(const HwpReturnCode i_rcValue) -{ - FAPI_ERR("_setHwpError: Creating HWP error 0x%x", i_rcValue); - iv_rcValue = i_rcValue; - - // Forget about any associated data (this is a new error) - forgetData(); -} - -//****************************************************************************** -// getPlatData function -//****************************************************************************** -void * ReturnCode::getPlatData() const -{ - void * l_pData = NULL; - - if (iv_pDataRef) - { - l_pData = iv_pDataRef->getPlatData(); - } - - return l_pData; -} - -//****************************************************************************** -// releasePlatData function -//****************************************************************************** -void * ReturnCode::releasePlatData() -{ - void * l_pData = NULL; - - if (iv_pDataRef) - { - l_pData = iv_pDataRef->releasePlatData(); - } - - return l_pData; -} - -//****************************************************************************** -// addErrorInfo function -//****************************************************************************** -void ReturnCode::addErrorInfo(const void * const * i_pObjects, - const ErrorInfoEntry * i_pEntries, - const uint8_t i_count) -{ - for (uint32_t i = 0; i < i_count; i++) - { - ErrorInfoType l_type = static_cast<ErrorInfoType>( - i_pEntries[i].iv_type); - - if (l_type == EI_TYPE_FFDC) - { - uint8_t l_objIndex = i_pEntries[i].ffdc.iv_ffdcObjIndex; - uint16_t l_size = i_pEntries[i].ffdc.iv_ffdcSize; - uint32_t l_ffdcId = i_pEntries[i].ffdc.iv_ffdcId; - - // Get the object to add as FFDC - const void * l_pObject = i_pObjects[l_objIndex]; - - if (l_size == ReturnCodeFfdc::EI_FFDC_SIZE_ECMDDB) - { - // The FFDC is a ecmdDataBufferBase - const ecmdDataBufferBase * l_pDb = - static_cast<const ecmdDataBufferBase *>(l_pObject); - - size_t byteLength = l_pDb->getWordLength() * sizeof(uint32_t); - uint32_t * l_pData = - reinterpret_cast<uint32_t*>(fapiMalloc(byteLength)); - - // getWordLength rounds up to the next 32bit boundary, ensure - // that after extracting, any unset bits are zero - l_pData[l_pDb->getWordLength() - 1] = 0; - - // Deliberately not checking return code from extract - l_pDb->extract(l_pData, 0, l_pDb->getBitLength()); - addEIFfdc(l_ffdcId, l_pData, (l_pDb->getWordLength() * 4)); - - fapiFree(l_pData); - } - else if (l_size == ReturnCodeFfdc::EI_FFDC_SIZE_TARGET) - { - // The FFDC is a fapi::Target - const fapi::Target * l_pTarget = - static_cast<const fapi::Target *>(l_pObject); - - const char * l_ecmdString = l_pTarget->toEcmdString(); - addEIFfdc(l_ffdcId, l_ecmdString, (strlen(l_ecmdString) + 1)); - } - else - { - // This is a regular FFDC data object that can be directly - // memcopied - addEIFfdc(l_ffdcId, l_pObject, l_size); - } - } - else if (l_type == EI_TYPE_HW_CALLOUT) - { - HwCallouts::HwCallout l_hw = static_cast<HwCallouts::HwCallout>( - i_pEntries[i].hw_callout.iv_hw); - CalloutPriorities::CalloutPriority l_pri = - static_cast<CalloutPriorities::CalloutPriority>( - i_pEntries[i].hw_callout.iv_calloutPriority); - - // A l_posIndex of 0xff indicates that it is not a clock callout - uint8_t l_posIndex = i_pEntries[i].hw_callout.iv_objPosIndex; - - // A refIndex of 0xff indicates that there is no reference target - uint8_t l_refIndex = i_pEntries[i].hw_callout.iv_refObjIndex; - - if (l_refIndex != 0xff) - { - const Target * l_pRefTarget = static_cast<const Target *>( - i_pObjects[l_refIndex]); - FAPI_DBG("addErrorInfo: Adding hw callout with ref, hw:" - " %d, pri: %d", - l_hw, l_pri); - - if (l_posIndex != 0xff) - { - const targetPos_t * l_posObj = - static_cast<const targetPos_t *>(i_pObjects[l_posIndex]); - - addEIHwCallout(l_hw, l_pri, *l_pRefTarget, *l_posObj); - } - else - { - addEIHwCallout(l_hw, l_pri, *l_pRefTarget); - } - } - else - { - Target l_emptyTarget; - FAPI_DBG("addErrorInfo: Adding hw callout with no ref, hw:" - " %d, pri: %d", - l_hw, l_pri); - - if (l_posIndex != 0xff) - { - const targetPos_t * l_posObj = - static_cast<const targetPos_t *>(i_pObjects[l_posIndex]); - addEIHwCallout(l_hw, l_pri, l_emptyTarget, *l_posObj); - } - else - { - addEIHwCallout(l_hw, l_pri, l_emptyTarget); - } - } - } - else if (l_type == EI_TYPE_PROCEDURE_CALLOUT) - { - ProcedureCallouts::ProcedureCallout l_proc = - static_cast<ProcedureCallouts::ProcedureCallout>( - i_pEntries[i].proc_callout.iv_procedure); - CalloutPriorities::CalloutPriority l_pri = - static_cast<CalloutPriorities::CalloutPriority>( - i_pEntries[i].proc_callout.iv_calloutPriority); - - // Add the ErrorInfo - FAPI_DBG("addErrorInfo: Adding proc callout, proc: %d, pri: %d", - l_proc, l_pri); - addEIProcedureCallout(l_proc, l_pri); - } - else if (l_type == EI_TYPE_BUS_CALLOUT) - { - uint8_t l_ep1Index = i_pEntries[i].bus_callout.iv_endpoint1ObjIndex; - uint8_t l_ep2Index = i_pEntries[i].bus_callout.iv_endpoint2ObjIndex; - CalloutPriorities::CalloutPriority l_pri = - static_cast<CalloutPriorities::CalloutPriority>( - i_pEntries[i].bus_callout.iv_calloutPriority); - - // Get the endpoint Targets for the bus to callout - const Target * l_pTarget1 = static_cast<const Target *>( - i_pObjects[l_ep1Index]); - const Target * l_pTarget2 = static_cast<const Target *>( - i_pObjects[l_ep2Index]); - - // Add Procedure ErrorInfo section first - ProcedureCallouts::ProcedureCallout l_proc = - ProcedureCallouts::BUS_CALLOUT; - FAPI_DBG("addErrorInfo: Bus Callout: Adding procedure " - "proc: %d, pri: %d", - l_proc, l_pri); - addEIProcedureCallout(l_proc, l_pri); - - // Update priority for bus callout (with targets): - // use priority 1 level down of initial callout priority - if (l_pri == CalloutPriorities::HIGH) - { - l_pri = CalloutPriorities::MEDIUM; - } - else - { - // Medium or low, so set to low - l_pri = CalloutPriorities::LOW; - } - - // Add the Bus Callout ErrorInfo section next with updated priority - FAPI_DBG("addErrorInfo: Adding bus callout, pri: %d", l_pri); - addEIBusCallout(*l_pTarget1, *l_pTarget2, l_pri); - } - else if (l_type == EI_TYPE_CDG) - { - uint8_t l_targIndex = i_pEntries[i].target_cdg.iv_targetObjIndex; - uint8_t l_callout = i_pEntries[i].target_cdg.iv_callout; - uint8_t l_deconf = i_pEntries[i].target_cdg.iv_deconfigure; - uint8_t l_gard = i_pEntries[i].target_cdg.iv_gard; - CalloutPriorities::CalloutPriority l_pri = - static_cast<CalloutPriorities::CalloutPriority>( - i_pEntries[i].target_cdg.iv_calloutPriority); - - // Get the Target to cdg - const Target * l_pTarget = static_cast<const Target *>( - i_pObjects[l_targIndex]); - - // Add the ErrorInfo - FAPI_DBG("addErrorInfo: Adding target cdg (%d:%d:%d), pri: %d", - l_callout, l_deconf, l_gard, l_pri); - addEICdg(*l_pTarget, l_callout, l_deconf, l_gard, l_pri); - } - else if (l_type == EI_TYPE_CHILDREN_CDG) - { - uint8_t l_parentIndex = - i_pEntries[i].children_cdg.iv_parentObjIndex; - TargetType l_childType = static_cast<TargetType>( - i_pEntries[i].children_cdg.iv_childType); - uint8_t l_callout = i_pEntries[i].children_cdg.iv_callout; - uint8_t l_deconf = i_pEntries[i].children_cdg.iv_deconfigure; - uint8_t l_gard = i_pEntries[i].children_cdg.iv_gard; - uint8_t l_childPort = i_pEntries[i].children_cdg.iv_childPort; - uint8_t l_childNumber = - i_pEntries[i].children_cdg.iv_childNumber; - CalloutPriorities::CalloutPriority l_pri = - static_cast<CalloutPriorities::CalloutPriority>( - i_pEntries[i].children_cdg.iv_calloutPriority); - - // Get the Parent Target of the children to cdg - const Target * l_pParent = static_cast<const Target *>( - i_pObjects[l_parentIndex]); - - // Add the ErrorInfo - FAPI_DBG("addErrorInfo: Adding children cdg (%d:%d:%d), type:" - " 0x%08x, pri: %d", - l_callout, l_deconf, l_gard, l_childType, l_pri); - addEIChildrenCdg(*l_pParent, l_childType, l_callout, l_deconf, - l_gard, l_pri, l_childPort, l_childNumber ); - } - else if (l_type == EI_TYPE_COLLECT_TRACE) - { - CollectTraces::CollectTrace l_traceId = - static_cast<CollectTraces::CollectTrace> - (i_pEntries[i].collect_trace.iv_eieTraceId); - addEICollectTrace(l_traceId); - } - else - { - FAPI_ERR("addErrorInfo: Unrecognized EI type: %d", l_type); - } - } -} - -//****************************************************************************** -// addEIFfdc function -//****************************************************************************** -void ReturnCode::addEIFfdc(const uint32_t i_ffdcId, - const void * i_pFfdc, - const uint32_t i_size) -{ - // Create a ErrorInfoFfdc object and add it to the Error Information - ErrorInfoFfdc * l_pFfdc = new ErrorInfoFfdc(i_ffdcId, i_pFfdc, i_size); - getCreateReturnCodeDataRef().getCreateErrorInfo(). - iv_ffdcs.push_back(l_pFfdc); - - // Note: This gets deallocated in ~ErrorInfo() -} - - -//****************************************************************************** -// getErrorInfo function -//****************************************************************************** -const ErrorInfo * ReturnCode::getErrorInfo() const -{ - ErrorInfo * l_pErrorInfo = NULL; - - if (iv_pDataRef != NULL) - { - l_pErrorInfo = iv_pDataRef->getErrorInfo(); - } - - return l_pErrorInfo; -} - -//****************************************************************************** -// getCreator function -//****************************************************************************** -ReturnCode::returnCodeCreator ReturnCode::getCreator() const -{ - returnCodeCreator l_creator = CREATOR_HWP; - - if ((iv_rcValue & FAPI_RC_FAPI_MASK) || (iv_rcValue & FAPI_RC_ECMD_MASK)) - { - l_creator = CREATOR_FAPI; - } - else if (iv_rcValue & FAPI_RC_PLAT_MASK) - { - l_creator = CREATOR_PLAT; - } - - return l_creator; -} - -//****************************************************************************** -// getCreateReturnCodeDataRef function -//****************************************************************************** -ReturnCodeDataRef & ReturnCode::getCreateReturnCodeDataRef() -{ - if (iv_pDataRef == NULL) - { - iv_pDataRef = new ReturnCodeDataRef(); - } - - return *iv_pDataRef; -} - -//****************************************************************************** -// forgetData function -//****************************************************************************** -void ReturnCode::forgetData() -{ - if (iv_pDataRef) - { - // Decrement the refcount - if (iv_pDataRef->decRefCountCheckZero()) - { - // Refcount decremented to zero. No other ReturnCode points to the - // ReturnCodeDataRef object, delete it - delete iv_pDataRef; - } - iv_pDataRef = NULL; - } -} - -//****************************************************************************** -// addEIHwCallout function -//****************************************************************************** -void ReturnCode::addEIHwCallout( - const HwCallouts::HwCallout i_hw, - const CalloutPriorities::CalloutPriority i_priority, - const Target & i_refTarget, - const targetPos_t i_position) -{ - // Create an ErrorInfoHwCallout object and add it to the Error Information - ErrorInfoHwCallout * l_pCallout = new ErrorInfoHwCallout( - i_hw, i_priority, i_refTarget, i_position); - getCreateReturnCodeDataRef().getCreateErrorInfo(). - iv_hwCallouts.push_back(l_pCallout); -} - -//****************************************************************************** -// addEIProcedureCallout function -//****************************************************************************** -void ReturnCode::addEIProcedureCallout( - const ProcedureCallouts::ProcedureCallout i_procedure, - const CalloutPriorities::CalloutPriority i_priority) -{ - // Create an ErrorInfoProcedureCallout object and add it to the Error - // Information - ErrorInfoProcedureCallout * l_pCallout = new ErrorInfoProcedureCallout( - i_procedure, i_priority); - getCreateReturnCodeDataRef().getCreateErrorInfo(). - iv_procedureCallouts.push_back(l_pCallout); -} - -//****************************************************************************** -// addEIBusCallout function -//****************************************************************************** -void ReturnCode::addEIBusCallout( - const Target & i_target1, - const Target & i_target2, - const CalloutPriorities::CalloutPriority i_priority) -{ - // Create an ErrorInfoBusCallout object and add it to the Error Information - ErrorInfoBusCallout * l_pCallout = new ErrorInfoBusCallout( - i_target1, i_target2, i_priority); - getCreateReturnCodeDataRef().getCreateErrorInfo(). - iv_busCallouts.push_back(l_pCallout); -} - -//****************************************************************************** -// addEICdg function -//****************************************************************************** -void ReturnCode::addEICdg( - const Target & i_target, - const bool i_callout, - const bool i_deconfigure, - const bool i_gard, - const CalloutPriorities::CalloutPriority i_priority) -{ - // Create an ErrorInfoCDG object and add it to the Error Information - ErrorInfoCDG * l_pCdg = new ErrorInfoCDG(i_target, i_callout, i_deconfigure, - i_gard, i_priority); - getCreateReturnCodeDataRef().getCreateErrorInfo(). - iv_CDGs.push_back(l_pCdg); -} - -//****************************************************************************** -// addEIChildrenCdg function -//****************************************************************************** -void ReturnCode::addEIChildrenCdg( - const Target & i_parent, - const TargetType i_childType, - const bool i_callout, - const bool i_deconfigure, - const bool i_gard, - const CalloutPriorities::CalloutPriority i_priority, - const uint8_t i_childPort, - const uint8_t i_childNum) -{ - // Create an ErrorInfoChildrenCDG object and add it to the Error Information - ErrorInfoChildrenCDG * l_pCdg = new ErrorInfoChildrenCDG(i_parent, - i_childType, i_callout, i_deconfigure, i_gard, i_priority, - i_childPort, i_childNum); - getCreateReturnCodeDataRef().getCreateErrorInfo(). - iv_childrenCDGs.push_back(l_pCdg); -} - -//****************************************************************************** -// addEICollectTrace function -//****************************************************************************** -void ReturnCode::addEICollectTrace( - const CollectTraces::CollectTrace i_traceId) -{ - // Create an ErrorInfoCollectTrace object and add it to Error Information - ErrorInfoCollectTrace * l_pCT = new ErrorInfoCollectTrace(i_traceId); - getCreateReturnCodeDataRef().getCreateErrorInfo(). - iv_traces.push_back(l_pCT); -} - -} diff --git a/src/usr/hwpf/fapi/fapiReturnCodeDataRef.C b/src/usr/hwpf/fapi/fapiReturnCodeDataRef.C deleted file mode 100644 index 026a4ca09..000000000 --- a/src/usr/hwpf/fapi/fapiReturnCodeDataRef.C +++ /dev/null @@ -1,180 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/fapi/fapiReturnCodeDataRef.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -// $Id: fapiReturnCodeDataRef.C,v 1.8 2013/10/15 13:13:37 dcrowell Exp $ -// $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/hwpf/working/fapi/fapiReturnCodeDataRef.C,v $ - -/** - * @file fapiReturnCodeDataRef.C - * - * @brief Implements the FAPI part of the ReturnCodeDataRef class. - */ - -/* - * Change Log ****************************************************************** - * Flag Defect/Feature User Date Description - * ------ -------------- ---------- ----------- ---------------------------- - * 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 - * mjjones 07/25/2011 Added support for FFDC - * mjjones 09/22/2011 Added support for Error Info - * mjjones 07/11/2012 Removed some tracing - */ - -#include <string.h> -#include <fapiReturnCodeDataRef.H> -#include <fapiUtil.H> -#include <fapiPlatTrace.H> - -namespace fapi -{ - -//****************************************************************************** -// Constructor -//****************************************************************************** -ReturnCodeDataRef::ReturnCodeDataRef() -: iv_refCount(1), - iv_pPlatData(NULL), - iv_pErrorInfo(NULL) -{ - -} - -//****************************************************************************** -// Destructor -//****************************************************************************** -ReturnCodeDataRef::~ReturnCodeDataRef() -{ - if (iv_refCount != 0) - { - FAPI_ERR("ReturnCodeDataRef. Bug. Destruct with refcount: %d", - iv_refCount); - fapiAssert(false); - } - - deletePlatData(); - delete iv_pErrorInfo; - iv_pErrorInfo = NULL; -} - -//****************************************************************************** -// incRefCount function -//****************************************************************************** -void ReturnCodeDataRef::incRefCount() -{ - iv_refCount++; -} - -//****************************************************************************** -// decRefCountCheckZero function -//****************************************************************************** -bool ReturnCodeDataRef::decRefCountCheckZero() -{ - if (iv_refCount == 0) - { - FAPI_ERR("ReturnCodeDataRef. Bug. Dec with zero refcount"); - fapiAssert(false); - } - else - { - iv_refCount--; - } - return (iv_refCount == 0); -} - -//****************************************************************************** -// setPlatData function -//****************************************************************************** -void ReturnCodeDataRef::setPlatData(void * i_pPlatData) -{ - // Delete any current PlatData - if (iv_pPlatData) - { - FAPI_ERR("ReturnCodeDataRef. setPlatData when existing data"); - deletePlatData(); - } - - iv_pPlatData = i_pPlatData; -} - -//****************************************************************************** -// getPlatData function -//****************************************************************************** -void * ReturnCodeDataRef::getPlatData() const -{ - return iv_pPlatData; -} - -//****************************************************************************** -// releasePlatData function -//****************************************************************************** -void * ReturnCodeDataRef::releasePlatData() -{ - void * l_pPlatData = iv_pPlatData; - iv_pPlatData = NULL; - return l_pPlatData; -} - -//****************************************************************************** -// getErrorInfo function -//****************************************************************************** -ErrorInfo * ReturnCodeDataRef::getErrorInfo() -{ - return iv_pErrorInfo; -} - -//****************************************************************************** -// getCreateErrorInfo function -//****************************************************************************** -ErrorInfo & ReturnCodeDataRef::getCreateErrorInfo() -{ - if (iv_pErrorInfo == NULL) - { - iv_pErrorInfo = new ErrorInfo(); - } - - return *iv_pErrorInfo; -} - -//****************************************************************************** -// Overload Operator new function -//****************************************************************************** -#ifdef FAPI_CUSTOM_MALLOC -void * ReturnCodeDataRef::operator new(size_t i_sz) -{ - return fapiMalloc(i_sz); -} -#endif - -//****************************************************************************** -// Overload Operator delete function -//****************************************************************************** -#ifdef FAPI_CUSTOM_MALLOC -void ReturnCodeDataRef::operator delete(void * i_ptr) -{ - fapiFree(i_ptr); -} -#endif - -} diff --git a/src/usr/hwpf/fapi/fapiTarget.C b/src/usr/hwpf/fapi/fapiTarget.C deleted file mode 100644 index bd948a063..000000000 --- a/src/usr/hwpf/fapi/fapiTarget.C +++ /dev/null @@ -1,191 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/fapi/fapiTarget.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -// $Id: fapiTarget.C,v 1.10 2014/02/26 14:51:07 mjjones Exp $ -// $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/hwpf/working/fapi/fapiTarget.C,v $ - -/** - * @file fapiTarget.C - * - * @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 - * mjjones 09/12/2011 Added isChip and isChiplet - * mjjones 02/07/2012 Remove MBS_CHIPLET - * Add XBUS_ENDPOINT ABUS_ENDPOINT - * mjjones 02/21/2012 Add high performance toEcmdString - * mjjones 07/11/2012 Clear iv_pEcmdString on set - * mjjones 02/24/2014 Add isChip/Chiplet using types - * Add isPhysParentChild - */ - -#include <fapiTarget.H> -#include <fapiUtil.H> - -namespace fapi -{ - -//****************************************************************************** -// Default Constructor -//****************************************************************************** -Target::Target() : - iv_type(TARGET_TYPE_NONE), iv_pHandle(NULL), iv_pEcmdString(NULL) -{ - -} - -//****************************************************************************** -// Constructor. -//****************************************************************************** -Target::Target(const TargetType i_type, - void * i_pHandle) : - iv_type(i_type), iv_pHandle(i_pHandle), iv_pEcmdString(NULL) -{ - -} - -//****************************************************************************** -// Copy Constructor -//****************************************************************************** -Target::Target(const Target & i_right) : - iv_type(i_right.iv_type), iv_pEcmdString(NULL) -{ - (void) copyHandle(i_right); -} - -//****************************************************************************** -// Destructor -//****************************************************************************** -Target::~Target() -{ - (void) deleteHandle(); - fapiFree(iv_pEcmdString); -} - -//****************************************************************************** -// Assignment Operator -//****************************************************************************** -Target & Target::operator=(const Target & i_right) -{ - // Test for self assignment - if (this != &i_right) - { - iv_type = i_right.iv_type; - (void) copyHandle(i_right); - fapiFree(iv_pEcmdString); - iv_pEcmdString = NULL; - } - return *this; -} - -//****************************************************************************** -// Equality Comparison Operator -//****************************************************************************** -bool Target::operator==(const Target & i_right) const -{ - bool l_equal = false; - - if (iv_type == i_right.iv_type) - { - l_equal = compareHandle(i_right); - } - - return l_equal; -} - -//****************************************************************************** -// Inequality Comparison Operator -//****************************************************************************** -bool Target::operator!=(const Target & i_right) const -{ - // Determine inequality by calling the equality comparison operator - return (!(*this == i_right)); -} - -//****************************************************************************** -// Set the handle. -//****************************************************************************** -void Target::set(void * i_pHandle) -{ - iv_pHandle = i_pHandle; - fapiFree(iv_pEcmdString); - iv_pEcmdString = NULL; -} - -//****************************************************************************** -// Is a target type a chip? -//****************************************************************************** -bool Target::isChip(const TargetType i_type) -{ - return ((i_type & (TARGET_TYPE_PROC_CHIP | TARGET_TYPE_MEMBUF_CHIP)) != 0); -} - -//****************************************************************************** -// Is a target type a chiplet? -//****************************************************************************** -bool Target::isChiplet(const TargetType i_type) -{ - return ((i_type & (TARGET_TYPE_EX_CHIPLET | - TARGET_TYPE_MBA_CHIPLET | - TARGET_TYPE_MCS_CHIPLET | - TARGET_TYPE_XBUS_ENDPOINT | - TARGET_TYPE_ABUS_ENDPOINT | - TARGET_TYPE_L4 )) != 0); -} - -//****************************************************************************** -// Is a target type pair a physical parent/child? -//****************************************************************************** -bool Target::isPhysParentChild(const TargetType i_parentType, - const TargetType i_childType) -{ - bool l_result = false; - - if (i_parentType == TARGET_TYPE_PROC_CHIP) - { - if ((i_childType == TARGET_TYPE_EX_CHIPLET) || - (i_childType == TARGET_TYPE_MCS_CHIPLET) || - (i_childType == TARGET_TYPE_XBUS_ENDPOINT) || - (i_childType == TARGET_TYPE_ABUS_ENDPOINT)) - { - l_result = true; - } - } - else if (i_parentType == TARGET_TYPE_MEMBUF_CHIP) - { - if ((i_childType == TARGET_TYPE_MBA_CHIPLET) || - (i_childType == TARGET_TYPE_L4)) - { - l_result = true; - } - } - - return l_result; -} - -} diff --git a/src/usr/hwpf/fapi/makefile b/src/usr/hwpf/fapi/makefile deleted file mode 100644 index c94398448..000000000 --- a/src/usr/hwpf/fapi/makefile +++ /dev/null @@ -1,32 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/hwpf/fapi/makefile $ -# -# OpenPOWER HostBoot Project -# -# COPYRIGHT International Business Machines Corp. 2011,2014 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. See the License for the specific language governing -# permissions and limitations under the License. -# -# IBM_PROLOG_END_TAG -ROOTPATH = ../../../.. -MODULE = fapi - -SUBDIRS += runtime.d - -include fapi.mk - -include ${ROOTPATH}/config.mk - -vpath %.C ${GENDIR} diff --git a/src/usr/hwpf/fapi/runtime/makefile b/src/usr/hwpf/fapi/runtime/makefile deleted file mode 100644 index b4e2b470b..000000000 --- a/src/usr/hwpf/fapi/runtime/makefile +++ /dev/null @@ -1,32 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/hwpf/fapi/runtime/makefile $ -# -# OpenPOWER HostBoot Project -# -# COPYRIGHT International Business Machines Corp. 2011,2014 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. See the License for the specific language governing -# permissions and limitations under the License. -# -# IBM_PROLOG_END_TAG -ROOTPATH = ../../../../.. -MODULE = fapi_rt -VPATH += ../ -HOSTBOOT_RUNTIME = 1 - -include ../fapi.mk - -include ${ROOTPATH}/config.mk - -vpath %.C ${GENDIR} |