summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/fapi
diff options
context:
space:
mode:
authorMike Jones <mjjones@us.ibm.com>2013-12-09 20:47:15 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2014-01-09 13:33:38 -0600
commit0b5aa2c2e4a56c2ab9546a1a80bef847802c7dbd (patch)
tree6670b08f7d608bcf3f36d689a61fe1bd14d079e1 /src/usr/hwpf/fapi
parent0396febcd4fe2abbf110f063731ff5171917e81a (diff)
downloadtalos-hostboot-0b5aa2c2e4a56c2ab9546a1a80bef847802c7dbd.tar.gz
talos-hostboot-0b5aa2c2e4a56c2ab9546a1a80bef847802c7dbd.zip
Support ATTR_PROC_EX_FUNC_L3_DELTA_DATA properly
Instead of zero data, an Attribute Accessor HWP should return real data supplied by the HW team. Change-Id: I53c3ecd01bd30475b2ab861af0cb0ad422521782 CQ: SW235093 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/7639 Tested-by: Jenkins Server Reviewed-by: Brian H. Horton <brianh@linux.ibm.com> Reviewed-by: William H. Schwartz <whs@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/fapi')
-rwxr-xr-xsrc/usr/hwpf/fapi/fapiCreateL3DeltaVals.pl260
1 files changed, 260 insertions, 0 deletions
diff --git a/src/usr/hwpf/fapi/fapiCreateL3DeltaVals.pl b/src/usr/hwpf/fapi/fapiCreateL3DeltaVals.pl
new file mode 100755
index 000000000..4dca6f971
--- /dev/null
+++ b/src/usr/hwpf/fapi/fapiCreateL3DeltaVals.pl
@@ -0,0 +1,260 @@
+#!/usr/bin/perl -w
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/hwpf/fapi/fapiCreateL3DeltaVals.pl $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2013
+#
+# p1
+#
+# Object Code Only (OCO) source materials
+# Licensed Internal Code Source Materials
+# IBM HostBoot Licensed Internal Code
+#
+# The source code for this program is not published or otherwise
+# divested of its trade secrets, irrespective of what has been
+# deposited with the U.S. Copyright Office.
+#
+# Origin: 30
+#
+# IBM_PROLOG_END_TAG
+
+# $Id: fapiCreateL3DeltaVals.pl,v 1.2 2013/12/13 14:42:47 mjjones 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
+#
+#
+# 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_CHIPTYPE;\n";
+print OUTFILE " uint8_t l_ATTR_EC;\n";
+print OUTFILE " uint32_t l_ATTR_L3_DELTA_DATA [3][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 = "";
+
+# 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";
+ 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)")
+ {
+ my $selectVal = $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";
+ }
+ 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";
+ }
+ # If first set of data values
+ if ($selectVal == 0)
+ {
+ print OUTFILE " $chipEnum, \t// CHIP TYPE \n";
+ print OUTFILE " 0x$ec, \t// EC LEVEL \n";
+ print OUTFILE " {\n";
+ }
+ print OUTFILE " { \t// ATTR_PROC_PBIEX_ASYNC_SEL = $1\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 }, // ATTR_PROC_EX_FUNC_L3_DELTA_DATA \n";
+ $dataArrayString = "";
+ }
+ }
+ }
+ }
+
+ # Close array
+ print OUTFILE " }, \n\n";
+
+ close (FILE);
+ print OUTFILE "},\n";
+
+}
+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);
+ }
+ }
+}
OpenPOWER on IntegriCloud