summaryrefslogtreecommitdiffstats
path: root/tools/scripts
diff options
context:
space:
mode:
authorGreg Still <stillgs@us.ibm.com>2015-06-01 18:25:33 -0500
committerDerk Rembold <rembold@de.ibm.com>2015-06-15 11:31:13 -0500
commit73e896d5293c9826824a97f4bd7400f6c48bf6e5 (patch)
tree740643b6504f4d8a6d5c94f1d0615c42a09eb1fa /tools/scripts
parent94489f26e87189928e8ba3bae05419ac6f0771cb (diff)
downloadtalos-sbe-73e896d5293c9826824a97f4bd7400f6c48bf6e5.tar.gz
talos-sbe-73e896d5293c9826824a97f4bd7400f6c48bf6e5.zip
Added attribute tools, XML and sources to complete build
Change-Id: I59a34c889523572f2cad697598951425f68f879a
Diffstat (limited to 'tools/scripts')
-rw-r--r--tools/scripts/core_attributes.xml37
-rw-r--r--tools/scripts/eq_attributes.xml14
-rw-r--r--tools/scripts/ex_attributes.xml64
-rw-r--r--tools/scripts/p9_ppe_attributes.xml83
-rw-r--r--tools/scripts/p9_ppe_attributes1.xml83
-rw-r--r--tools/scripts/perv_attributes.xml44
-rwxr-xr-xtools/scripts/ppeCreateAttrGetSetMacros.pl533
-rwxr-xr-xtools/scripts/ppeCreateIfAttrService.pl217
-rw-r--r--tools/scripts/ppeParseAttrGetSetMacros.pl260
-rwxr-xr-xtools/scripts/ppeParseAttributeInfo.pl1054
-rwxr-xr-xtools/scripts/ppeParseProcSbeFixed.pl253
-rw-r--r--tools/scripts/ppe_attributes.xml109
-rw-r--r--tools/scripts/proc_attributes.xml151
-rw-r--r--tools/scripts/src/fapi2PlatAttributeService.H1061
14 files changed, 3963 insertions, 0 deletions
diff --git a/tools/scripts/core_attributes.xml b/tools/scripts/core_attributes.xml
new file mode 100644
index 00000000..8855ffa8
--- /dev/null
+++ b/tools/scripts/core_attributes.xml
@@ -0,0 +1,37 @@
+<!-- $Id: proc_pll_ring_attributes.xml,v 1.17 2014/11/13 20:14:02 szhong Exp $ -->
+<!-- proc_pll_ring_attributes.xml -->
+<attributes>
+ <attribute>
+ <id>ATTR_CORE_REPR_RING</id>
+ <targetType>TARGET_TYPE_CORE</targetType>
+ <description>
+ </description>
+ <valueType>uint32</valueType>
+ <platInit/>
+ <writeable/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_CORE_TIME_RING</id>
+ <targetType>TARGET_TYPE_CORE</targetType>
+ <description>
+ </description>
+ <valueType>uint32</valueType>
+ <platInit/>
+ <writeable/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_CORE_GPTR_RING</id>
+ <targetType>TARGET_TYPE_CORE</targetType>
+ <description>
+ </description>
+ <valueType>uint32</valueType>
+ <platInit/>
+ <writeable/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+</attributes>
diff --git a/tools/scripts/eq_attributes.xml b/tools/scripts/eq_attributes.xml
new file mode 100644
index 00000000..36c0c03a
--- /dev/null
+++ b/tools/scripts/eq_attributes.xml
@@ -0,0 +1,14 @@
+<!-- $Id: proc_pll_ring_attributes.xml,v 1.17 2014/11/13 20:14:02 szhong Exp $ -->
+<!-- proc_pll_ring_attributes.xml -->
+<attributes>
+ <attribute>
+ <id>ATTR_DPLL_RING</id>
+ <targetType>TARGET_TYPE_EQ</targetType>
+ <description>
+ </description>
+ <valueType>uint32</valueType>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+</attributes>
diff --git a/tools/scripts/ex_attributes.xml b/tools/scripts/ex_attributes.xml
new file mode 100644
index 00000000..98dbfefc
--- /dev/null
+++ b/tools/scripts/ex_attributes.xml
@@ -0,0 +1,64 @@
+<!-- $Id: proc_pll_ring_attributes.xml,v 1.17 2014/11/13 20:14:02 szhong Exp $ -->
+<!-- proc_pll_ring_attributes.xml -->
+<attributes>
+ <attribute>
+ <id>ATTR_L2_REPR_RING</id>
+ <targetType>TARGET_TYPE_EX</targetType>
+ <description>
+ </description>
+ <valueType>uint32</valueType>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_L2_TIME_RING</id>
+ <targetType>TARGET_TYPE_EX</targetType>
+ <description>
+ </description>
+ <valueType>uint32</valueType>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_L2_GPTR_RING</id>
+ <targetType>TARGET_TYPE_EX</targetType>
+ <description>
+ </description>
+ <valueType>uint32</valueType>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_L3_REPR_RING</id>
+ <targetType>TARGET_TYPE_EX</targetType>
+ <description>
+ </description>
+ <valueType>uint32</valueType>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_L3_TIME_RING</id>
+ <targetType>TARGET_TYPE_EX</targetType>
+ <description>
+ </description>
+ <valueType>uint32</valueType>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_L3_GPTR_RING</id>
+ <targetType>TARGET_TYPE_EX</targetType>
+ <description>
+ </description>
+ <valueType>uint32</valueType>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+</attributes>
diff --git a/tools/scripts/p9_ppe_attributes.xml b/tools/scripts/p9_ppe_attributes.xml
new file mode 100644
index 00000000..b119dc26
--- /dev/null
+++ b/tools/scripts/p9_ppe_attributes.xml
@@ -0,0 +1,83 @@
+<!-- $Id: p9_ppe_attributes.xml,v 1.11 2013/11/07 21:51:13 rembold Exp $ -->
+<!-- p9_ppe_attributes.xml -->
+<entries>
+ <!-- ********************************************************************* -->
+ <entry>
+ <name>ATTR_SCRATCH_UINT8_1</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_UINT8_2</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_UINT32_1</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_UINT32_2</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_UINT64_1</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_UINT64_2</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_INT8_1</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_INT8_2</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_INT32_1</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_INT32_2</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_INT64_1</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_INT64_2</name>
+ </entry>
+ <entry>
+ <name>ATTR_REPR_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_TIME_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_GPTR_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_PLL_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_CORE_REPR_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_CORE_TIME_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_CORE_GPTR_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_L2_REPR_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_L2_TIME_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_L2_GPTR_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_L3_REPR_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_L3_TIME_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_L3_GPTR_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_DPLL_RING</name>
+ </entry>
+</entries>
diff --git a/tools/scripts/p9_ppe_attributes1.xml b/tools/scripts/p9_ppe_attributes1.xml
new file mode 100644
index 00000000..b119dc26
--- /dev/null
+++ b/tools/scripts/p9_ppe_attributes1.xml
@@ -0,0 +1,83 @@
+<!-- $Id: p9_ppe_attributes.xml,v 1.11 2013/11/07 21:51:13 rembold Exp $ -->
+<!-- p9_ppe_attributes.xml -->
+<entries>
+ <!-- ********************************************************************* -->
+ <entry>
+ <name>ATTR_SCRATCH_UINT8_1</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_UINT8_2</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_UINT32_1</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_UINT32_2</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_UINT64_1</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_UINT64_2</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_INT8_1</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_INT8_2</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_INT32_1</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_INT32_2</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_INT64_1</name>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_INT64_2</name>
+ </entry>
+ <entry>
+ <name>ATTR_REPR_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_TIME_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_GPTR_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_PLL_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_CORE_REPR_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_CORE_TIME_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_CORE_GPTR_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_L2_REPR_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_L2_TIME_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_L2_GPTR_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_L3_REPR_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_L3_TIME_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_L3_GPTR_RING</name>
+ </entry>
+ <entry>
+ <name>ATTR_DPLL_RING</name>
+ </entry>
+</entries>
diff --git a/tools/scripts/perv_attributes.xml b/tools/scripts/perv_attributes.xml
new file mode 100644
index 00000000..50c0f835
--- /dev/null
+++ b/tools/scripts/perv_attributes.xml
@@ -0,0 +1,44 @@
+<!-- $Id: proc_pll_ring_attributes.xml,v 1.17 2014/11/13 20:14:02 szhong Exp $ -->
+<!-- proc_pll_ring_attributes.xml -->
+<attributes>
+ <attribute>
+ <id>ATTR_REPR_RING</id>
+ <targetType>TARGET_TYPE_PERV</targetType>
+ <description>
+ </description>
+ <valueType>uint32</valueType>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_TIME_RING</id>
+ <targetType>TARGET_TYPE_PERV</targetType>
+ <description>
+ </description>
+ <valueType>uint32</valueType>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_GPTR_RING</id>
+ <targetType>TARGET_TYPE_PERV</targetType>
+ <description>
+ </description>
+ <valueType>uint32</valueType>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_PLL_RING</id>
+ <targetType>TARGET_TYPE_PERV</targetType>
+ <description>
+ </description>
+ <valueType>uint32</valueType>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+</attributes>
diff --git a/tools/scripts/ppeCreateAttrGetSetMacros.pl b/tools/scripts/ppeCreateAttrGetSetMacros.pl
new file mode 100755
index 00000000..74eeb03e
--- /dev/null
+++ b/tools/scripts/ppeCreateAttrGetSetMacros.pl
@@ -0,0 +1,533 @@
+#!/usr/bin/perl -w
+#find enums in AttributeId
+#for each enum check for ${enum}_Type
+#check for type and array values
+#Check Plat file for ${enum}_GETMACRO and ${enum}_SETMACRO
+#If they do not exist add apporpriate _SETMACRO and _GETMACRO to Plat file
+
+use strict;
+use File::Copy;
+use Getopt::Long;
+
+sub enumParser ($);
+sub help;
+
+my $DEBUG = 0;
+my $VERBOSE = 0;
+
+my $state = 0;
+my $last_value = -1;
+my $current_entry;
+my $current_enum_name;
+
+my %enums;
+
+my %attributeTypes;
+my %attributeArrayTypes;
+
+my %getMacros;
+my %setMacros;
+my %targetMacros;
+
+
+
+my $fapiAttributeIdsFile = "fapi2AttributeIds.H";
+my $fapiPlatAttributeServiceFile= "fapi2PlatAttributeService.H";
+my $fapiPlatAttributeServiceImpl= "fapi2PlatAttributeService.C";
+
+
+my $includePath = "./";
+my $srcPath = "./";
+
+my @newAttributeDefines;
+my @newTargetDefines;
+my @newTargetImplementations;
+
+
+my $servicePath;
+my $help;
+
+GetOptions ("verbose" => \$VERBOSE,
+ "help" => \$help,
+ "debug" => \$DEBUG,
+ "path=s" => \$servicePath,
+ "inc=s" => \$includePath,
+ "src=s" => \$srcPath,
+);
+
+help() if $help;
+
+open (FILE, $includePath . "/" . $fapiAttributeIdsFile) or die "ERROR:: could not open $fapiAttributeIdsFile\n";
+
+while (<FILE>) {
+ # attempt to parse attributes from current line in file
+ enumParser($_);
+
+ # see if the line describes an attribute
+ if (m/\s*typedef\s+(\w+)\s+(\w+)_Type(\S*)\s*;/) {
+ my $type = $1;
+ my $attribute = $2;
+ my $arrayType = $3;
+
+ if ($DEBUG) { print "DEBUG:: type = $type : attribute = $attribute : arrayType = $arrayType\n"; }
+
+ # save attribute type and if it is an array and its size
+ $attributeTypes{$attribute} = $type;
+ if ($arrayType) {
+ $attributeArrayTypes{$attribute} = $arrayType;
+ } else {
+ $attributeArrayTypes{$attribute} = "none";
+ }
+ }
+
+ # look for MACROs
+ # look for: #define ATTR_CHIP_HAS_SBE_GETMACRO ATTRIBUTE_NOT_WRITABLE
+ if (m/\s*#define\s+(\w+)_GETMACRO\s+(\S+)\s*/) {
+ $getMacros{$1} = $2;
+ if ($DEBUG) { print "DEBUG:: attribute = $1 : GETMACRO = $2\n"; }
+ # look for: #define ATTR_CHIP_EC_FEATURE_TEST1_GETMACRO(ID, PTARGET, VAL) fapi::fapiQueryChipEcFeature(ID, PTARGET, VAL)
+ } elsif (m/\s*#define\s+(\w+)_GETMACRO\(ID\,\sPTARGET\,\sVAL\)\s(.+)/) {
+ $getMacros{$1} = $2;
+ if ($DEBUG) { print "DEBUG:: attribute = $1 : GETMACRO = $2\n"; }
+ # look for: #define ATTR_CHIP_HAS_SBE_SETMACRO ATTRIBUTE_NOT_WRITABLE
+ } elsif (m/\s*#define\s+(\w+)_SETMACRO\s+(\S+)\s*/) {
+ $setMacros{$1} = $2;
+ if ($DEBUG) { print "DEBUG:: attribute = $1 : SETMACRO = $2\n"; }
+ # look for: #define ATTR_CHIP_EC_FEATURE_TEST2_SETMACRO(ID, PTARGET, VAL) CHIP_EC_FEATURE_ATTRIBUTE_NOT_WRITABLE
+ } elsif (m/\s*#define\s+(\w+)_SETMACRO\(ID\,\sPTARGET\,\sVAL\)\s(.+)/) {
+ $setMacros{$1} = $2;
+ if ($DEBUG) { print "DEBUG:: attribute = $1 : SETMACRO = $2\n"; }
+ } elsif (m/\s*const\s*TargetTypes_t\s+(\w+)_TargetTypes\s*=\s*(\S+)\s*;\s*/) {
+ $targetMacros{$1} = $2;
+# print "DEBUG:: attribute = $1 : TARGET = $2\n";
+ if ($DEBUG) { print "DEBUG:: attribute = $1 : TARGET = $2\n"; }
+ }
+}
+
+close (FILE);
+
+#find copy of fapiPlatAttributeService.H
+if (!$servicePath) {
+ #$CTEPATH/tools/ecmd/$ECMD_RELEASE/ext/fapi/capi
+ my $ctepath = $ENV{CTEPATH};
+ my $ecmd_release = $ENV{ECMD_RELEASE};
+ if ($DEBUG) { print "DEBUG:: ctepath = $ctepath\n"; }
+ if ($DEBUG) { print "DEBUG:: ecmd_release = $ecmd_release\n"; }
+ if (!$ctepath) {
+ print "ERROR:: environment variable CTEPATH not defined!\n";
+ exit 1;
+ }
+ if (!$ecmd_release) {
+ print "ERROR:: environment variable ECMD_RELEASE not defined!\n";
+ exit 1;
+ }
+ $servicePath = "$ctepath/tools/ecmd/$ecmd_release/ext/fapi/capi";
+}
+
+if ($DEBUG) { print "DEBUG:: servicePath = $servicePath\n"; }
+
+# test that servicePath exists
+if (!-d $servicePath) {
+ print "ERROR:: path $servicePath does not exist!\n";
+ exit 1;
+}
+
+# test that fapiPlatAttributeService.H is in that directory
+if (!-f "$servicePath/$fapiPlatAttributeServiceFile") {
+ print "ERROR:: $fapiPlatAttributeServiceFile does not exist in $servicePath\n";
+ exit 1;
+}
+
+# copy fapiPlatAttributeService.H to local dir
+#my $systemRc = system("cp $servicePath/$fapiPlatAttributeServiceFile $includePath");
+copy("$servicePath/$fapiPlatAttributeServiceFile","$includePath") or die "Copy failed: $!";
+
+#if ($systemRc) {
+# print "ERROR:: error copying $fapiPlatAttributeServiceFile from $servicePath\n";
+# exit 1;
+#}
+
+
+
+# look in fapiPlatAttributeService.H for MACROs
+open (FILE, $includePath . "/". $fapiPlatAttributeServiceFile) or die "ERROR:: could not open $fapiPlatAttributeServiceFile\n";
+while (<FILE>) {
+ if (m/\s*#define\s+(\w+)_GETMACRO\s+(\S+)\s*/) {
+ $getMacros{$1} = $2;
+ if ($DEBUG) { print "DEBUG:: attribute = $1 : GETMACRO = $2\n"; }
+ } elsif (m/\s*#define\s+(\w+)_SETMACRO\s+(\S+)\s*/) {
+ $setMacros{$1} = $2;
+ if ($DEBUG) { print "DEBUG:: attribute = $1 : SETMACRO = $2\n"; }
+ } elsif (m/\s*const\s*TargetTypes_t\s+(\w+)_TargetTypes\s*=\s*(\S+)\s*;\s*/) {
+ $targetMacros{$1} = $2;
+ if ($DEBUG) { print "DEBUG:: attribute = $1 : TARGET = $2\n"; }
+ }
+}
+close (FILE);
+
+# go through attributes found in file
+for my $attribute (sort keys %{$enums{AttributeId}}) {
+ if ($DEBUG) { print "DEBUG:: attribute = $attribute\n"; }
+ my $type;
+ my $arrayType;
+ my $dimension = 0;
+
+ # check that each attribute has attributeType
+ if ($attributeTypes{$attribute}) {
+ if ($attributeArrayTypes{$attribute}) {
+ $type = $attributeTypes{$attribute};
+ $arrayType = $attributeArrayTypes{$attribute};
+ } else {
+ print "ERROR:: arrayType not found for $attribute\n";
+ next;
+ }
+ } else {
+ print "ERROR:: type not found for $attribute\n";
+ next;
+ }
+
+ # determine if attribute is an array
+ if ($arrayType =~ m/none/) {
+ if ($DEBUG) { print "DEBUG:: $attribute = $type\n"; }
+ } else {
+ # find dimension for array
+ my $tempArrayType = $arrayType;
+ while ($tempArrayType =~ m/\[\d*\].*/) {
+ $dimension++;
+ $tempArrayType =~ s/\[\d*\]//;
+ }
+ if ($DEBUG) { print "DEBUG:: $attribute = $type$arrayType dimension = $dimension\n"; }
+ }
+
+ my $setMacro = $setMacros{$attribute};
+ my $getMacro = $getMacros{$attribute};
+ my $targetMacro = $targetMacros{$attribute};
+
+# print "$attribute $setMacro $getMacro $targetMacro \n";
+
+ # if an attribute is missing the SET or GET MACRO add to list in insert into file later
+ if (!($getMacro && $setMacro)) {
+ my $macroPrefix = "PLAT_ATTR_";
+ my $macroPostfix = "";
+
+ if ($dimension == 0) {
+ $macroPostfix = "_GLOBAL_INT";
+ } else {
+ if ($type =~ m/uint8_t/) {
+ $macroPostfix = "_UINT8_" . $dimension . "D_ARRAY";
+ } elsif ($type =~ m/uint32_t/) {
+ $macroPostfix = "_UINT32_" . $dimension . "D_ARRAY";
+ } elsif ($type =~ m/uint64_t/) {
+ $macroPostfix = "_UINT64_" . $dimension . "D_ARRAY";
+ } elsif ($type =~ m/int8_t/) {
+ $macroPostfix = "_INT8_" . $dimension . "D_ARRAY";
+ } elsif ($type =~ m/int32_t/) {
+ $macroPostfix = "_INT32_" . $dimension . "D_ARRAY";
+ } elsif ($type =~ m/int64_t/) {
+ $macroPostfix = "_INT64_" . $dimension . "D_ARRAY";
+ } else {
+ print "ERROR:: unknown type $type for attribute $attribute\n";
+ next;
+ }
+ }
+
+ my $macroTarget = "";
+ if(defined $targetMacro) {
+ if($targetMacro eq "TARGET_TYPE_PROC_CHIP") {
+ $macroTarget = "ProcChipAttributes_t";
+ } elsif ($targetMacro eq "TARGET_TYPE_CORE") {
+ $macroTarget = "CoreAttributes_t";
+ } elsif ($targetMacro eq "TARGET_TYPE_EX") {
+ $macroTarget = "EXAttributes_t";
+ } elsif ($targetMacro eq "TARGET_TYPE_EQ") {
+ $macroTarget = "EQAttributes_t";
+ } elsif ($targetMacro eq "TARGET_TYPE_PERV") {
+ $macroTarget = "PervAttributes_t";
+ } else {
+ print "ERROR:: unknown type $targetMacro for attribute $attribute\n";
+ next;
+ }
+ }
+
+ if (!$getMacro) {
+ if ($VERBOSE) { print "INFO:: did not find ${attribute}_GETMACRO\n"; }
+ my $attributeDefine = "#define ${attribute}_GETMACRO ${macroPrefix}GET${macroPostfix}";
+ push(@newAttributeDefines, $attributeDefine);
+
+ if(defined $targetMacro) {
+
+
+ my $targetFunction = "template<> void __get<fapi2::$targetMacro, fapi2attr::$macroTarget, $type, fapi2::${attribute}> ( const fapi2::Target<fapi2::$targetMacro>* i_ptarget, fapi2attr::$macroTarget* object, const fapi2::AttributeId attrid, $type *value )";
+ push(@newTargetDefines, $targetFunction . ";");
+
+ my $targetImplementation = "";
+ if($targetMacro eq "TARGET_TYPE_PROC_CHIP") {
+
+ $targetImplementation .= "\n" . $targetFunction . "\n{\n *value = object->fapi2attr::${macroTarget}::${attribute};\n}\n";
+
+ } else {
+
+ $targetImplementation .= "\n" . $targetFunction . "\n{\n uint32_t index = (i_ptarget)->getTargetNumber();\n *value = object->fapi2attr::${macroTarget}::${attribute}[index];\n}\n";
+
+ }
+ push(@newTargetImplementations, $targetImplementation);
+ }
+ }
+ if (!$setMacro) {
+ if ($VERBOSE) { print "INFO:: did not find ${attribute}_SETMACRO\n"; }
+ my $attributeDefine = "#define ${attribute}_SETMACRO ${macroPrefix}SET${macroPostfix}";
+ push(@newAttributeDefines, $attributeDefine);
+
+ if(defined $targetMacro) {
+
+ my $targetFunction = "template<> void __set<fapi2::$targetMacro, fapi2attr::$macroTarget, $type, fapi2::${attribute}> ( const fapi2::Target<fapi2::$targetMacro>* i_ptarget, fapi2attr::$macroTarget* object, const fapi2::AttributeId attrid, $type* value )";
+ push(@newTargetDefines, $targetFunction . ";");
+
+ my $targetImplementation = "";
+
+ if($targetMacro eq "TARGET_TYPE_PROC_CHIP") {
+
+ $targetImplementation = "\n" . $targetFunction . "\n{\n object->fapi2attr::${macroTarget}::${attribute} = *value;\n}\n";
+ } else {
+ $targetImplementation = "\n" . $targetFunction . "\n{\n uint32_t index = (i_ptarget)->getTargetNumber();\n object->fapi2attr::${macroTarget}::${attribute}[index] = *value;\n}\n";
+ }
+
+ push(@newTargetImplementations, $targetImplementation);
+ }
+ }
+ }
+}
+
+# if file is missing any GET or SET MACROs
+if (@newAttributeDefines != 0) {
+
+ my $updatedFapiPlatAttributeServiceFile = "$fapiPlatAttributeServiceFile.temp";
+ open (OUTFILE, ">$updatedFapiPlatAttributeServiceFile") or die "ERROR:: could not open $updatedFapiPlatAttributeServiceFile\n";
+ open (FILE, $includePath . "/" . $fapiPlatAttributeServiceFile) or die "ERROR:: could not open $fapiPlatAttributeServiceFile\n";
+
+ my $insertTagFound = 0;
+
+ while (<FILE>) {
+ print OUTFILE $_;
+ # search for tag to insert after
+ if (m/\/\*.*INSERT NEW ATTRIBUTES HERE.*\*\//) {
+ $insertTagFound = 1;
+ # insert missing GET or SET MACROs
+ print OUTFILE "\n";
+ foreach my $attributeDefine (@newAttributeDefines) {
+ print OUTFILE "$attributeDefine\n";
+ if ($VERBOSE) { print "INFO:: adding $attributeDefine\n"; }
+ }
+ }
+
+ if (m/\/\*.*INSERT NEW GETTER AND SETTER FUNCTIONS HERE.*\*\//) {
+
+ $insertTagFound = 1;
+ # insert missing GET or SET MACROs
+ print OUTFILE "\n";
+ foreach my $targetDefine (@newTargetDefines) {
+ print OUTFILE "$targetDefine\n";
+ if ($VERBOSE) { print "INFO:: adding getter setter method\n"; }
+ }
+ }
+
+
+ }
+ close (FILE);
+ close (OUTFILE);
+
+ if ($insertTagFound == 0) {
+ # remove file that we did not update
+ system("rm $updatedFapiPlatAttributeServiceFile");
+ print ("WARNING:: did not find tag \"INSERT NEW ATTRIBUTES HERE\" in $fapiPlatAttributeServiceFile. no updates performed.\n");
+ } else {
+ # copy new file over the old one
+ system("mv $updatedFapiPlatAttributeServiceFile $includePath/$fapiPlatAttributeServiceFile");
+ }
+
+
+ my $updatedFapiPlatAttributeServiceImpl = $srcPath . "/" . $fapiPlatAttributeServiceImpl;
+ open (OUTFILE, ">$updatedFapiPlatAttributeServiceImpl") or die "ERROR:: could not open $updatedFapiPlatAttributeServiceImpl\n";
+
+ print OUTFILE "// $fapiPlatAttributeServiceImpl\n";
+ print OUTFILE "// This file is generated by perl script ppeCreateAttrGetSetMacros.pl\n\n";
+
+ print OUTFILE "#include <fapi2.H>\n";
+ print OUTFILE "#include <fapi2PlatAttributeService.H>\n";
+ print OUTFILE "#include \"proc_sbe_fixed.H\"\n";
+ print OUTFILE "#include \"plat_target_parms.H\"\n\n";
+ print OUTFILE "namespace fapi2 {\n";
+
+
+ foreach my $impl (@newTargetImplementations) {
+
+ print OUTFILE $impl;
+
+ }
+
+ print OUTFILE "\n} // namespace fapi2\n";
+
+
+ close (OUTFILE);
+}
+
+
+
+
+exit;
+
+# enumParser state machine
+# "enum" "enum_name" "{" "entry" "}"
+# [0] ------> [1] -------------> [2] ---> [3] -----------> [4] -------------------------------------> [7]
+# "," "=" "value" "}"
+# [3] <----------- [4] ----> [5] --------> [6] -------------> [7]
+# "}" ";"
+# [3] -----------------------------------------------------> [7] ---> [0]
+# ","
+#
+# [3] <----------------------------------- [6]
+#
+
+sub enumParser ($){
+ my $line = $_[0];
+ chomp($line);
+
+ if ($DEBUG) { print "DEBUG:: state = $state : line = \"$line\"\n"; }
+
+ if ($state == 0) {
+ # find enum as first word
+ if ($line =~ m/\s*enum\s*.*/) {
+ if ($DEBUG) { print "DEBUG:: found enum in $line\n"; }
+ $state = 1;
+ # reset last_value
+ $last_value = -1;
+ # reset current_entry
+ $current_entry = "";
+ # reset current_enum_name;
+ $current_enum_name = "";
+ # remove enum from line recheck
+ $line =~ s/\s*enum\s*//;
+ enumParser($line);
+ }
+ } elsif ($state == 1) {
+ # find ENUM_NAME as first word
+ if ($line =~ m/\s*(\w+)\s*.*/) {
+ if ($DEBUG) { print "DEBUG:: found ENUM_NAME $1 in $line\n"; }
+ $state = 2;
+ my $enum_name = $1;
+ $current_enum_name = $enum_name;
+ # remove ENUM_NAME from line
+ $line =~ s/\s*$enum_name\s*//;
+ #recheck
+ enumParser($line);
+ }
+ } elsif ($state == 2) {
+ # find { as first word
+ if ($line =~ m/\s*{\s*.*/) {
+ if ($DEBUG) { print "DEBUG:: found { in $line\n"; }
+ $state = 3;
+ # remove { from line recheck
+ $line =~ s/\s*{\s*//;
+ enumParser($line);
+ }
+ } elsif ($state == 3) {
+ # find ENTRY as first word
+ if ($line =~ m/\s*(\w+)\s*.*/) {
+ if ($DEBUG) { print "DEBUG:: found ENTRY $1 in $line\n"; }
+ my $entry = $1;
+ $current_entry = $entry;
+ # remove ENTRY from line
+ $line =~ s/\s*$entry\s*//;
+ $state = 4;
+ #recheck
+ enumParser($line);
+ }
+ # find } as first word
+ elsif ($line =~ m/\s*}\s*.*/) {
+ if ($DEBUG) { print "DEBUG:: found } in $line\n"; }
+ $state = 7;
+ # remove } from line recheck
+ $line =~ s/\s*}\s*//;
+ enumParser($line);
+ }
+ } elsif ($state == 4) {
+ # find = as first word
+ if ($line =~ m/\s*=\s*.*/) {
+ if ($DEBUG) { print "DEBUG:: found = in $line\n"; }
+ $state = 5;
+ # remove = from line recheck
+ $line =~ s/\s*=\s*//;
+ enumParser($line);
+ }
+ # find , as first word
+ elsif ($line =~ m/\s*,\s*.*/) {
+ if ($DEBUG) { print "DEBUG:: found , in $line\n"; }
+ $state = 3;
+ # assign next last_value to entry
+ $last_value++;
+ my $value = $last_value;
+ if ($DEBUG) { print "DEBUG:: default VALUE $value assigned to $current_entry\n"; }
+ $enums{$current_enum_name}{$current_entry} = $value;
+ # remove , from line recheck
+ $line =~ s/\s*,\s*//;
+ enumParser($line);
+ }
+ # find } as first word
+ elsif ($line =~ m/\s*}\s*.*/) {
+ if ($DEBUG) { print "DEBUG:: found } in $line\n"; }
+ $state = 7;
+ # remove } from line recheck
+ $line =~ s/\s*}\s*//;
+ enumParser($line);
+ }
+ } elsif ($state == 5) {
+ # find VALUE as first word
+ if ($line =~ m/\s*(\w+)\s*.*/) {
+ if ($DEBUG) { print "DEBUG:: found VALUE $1 in $line\n"; }
+ my $value = $1;
+ $last_value = $value;
+ # assign value to entry
+ if ($DEBUG) { print "DEBUG:: VALUE $value assigned to $current_entry\n"; }
+ $enums{$current_enum_name}{$current_entry} = $value;
+ # remove VALUE from line
+ $line =~ s/\s*$value\s*//;
+ $state = 6;
+ #recheck
+ enumParser($line);
+ }
+ } elsif ($state == 6) {
+ # find , as first word
+ if ($line =~ m/\s*,\s*.*/) {
+ if ($DEBUG) { print "DEBUG:: found , in $line\n"; }
+ $state = 3;
+ # remove , from line recheck
+ $line =~ s/\s*,\s*//;
+ enumParser($line);
+ }
+ # find } as first word
+ elsif ($line =~ m/\s*}\s*.*/) {
+ if ($DEBUG) { print "DEBUG:: found } in $line\n"; }
+ $state = 7;
+ # remove } from line recheck
+ $line =~ s/\s*}\s*//;
+ enumParser($line);
+ }
+ } elsif ($state == 7) {
+ # find ; as first word
+ if ($line =~ m/\s*;\s*.*/) {
+ if ($DEBUG) { print "DEBUG:: found ; in $line\n"; }
+ $state = 0;
+ # remove ; from line recheck
+ $line =~ s/\s*;\s*//;
+ enumParser($line);
+ }
+ }
+}
+
+sub help {
+ printf("Usage: ppeCreateAttrGetSetMacros.pl [--path <pathToFapiHeaders>] [--verbose] [--help] [--src <pathToFapiTemplate>] [--inc <pathToFapiOutput]\n");
+ printf("-path <pathToFapiHeaders> Option to enable specifying alternate path to fapi headers\n");
+ printf("-v | -verbose Inform user of findings and changes\n");
+ printf("-h | -help print this message\n");
+ exit(0);
+}
diff --git a/tools/scripts/ppeCreateIfAttrService.pl b/tools/scripts/ppeCreateIfAttrService.pl
new file mode 100755
index 00000000..70895597
--- /dev/null
+++ b/tools/scripts/ppeCreateIfAttrService.pl
@@ -0,0 +1,217 @@
+#!/usr/bin/perl
+# Purpose: This perl script will parse HWP Attribute XML files and
+# initfile attr files and create the fapiGetInitFileAttr() function
+# in a file called fapi2AttributeService.C
+
+use strict;
+
+#------------------------------------------------------------------------------
+# Print Command Line Help
+#------------------------------------------------------------------------------
+my $numArgs = $#ARGV + 1;
+if ($numArgs < 3)
+{
+ print ("Usage: fapi2CreateIfAttrService.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 .= "fapi2AttributeService.C";
+open(ASFILE, ">", $asFile);
+
+#------------------------------------------------------------------------------
+# Print Start of file information to fapiAttributeService.C
+#------------------------------------------------------------------------------
+print ASFILE "// fapi2AttributeService.C\n";
+print ASFILE "// This file is generated by perl script fapi2CreateIfAttrService.pl\n\n";
+print ASFILE "#include <fapi2AttributeService.H>\n";
+print ASFILE "//#include <fapi2ChipEcFeature.H>\n";
+print ASFILE "//#include <fapi2PlatTrace.H>\n\n";
+print ASFILE "namespace fapi2\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
+#------------------------------------------------------------------------------
+my $argfile = $ARGV[1];
+my $entries = $xml->XMLin($argfile, ForceArray => ['entry']);
+foreach my $entr (@{$entries->{entry}}) {
+
+ my $inname = $entr->{name};
+
+ # 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
+
+ foreach my $argnum (2 .. $#ARGV)
+ {
+ my $infile = $ARGV[$argnum];
+
+ 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}})
+ {
+
+
+
+ if($attr->{id} eq $inname) {
+
+ #------------------------------------------------------------------
+ # Check that the AttributeId exists
+ #------------------------------------------------------------------
+ if (! exists $attr->{id})
+ {
+ print ("fapiParseAttributeInfo.pl ERROR. Att 'id' missing\n");
+ exit(1);
+ }
+
+
+ #------------------------------------------------------------------
+ # 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/tools/scripts/ppeParseAttrGetSetMacros.pl b/tools/scripts/ppeParseAttrGetSetMacros.pl
new file mode 100644
index 00000000..6968e2c2
--- /dev/null
+++ b/tools/scripts/ppeParseAttrGetSetMacros.pl
@@ -0,0 +1,260 @@
+#!/usr/bin/perl
+# 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
+
+use strict;
+
+#------------------------------------------------------------------------------
+# Print Command Line Help
+#------------------------------------------------------------------------------
+my $numArgs = $#ARGV + 1;
+if ($numArgs < 3)
+{
+ print ("Usage: ppeParseAttrGetSetMacros.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 $chipFile = $ARGV[0];
+$chipFile .= "/";
+$chipFile .= "fapi2_attribute_getsettemplates.h";
+open(CHFILE, ">", $chipFile);
+
+my $exFile = $ARGV[0];
+$exFile .= "/";
+$exFile .= "proc_sbe_fixed_ex.H";
+open(EXFILE, ">", $exFile);
+
+my $coreFile = $ARGV[0];
+$coreFile .= "/";
+$coreFile .= "proc_sbe_fixed_core.H";
+open(COFILE, ">", $coreFile);
+
+my $eqFile = $ARGV[0];
+$eqFile .= "/";
+$eqFile .= "proc_sbe_fixed_eq.H";
+open(EQFILE, ">", $eqFile);
+
+my $pervFile = $ARGV[0];
+$pervFile .= "/";
+$pervFile .= "proc_sbe_fixed_perv.H";
+open(PEFILE, ">", $pervFile);
+
+
+#------------------------------------------------------------------------------
+# Print Start of file information to fapiAttributeService.C
+#------------------------------------------------------------------------------
+#print ASFILE "// proc_sbe_func.H\n";
+#print ASFILE "// This file is generated by perl script fapi2ParseProcSbeFixed.pl\n\n";
+#print ASFILE "#ifndef __PROC_SBE_FIXED_H__\n";
+#print ASFILE "#define __PROC_SBE_FIXED_H__\n";
+#print ASFILE "#include \"p9_sbe.H\"\n";
+#print ASFILE "#include \"plat_target_parms.H\"\n";
+#print ASFILE "#include \"fapi2AttributeIds.H\"\n\n";
+
+
+my $xmlFiles = 0;
+my $attCount = 0;
+my $numIfAttrFiles = 0;
+my @attrChipIds;
+my @attrExIds;
+my @attrCoreIds;
+my @attrEqIds;
+my @attrPervIds;
+
+
+
+#------------------------------------------------------------------------------
+# Element names
+#------------------------------------------------------------------------------
+my $attribute = 'attribute';
+
+#------------------------------------------------------------------------------
+# For each argument
+#------------------------------------------------------------------------------
+my $argfile = $ARGV[1];
+my $entries = $xml->XMLin($argfile, ForceArray => ['entry']);
+foreach my $entr (@{$entries->{entry}}) {
+
+ my $inname = $entr->{name};
+
+ # 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
+
+ foreach my $argnum (2 .. $#ARGV)
+ {
+ my $infile = $ARGV[$argnum];
+
+ 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}})
+ {
+
+ if($attr->{id} eq $inname) {
+
+ #------------------------------------------------------------------
+ # Check that the AttributeId exists
+ #------------------------------------------------------------------
+ if (! exists $attr->{id})
+ {
+ print ("ppeParseGetSetMacros.pl ERROR. Att 'id' missing\n");
+ exit(1);
+ }
+
+
+ if($attr->{targetType} eq "TARGET_TYPE_PROC_CHIP") {
+
+ push(@attrChipIds, $attr);
+
+ } elsif($attr->{targetType} eq "TARGET_TYPE_CORE") {
+
+ push(@attrCoreIds, $attr);
+
+ } elsif($attr->{targetType} eq "TARGET_TYPE_EQ") {
+
+ push(@attrEqIds, $attr);
+
+ } elsif($attr->{targetType} eq "TARGET_TYPE_EX") {
+
+ push(@attrExIds, $attr);
+
+ } elsif($attr->{targetType} eq "TARGET_TYPE_PERV") {
+
+# push(@attrPervIds, $attr->{id});
+ push(@attrPervIds, $attr);
+
+ } else {
+
+ print ("ppeParseAttrGetSetMacros.pl ERROR. Wrong attribute type: $attr->{targetType}\n");
+ exit(1);
+
+ }
+
+ }
+ }
+ }
+
+}
+
+
+print CHFILE "// proc_sbe_fixed_proc_chip.H\n";
+print CHFILE "// This file is generated by perl script ppeParseAttrGetSetMacros.pl\n\n";
+print CHFILE "#ifndef __PROC_SBE_FIXED_PROC_CHIP_H__\n";
+print CHFILE "#define __PROC_SBE_FIXED_PROC_CHIP_H__\n\n";
+foreach my $attr (@attrChipIds)
+{
+
+ my $value = uc $attr->{valueType};
+ print CHFILE "PROC_SBE_FIXED_$value($attr->{id});\n"
+
+
+}
+print CHFILE "\n#endif // __PROC_SBE_FIXED_PROC_CHIP_H__";
+
+print EXFILE "// proc_sbe_fixed_ex.H\n";
+print EXFILE "// This file is generated by perl script ppeParseAttrGetSetMacros.pl\n\n";
+print EXFILE "#ifndef __PROC_SBE_FIXED_EX_H__\n";
+print EXFILE "#define __PROC_SBE_FIXED_EX_H__\n";
+foreach my $attr (@attrExIds)
+{
+
+ my $value = uc $attr->{valueType};
+ print EXFILE "PROC_SBE_FIXED_TARGET_$value($attr->{id}, EX_TARGET_COUNT);\n"
+
+
+}
+print EXFILE "\n#endif // __PROC_SBE_FIXED_EX_H__";
+
+
+print COFILE "// proc_sbe_fixed_co.H\n";
+print COFILE "// This file is generated by perl script ppeParseAttrGetSetMacros.pl\n\n";
+print COFILE "#ifndef __PROC_SBE_FIXED_CO_H__\n";
+print COFILE "#define __PROC_SBE_FIXED_CO_H__\n";
+foreach my $attr (@attrCoreIds)
+{
+
+ my $value = uc $attr->{valueType};
+ print COFILE "PROC_SBE_FIXED_TARGET_$value($attr->{id}, CORE_TARGET_COUNT);\n"
+
+
+}
+print COFILE "\n#endif // __PROC_SBE_FIXED_CO_H__";
+
+
+
+print EQFILE "// proc_sbe_fixed_eq.H\n";
+print EQFILE "// This file is generated by perl script ppeParseAttrGetSetMacros.pl\n\n";
+print EQFILE "#ifndef __PROC_SBE_FIXED_EQ_H__\n";
+print EQFILE "#define __PROC_SBE_FIXED_EQ_H__\n";
+foreach my $attr (@attrEqIds)
+{
+
+ my $value = uc $attr->{valueType};
+ print EQFILE "PROC_SBE_FIXED_TARGET_$value($attr->{id}, EQ_TARGET_COUNT);\n"
+
+
+}
+print EQFILE "\n#endif // __PROC_SBE_FIXED_EQ_H__";
+
+
+
+print PEFILE "// proc_sbe_fixed_perv.H\n";
+print PEFILE "// This file is generated by perl script ppeParseAttrGetSetMacros.pl\n\n";
+print PEFILE "#ifndef __PROC_SBE_FIXED_PERV_H__\n";
+print PEFILE "#define __PROC_SBE_FIXED_PERV_H__\n";
+foreach my $attr (@attrPervIds)
+{
+
+ my $value = uc $attr->{valueType};
+ print PEFILE "PROC_SBE_FIXED_TARGET_$value($attr->{id}, PERV_TARGET_COUNT);\n"
+
+
+}
+print PEFILE "\n#endif // __PROC_SBE_FIXED_PERV_H__";
+
+
+
+
+
+
+
+
+#print ASFILE "#endif // __PROC_SBE_FIXED_H__";
+
+
+#------------------------------------------------------------------------------
+# Close output file
+#------------------------------------------------------------------------------
+close(CHFILE);
+close(COFILE);
+close(EXFILE);
+close(PEFILE);
+close(EQFILE);
+
diff --git a/tools/scripts/ppeParseAttributeInfo.pl b/tools/scripts/ppeParseAttributeInfo.pl
new file mode 100755
index 00000000..f7be641b
--- /dev/null
+++ b/tools/scripts/ppeParseAttributeInfo.pl
@@ -0,0 +1,1054 @@
+#!/usr/bin/perl -w
+# Purpose: This perl script will parse HWP Attribute XML files
+# and add attribute information to a file called fapi2AttributeIds.H
+
+use strict;
+
+#------------------------------------------------------------------------------
+# Print Command Line Help
+#------------------------------------------------------------------------------
+my $numArgs = $#ARGV + 1;
+if ($numArgs < 2)
+{
+ print ("Usage: ppeParseAttributeInfo.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 (" - fapi2AttributeIds.H. Contains IDs, type, value enums and other information\n");
+ print (" - fapi2ChipEcFeature.C. Contains a function to query chip EC features\n");
+ print (" - fapi2AttributePlatCheck.H. Contains compile time checks that all attributes are\n");
+ print (" handled by the platform\n");
+ print (" - fapi2AttributesSupported.html Contains the HWPF attributes supported\n");
+ print (" - fapi2AttrInfo.csv Used to process Attribute Override Text files\n");
+ print (" - fapi2AttrEnumInfo.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 .= "fapi2AttributeIds.H";
+open(AIFILE, ">", $aiFile);
+
+my $ecFile = $ARGV[0];
+$ecFile .= "/";
+$ecFile .= "fapi2ChipEcFeature.C";
+open(ECFILE, ">", $ecFile);
+
+my $acFile = $ARGV[0];
+$acFile .= "/";
+$acFile .= "fapi2AttributePlatCheck.H";
+open(ACFILE, ">", $acFile);
+
+my $asFile = $ARGV[0];
+$asFile .= "/";
+$asFile .= "fapi2AttributesSupported.html";
+open(ASFILE, ">", $asFile);
+
+my $itFile = $ARGV[0];
+$itFile .= "/";
+$itFile .= "fapi2AttrInfo.csv";
+open(ITFILE, ">", $itFile);
+
+my $etFile = $ARGV[0];
+$etFile .= "/";
+$etFile .= "fapi2AttrEnumInfo.csv";
+open(ETFILE, ">", $etFile);
+
+#------------------------------------------------------------------------------
+# Print Start of file information to fapiAttributeIds.H
+#------------------------------------------------------------------------------
+print AIFILE "// fapi2AttributeIds.H\n";
+print AIFILE "// This file is generated by perl script fapiParseAttributeInfo.pl\n\n";
+print AIFILE "#ifndef FAPI2ATTRIBUTEIDS_H_\n";
+print AIFILE "#define FAPI2ATTRIBUTEIDS_H_\n\n";
+print AIFILE "#ifndef __ASSEMBLER__\n\n";
+print AIFILE "#include <target.H>\n";
+print AIFILE "#include <target_types.H>\n\n";
+print AIFILE "namespace fapi2\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 fapi2\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";
+
+my %attrIdHash; # Records which Attribute IDs have been used
+my %attrValHash; # Records which Attribute values have been used
+
+#------------------------------------------------------------------------------
+# For each XML file
+#------------------------------------------------------------------------------
+#my $argfile = "p9_ppe_attributes.xml";
+my $argfile = $ARGV[1];
+my $entries = $xml->XMLin($argfile, ForceArray => ['entry']);
+foreach my $entr (@{$entries->{entry}}) {
+
+# print " $entr->{file}, $entr->{name}\n";
+
+ #my $infile = $entr->{file};
+ my $inname = $entr->{name};
+
+foreach my $argnum (2 .. $#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 "? $attr->{id}, $inname\n";
+
+ if($attr->{id} eq $inname) {
+
+ #print "yes $attr->{id}, $inname\n";
+
+ #----------------------------------------------------------------------
+ # 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";
+
+
+foreach my $entr (@{$entries->{entry}}) {
+
+# print " $entr->{file}, $entr->{name}\n";
+
+# my $infile = $entr->{file};
+ my $inname = $entr->{name};
+
+ # 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
+
+foreach my $argnum (2 .. $#ARGV)
+{
+ my $infile = $ARGV[$argnum];
+
+ 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}})
+ {
+
+
+
+ if($attr->{id} eq $inname) {
+
+ #----------------------------------------------------------------------
+ # 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);
+ }
+
+
+ #----------------------------------------------------------------------
+ # Figure out the attribute array dimensions (if array)
+ #----------------------------------------------------------------------
+ my $arrayDimensions = "";
+ 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);
+
+ foreach my $val (@vals)
+ {
+ $arrayDimensions .= "[${val}]";
+ $numArrayDimensions++;
+ }
+ }
+
+ #----------------------------------------------------------------------
+ # 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},0x$attrIdHash{$attr->{id}},u8\n"
+ }
+ else
+ {
+ if (! exists $attr->{valueType})
+ {
+ print ("fapiParseAttributeInfo.pl ERROR. Att 'valueType' missing\n");
+ exit(1);
+ }
+
+ if ($attr->{valueType} eq 'uint8')
+ {
+ print AIFILE "typedef uint8_t $attr->{id}_Type$arrayDimensions;\n";
+ print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u8" .
+ "$arrayDimensions\n";
+ }
+ elsif ($attr->{valueType} eq 'uint32')
+ {
+ print AIFILE "typedef uint32_t $attr->{id}_Type$arrayDimensions;\n";
+ print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u32" .
+ "$arrayDimensions\n";
+ }
+ elsif ($attr->{valueType} eq 'uint64')
+ {
+ print AIFILE "typedef uint64_t $attr->{id}_Type$arrayDimensions;\n";
+ print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u64" .
+ "$arrayDimensions\n";
+ }
+ elsif ($attr->{valueType} eq 'int8')
+ {
+ print AIFILE "typedef int8_t $attr->{id}_Type$arrayDimensions;\n";
+ print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},8" .
+ "$arrayDimensions\n";
+ }
+ elsif ($attr->{valueType} eq 'int32')
+ {
+ print AIFILE "typedef int32_t $attr->{id}_Type$arrayDimensions;\n";
+ print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},32" .
+ "$arrayDimensions\n";
+ }
+ elsif ($attr->{valueType} eq 'int64')
+ {
+ print AIFILE "typedef int64_t $attr->{id}_Type$arrayDimensions;\n";
+ print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},64" .
+ "$arrayDimensions\n";
+ }
+ else
+ {
+ print ("fapi2ParseAttributeInfo.pl ERROR. valueType not recognized: ");
+ print $attr->{valueType}, "\n";
+ exit(1);
+ }
+ }
+
+ #----------------------------------------------------------------------
+ # 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 if the attribute is a initToZero attribute
+ #----------------------------------------------------------------------
+ if (exists $attr->{initToZero})
+ {
+ print AIFILE "const bool $attr->{id}_InitToZero = true;\n";
+ }
+ else
+ {
+ print AIFILE "const bool $attr->{id}_InitToZero = 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+$//;
+
+ # 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";
+
+
+
+
+
+ }
+ };
+}
+}
+
+
+
+=for comment
+
+#------------------------------------------------------------------------------
+# 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}})
+ {
+ #----------------------------------------------------------------------
+ # 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";
+
+ #----------------------------------------------------------------------
+ # Figure out the attribute array dimensions (if array)
+ #----------------------------------------------------------------------
+ my $arrayDimensions = "";
+ 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);
+
+ foreach my $val (@vals)
+ {
+ $arrayDimensions .= "[${val}]";
+ $numArrayDimensions++;
+ }
+ }
+
+ #----------------------------------------------------------------------
+ # 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},0x$attrIdHash{$attr->{id}},u8\n"
+ }
+ else
+ {
+ if (! exists $attr->{valueType})
+ {
+ print ("fapiParseAttributeInfo.pl ERROR. Att 'valueType' missing\n");
+ exit(1);
+ }
+
+ if ($attr->{valueType} eq 'uint8')
+ {
+ print AIFILE "typedef uint8_t $attr->{id}_Type$arrayDimensions;\n";
+ print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u8" .
+ "$arrayDimensions\n";
+ }
+ elsif ($attr->{valueType} eq 'uint32')
+ {
+ print AIFILE "typedef uint32_t $attr->{id}_Type$arrayDimensions;\n";
+ print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u32" .
+ "$arrayDimensions\n";
+ }
+ elsif ($attr->{valueType} eq 'uint64')
+ {
+ print AIFILE "typedef uint64_t $attr->{id}_Type$arrayDimensions;\n";
+ print ITFILE "$attr->{id},$attr->{id},0x$attrIdHash{$attr->{id}},u64" .
+ "$arrayDimensions\n";
+ }
+ else
+ {
+ print ("fapiParseAttributeInfo.pl ERROR. valueType not recognized: ");
+ print $attr->{valueType}, "\n";
+ exit(1);
+ }
+ }
+
+ #----------------------------------------------------------------------
+ # 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 if the attribute is a initToZero attribute
+ #----------------------------------------------------------------------
+ if (exists $attr->{initToZero})
+ {
+ print AIFILE "const bool $attr->{id}_InitToZero = true;\n";
+ }
+ else
+ {
+ print AIFILE "const bool $attr->{id}_InitToZero = 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+$//;
+
+ # 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";
+ };
+}
+
+=cut
+
+#------------------------------------------------------------------------------
+# Print End of file information to fapiAttributeIds.H
+#------------------------------------------------------------------------------
+print AIFILE "} //fapi2 \n\n";
+print AIFILE "#endif // __ASSEMBLER__\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";
+
+
+
+
+
+
+
+
+
+#------------------------------------------------------------------------------
+# Close output files
+#------------------------------------------------------------------------------
+close(AIFILE);
+close(ECFILE);
+close(ACFILE);
+close(ASFILE);
+close(ITFILE);
+close(ETFILE);
+
diff --git a/tools/scripts/ppeParseProcSbeFixed.pl b/tools/scripts/ppeParseProcSbeFixed.pl
new file mode 100755
index 00000000..c4d6ea82
--- /dev/null
+++ b/tools/scripts/ppeParseProcSbeFixed.pl
@@ -0,0 +1,253 @@
+#!/usr/bin/perl
+# 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
+
+use strict;
+
+#------------------------------------------------------------------------------
+# Print Command Line Help
+#------------------------------------------------------------------------------
+my $numArgs = $#ARGV + 1;
+if ($numArgs < 3)
+{
+ print ("Usage: ppeParseProcSbeFixed.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 $chipFile = $ARGV[0];
+$chipFile .= "/";
+$chipFile .= "proc_sbe_fixed_proc_chip.H";
+open(CHFILE, ">", $chipFile);
+
+my $exFile = $ARGV[0];
+$exFile .= "/";
+$exFile .= "proc_sbe_fixed_ex.H";
+open(EXFILE, ">", $exFile);
+
+my $coreFile = $ARGV[0];
+$coreFile .= "/";
+$coreFile .= "proc_sbe_fixed_core.H";
+open(COFILE, ">", $coreFile);
+
+my $eqFile = $ARGV[0];
+$eqFile .= "/";
+$eqFile .= "proc_sbe_fixed_eq.H";
+open(EQFILE, ">", $eqFile);
+
+my $pervFile = $ARGV[0];
+$pervFile .= "/";
+$pervFile .= "proc_sbe_fixed_perv.H";
+open(PEFILE, ">", $pervFile);
+
+
+
+my $xmlFiles = 0;
+my $attCount = 0;
+my $numIfAttrFiles = 0;
+my @attrChipIds;
+my @attrExIds;
+my @attrCoreIds;
+my @attrEqIds;
+my @attrPervIds;
+
+
+
+#------------------------------------------------------------------------------
+# Element names
+#------------------------------------------------------------------------------
+my $attribute = 'attribute';
+
+#------------------------------------------------------------------------------
+# For each argument
+#------------------------------------------------------------------------------
+my $argfile = $ARGV[1];
+my $entries = $xml->XMLin($argfile, ForceArray => ['entry']);
+foreach my $entr (@{$entries->{entry}}) {
+
+ my $inname = $entr->{name};
+
+ # 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
+
+ foreach my $argnum (2 .. $#ARGV)
+ {
+ my $infile = $ARGV[$argnum];
+
+ 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}})
+ {
+
+ if($attr->{id} eq $inname) {
+
+ #------------------------------------------------------------------
+ # Check that the AttributeId exists
+ #------------------------------------------------------------------
+ if (! exists $attr->{id})
+ {
+ print ("fapiParseAttributeInfo.pl ERROR. Att 'id' missing\n");
+ exit(1);
+ }
+
+
+ if($attr->{targetType} eq "TARGET_TYPE_PROC_CHIP") {
+
+ #push(@attrChipIds, $attr->{id});
+ push(@attrChipIds, $attr);
+
+ } elsif($attr->{targetType} eq "TARGET_TYPE_CORE") {
+
+ # push(@attrCoreIds, $attr->{id});
+ push(@attrCoreIds, $attr);
+
+ } elsif($attr->{targetType} eq "TARGET_TYPE_EQ") {
+
+ # push(@attrEqIds, $attr->{id});
+ push(@attrEqIds, $attr);
+
+ } elsif($attr->{targetType} eq "TARGET_TYPE_EX") {
+
+ # push(@attrExIds, $attr->{id});
+ push(@attrExIds, $attr);
+
+ } elsif($attr->{targetType} eq "TARGET_TYPE_PERV") {
+
+# push(@attrPervIds, $attr->{id});
+ push(@attrPervIds, $attr);
+
+ } else {
+
+ print ("ppeParseProcSbeFixed.pl ERROR. Wrong attribute type: $attr->{targetType}\n");
+ exit(1);
+
+ }
+
+ }
+ }
+ }
+
+}
+
+
+print CHFILE "// proc_sbe_fixed_proc_chip.H\n";
+print CHFILE "// This file is generated by perl script ppeParseProcSbeFixed.pl\n\n";
+print CHFILE "#ifndef __PROC_SBE_FIXED_PROC_CHIP_H__\n";
+print CHFILE "#define __PROC_SBE_FIXED_PROC_CHIP_H__\n\n";
+foreach my $attr (@attrChipIds)
+{
+
+ my $value = uc $attr->{valueType};
+ print CHFILE "PROC_SBE_FIXED_$value($attr->{id});\n"
+
+
+}
+print CHFILE "\n#endif // __PROC_SBE_FIXED_PROC_CHIP_H__";
+
+print EXFILE "// proc_sbe_fixed_ex.H\n";
+print EXFILE "// This file is generated by perl script ppeParseProcSbeFixed.pl\n\n";
+print EXFILE "#ifndef __PROC_SBE_FIXED_EX_H__\n";
+print EXFILE "#define __PROC_SBE_FIXED_EX_H__\n";
+foreach my $attr (@attrExIds)
+{
+
+ my $value = uc $attr->{valueType};
+ print EXFILE "PROC_SBE_FIXED_TARGET_$value($attr->{id}, EX_TARGET_COUNT);\n"
+
+
+}
+print EXFILE "\n#endif // __PROC_SBE_FIXED_EX_H__";
+
+
+print COFILE "// proc_sbe_fixed_co.H\n";
+print COFILE "// This file is generated by perl script ppeParseProcSbeFixed.pl\n\n";
+print COFILE "#ifndef __PROC_SBE_FIXED_CO_H__\n";
+print COFILE "#define __PROC_SBE_FIXED_CO_H__\n";
+foreach my $attr (@attrCoreIds)
+{
+
+ my $value = uc $attr->{valueType};
+ print COFILE "PROC_SBE_FIXED_TARGET_$value($attr->{id}, CORE_TARGET_COUNT);\n"
+
+
+}
+print COFILE "\n#endif // __PROC_SBE_FIXED_CO_H__";
+
+
+
+print EQFILE "// proc_sbe_fixed_eq.H\n";
+print EQFILE "// This file is generated by perl script ppeParseProcSbeFixed.pl\n\n";
+print EQFILE "#ifndef __PROC_SBE_FIXED_EQ_H__\n";
+print EQFILE "#define __PROC_SBE_FIXED_EQ_H__\n";
+foreach my $attr (@attrEqIds)
+{
+
+ my $value = uc $attr->{valueType};
+ print EQFILE "PROC_SBE_FIXED_TARGET_$value($attr->{id}, EQ_TARGET_COUNT);\n"
+
+
+}
+print EQFILE "\n#endif // __PROC_SBE_FIXED_EQ_H__";
+
+
+
+print PEFILE "// proc_sbe_fixed_perv.H\n";
+print PEFILE "// This file is generated by perl script ppeParseProcSbeFixed.pl\n\n";
+print PEFILE "#ifndef __PROC_SBE_FIXED_PERV_H__\n";
+print PEFILE "#define __PROC_SBE_FIXED_PERV_H__\n";
+foreach my $attr (@attrPervIds)
+{
+
+ my $value = uc $attr->{valueType};
+ print PEFILE "PROC_SBE_FIXED_TARGET_$value($attr->{id}, PERV_TARGET_COUNT);\n"
+
+
+}
+print PEFILE "\n#endif // __PROC_SBE_FIXED_PERV_H__";
+
+
+
+
+
+
+
+
+#print ASFILE "#endif // __PROC_SBE_FIXED_H__";
+
+
+#------------------------------------------------------------------------------
+# Close output file
+#------------------------------------------------------------------------------
+close(CHFILE);
+close(COFILE);
+close(EXFILE);
+close(PEFILE);
+close(EQFILE);
+
diff --git a/tools/scripts/ppe_attributes.xml b/tools/scripts/ppe_attributes.xml
new file mode 100644
index 00000000..519dd321
--- /dev/null
+++ b/tools/scripts/ppe_attributes.xml
@@ -0,0 +1,109 @@
+<!-- $Id: p9_ppe_attributes.xml,v 1.11 2013/11/07 21:51:13 rembold Exp $ -->
+<!-- p9_ppe_attributes.xml -->
+<entries>
+ <!-- ********************************************************************* -->
+ <entry>
+ <name>ATTR_SCRATCH_UINT8_1</name>
+ <file>proc_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_UINT8_2</name>
+ <file>proc_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_UINT32_1</name>
+ <file>proc_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_UINT32_2</name>
+ <file>proc_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_UINT64_1</name>
+ <file>proc_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_UINT64_2</name>
+ <file>proc_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_INT8_1</name>
+ <file>proc_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_INT8_2</name>
+ <file>proc_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_INT32_1</name>
+ <file>proc_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_INT32_2</name>
+ <file>proc_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_INT64_1</name>
+ <file>proc_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_SCRATCH_INT64_2</name>
+ <file>proc_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_REPR_RING</name>
+ <file>perv_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_TIME_RING</name>
+ <file>perv_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_GPTR_RING</name>
+ <file>perv_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_PLL_RING</name>
+ <file>perv_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_CORE_REPR_RING</name>
+ <file>core_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_CORE_TIME_RING</name>
+ <file>core_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_CORE_GPTR_RING</name>
+ <file>core_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_L2_REPR_RING</name>
+ <file>ex_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_L2_TIME_RING</name>
+ <file>ex_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_L2_GPTR_RING</name>
+ <file>ex_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_L3_REPR_RING</name>
+ <file>ex_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_L3_TIME_RING</name>
+ <file>ex_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_L3_GPTR_RING</name>
+ <file>ex_attributes.xml</file>
+ </entry>
+ <entry>
+ <name>ATTR_DPLL_RING</name>
+ <file>eq_attributes.xml</file>
+ </entry>
+</entries>
diff --git a/tools/scripts/proc_attributes.xml b/tools/scripts/proc_attributes.xml
new file mode 100644
index 00000000..4273a93f
--- /dev/null
+++ b/tools/scripts/proc_attributes.xml
@@ -0,0 +1,151 @@
+<!-- $Id: proc_pll_ring_attributes.xml,v 1.17 2014/11/13 20:14:02 szhong Exp $ -->
+<!-- proc_attributes.xml -->
+<attributes>
+ <attribute>
+ <id>ATTR_SCRATCH_UINT8_1</id>
+ <targetType>TARGET_TYPE_PROC_CHIP</targetType>
+ <description>
+ </description>
+ <valueType>uint8</valueType>
+ <platInit/>
+ <writeable/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_SCRATCH_UINT8_2</id>
+ <targetType>TARGET_TYPE_PROC_CHIP</targetType>
+ <description>
+ </description>
+ <valueType>uint8</valueType>
+ <platInit/>
+ <writeable/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_SCRATCH_UINT32_1</id>
+ <targetType>TARGET_TYPE_PROC_CHIP</targetType>
+ <description>
+ </description>
+ <valueType>uint32</valueType>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_SCRATCH_UINT32_2</id>
+ <targetType>TARGET_TYPE_PROC_CHIP</targetType>
+ <description>
+ </description>
+ <valueType>uint32</valueType>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_SCRATCH_UINT64_1</id>
+ <targetType>TARGET_TYPE_PROC_CHIP</targetType>
+ <description>
+ </description>
+ <valueType>uint64</valueType>
+ <platInit/>
+ <writeable/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_SCRATCH_UINT64_2</id>
+ <targetType>TARGET_TYPE_PROC_CHIP</targetType>
+ <description>
+ </description>
+ <valueType>uint64</valueType>
+ <enum>VAL_A = 0, VAL_B = 5, VAL_C = 0xffffffffffffffff</enum>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_SIGNED_TEST_8</id>
+ <targetType>TARGET_TYPE_PROC_CHIP</targetType>
+ <description>
+ </description>
+ <valueType>int8</valueType>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_SIGNED_TEST_64</id>
+ <targetType>TARGET_TYPE_PROC_CHIP</targetType>
+ <description>
+ </description>
+ <valueType>int64</valueType>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_SCRATCH_INT8_1</id>
+ <targetType>TARGET_TYPE_PROC_CHIP</targetType>
+ <description>
+ </description>
+ <valueType>int8</valueType>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_SCRATCH_INT8_2</id>
+ <targetType>TARGET_TYPE_PROC_CHIP</targetType>
+ <description>
+ </description>
+ <valueType>int8</valueType>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_SCRATCH_INT32_1</id>
+ <targetType>TARGET_TYPE_PROC_CHIP</targetType>
+ <description>
+ </description>
+ <valueType>int32</valueType>
+ <platInit/>
+ <writeable/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_SCRATCH_INT32_2</id>
+ <targetType>TARGET_TYPE_PROC_CHIP</targetType>
+ <description>
+ </description>
+ <valueType>int32</valueType>
+ <platInit/>
+ <writeable/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_SCRATCH_INT64_1</id>
+ <targetType>TARGET_TYPE_PROC_CHIP</targetType>
+ <description>
+ </description>
+ <valueType>int64</valueType>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_SCRATCH_INT64_2</id>
+ <targetType>TARGET_TYPE_PROC_CHIP</targetType>
+ <description>
+ </description>
+ <valueType>int64</valueType>
+ <enum>VAL_A = 0, VAL_B = 5, VAL_C = 0xffffffffffffffff</enum>
+ <platInit/>
+ <persistRuntime/>
+ </attribute>
+ <!-- ********************************************************************* -->
+</attributes>
diff --git a/tools/scripts/src/fapi2PlatAttributeService.H b/tools/scripts/src/fapi2PlatAttributeService.H
new file mode 100644
index 00000000..3a3a7769
--- /dev/null
+++ b/tools/scripts/src/fapi2PlatAttributeService.H
@@ -0,0 +1,1061 @@
+/**
+ * @file fapiPlatAttributeService.H
+ *
+ * @brief Defines the PLAT attribute access macros and defines which macro
+ * handles each attribute.
+ *
+ */
+
+
+#ifndef FAPI2PLATATTRIBUTESERVICE_H_
+#define FAPI2PLATATTRIBUTESERVICE_H_
+
+#include <stdint.h>
+#include <stddef.h>
+#include <fapi2AttributeIds.H>
+#include <plat_includes.H>
+#include "proc_sbe_fixed.H"
+#include "plat_target_parms.H"
+
+#define PLAT_GET_CHIP_EC_FEATURE_OVERRIDE(ID, PTARGET, VAL) \
+ fapi2::_getEcFeatureOverride<fapi2::ID##_Type>(fapi2::ID, PTARGET, VAL)
+
+/* INSERT NEW ATTRIBUTES HERE */
+
+#define ATTR_TARGET_SCOMABLE_GETMACRO PLAT_ATTR_GET_GLOBAL_INT
+#define ATTR_TARGET_SCOMABLE_SETMACRO PLAT_ATTR_SET_GLOBAL_INT
+
+
+
+/******************************************************************************/
+/* * Global macros * */
+/* These macros are called by the macros above to invoke the appropriate API. */
+/* These macros do not need to change when a new attribute is introduced. */
+/******************************************************************************/
+
+/* global get uint8_t 1D array macro */
+#define PLAT_ATTR_GET_UINT8_1D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeArrayShort<fapi2::ID##_Type, static_cast<TargetType>(fapi2::ID##_TargetTypes), fapi2::ID> \
+ (fapi2::ID, PTARGET, VAL)
+
+/* global set uint8_t 1D array macro */
+#define PLAT_ATTR_SET_UINT8_1D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_setAttributeArrayShort<fapi2::ID##_Type, static_cast<TargetType>(fapi2::ID##_TargetTypes), fapi2::ID> \
+ (fapi2::ID, PTARGET, VAL)
+
+/* global get uint8_t 2D array macro */
+#define PLAT_ATTR_GET_UINT8_2D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeArrayShort(fapi2::ID, PTARGET, VAL[0])
+/* global set uint8_t 2D array macro */
+#define PLAT_ATTR_SET_UINT8_2D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_setAttributeArrayShort(fapi2::ID, PTARGET, VAL[0])
+
+/* global get uint8_t 3D array macro */
+#define PLAT_ATTR_GET_UINT8_3D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeArrayShort(fapi2::ID, PTARGET, VAL[0][0])
+/* global set uint8_t 3D array macro */
+#define PLAT_ATTR_SET_UINT8_3D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_setAttributeArrayShort(fapi2::ID, PTARGET, VAL[0][0])
+
+/* global get uint8_t 4D array macro */
+#define PLAT_ATTR_GET_UINT8_4D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeArrayShort(fapi2::ID, PTARGET, VAL[0][0][0])
+/* global set uint8_t 4D array macro */
+#define PLAT_ATTR_SET_UINT8_4D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_setAttributeArrayShort(fapi2::ID, PTARGET, VAL[0][0][0])
+
+/* global get uint32_t 1D array macro */
+#define PLAT_ATTR_GET_UINT32_1D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeArrayWord(fapi2::ID, PTARGET, VAL)
+/* global set uint32_t 1D array macro */
+#define PLAT_ATTR_SET_UINT32_1D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_setAttributeArrayWord(fapi2::ID, PTARGET, VAL)
+
+/* global get uint32_t 2D array macro */
+#define PLAT_ATTR_GET_UINT32_2D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeArrayWord(fapi2::ID, PTARGET, VAL[0])
+/* global set uint32_t 2D array macro */
+#define PLAT_ATTR_SET_UINT32_2D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_setAttributeArrayWord(fapi2::ID, PTARGET, VAL[0])
+
+/* global get uint32_t 3D array macro */
+#define PLAT_ATTR_GET_UINT32_3D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeArrayWord(fapi2::ID, PTARGET, VAL[0][0])
+/* global set uint32_t 3D array macro */
+#define PLAT_ATTR_SET_UINT32_3D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_setAttributeArrayWord(fapi2::ID, PTARGET, VAL[0][0])
+
+/* global get uint32_t 4D array macro */
+#define PLAT_ATTR_GET_UINT32_4D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeArrayWord(fapi2::ID, PTARGET, VAL[0][0][0])
+/* global set uint32_t 4D array macro */
+#define PLAT_ATTR_SET_UINT32_4D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_setAttributeArrayWord(fapi2::ID, PTARGET, VAL[0][0][0])
+
+
+/* global get uint64_t 1D array macro */
+#define PLAT_ATTR_GET_UINT64_1D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL)
+/* global set uint64_t 1D array macro */
+#define PLAT_ATTR_SET_UINT64_1D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_setAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL)
+
+/* global get uint64_t 2D array macro */
+#define PLAT_ATTR_GET_UINT64_2D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL[0])
+/* global set uint64_t 2D array macro */
+#define PLAT_ATTR_SET_UINT64_2D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_setAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL[0])
+
+/* global get uint64_t 3D array macro */
+#define PLAT_ATTR_GET_UINT64_3D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL[0][0])
+/* global set uint64_t 3D array macro */
+#define PLAT_ATTR_SET_UINT64_3D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_setAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL[0][0])
+
+/* global get uint64_t 4D array macro */
+#define PLAT_ATTR_GET_UINT64_4D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL[0][0][0])
+/* global set uint64_t 4D array macro */
+#define PLAT_ATTR_SET_UINT64_4D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_setAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL[0][0][0])
+
+/* global get int macro (uint8_t, 32 and 64) */
+#define PLAT_ATTR_GET_GLOBAL_INT(ID, PTARGET, VAL) \
+ fapi2::_get<fapi2::ID##_Type, static_cast<TargetType>(fapi2::ID##_TargetTypes), fapi2::ID> \
+ (fapi2::ID, PTARGET, VAL)
+
+/* global set int macro (uint8_t, 32 and 64) */
+#define PLAT_ATTR_SET_GLOBAL_INT(ID, PTARGET, VAL) \
+ fapi2::_set<fapi2::ID##_Type, static_cast<TargetType>(fapi2::ID##_TargetTypes), fapi2::ID> \
+ (fapi2::ID, PTARGET, VAL)
+
+
+//here
+
+/******************************************************************************/
+// Get Override Macros
+/******************************************************************************/
+/* global get override uint8_t 1D array macro */
+#define PLAT_ATTR_GET_OVERRIDE_UINT8_1D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeOverrideArrayShort(fapi2::ID, PTARGET, VAL)
+/* global get override uint8_t 2D array macro */
+#define PLAT_ATTR_GET_OVERRIDE_UINT8_2D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeOverrideArrayShort(fapi2::ID, PTARGET, VAL[0])
+/* global get override uint8_t 3D array macro */
+#define PLAT_ATTR_GET_OVERRIDE_UINT8_3D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeOverrideArrayShort(fapi2::ID, PTARGET, VAL[0][0])
+/* global get override uint8_t 4D array macro */
+#define PLAT_ATTR_GET_OVERRIDE_UINT8_4D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeOverrideArrayShort(fapi2::ID, PTARGET, VAL[0][0][0])
+
+
+/* global get override uint32_t 1D array macro */
+#define PLAT_ATTR_GET_OVERRIDE_UINT32_1D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeOverrideArrayWord(fapi2::ID, PTARGET, VAL)
+/* global get override uint32_t 2D array macro */
+#define PLAT_ATTR_GET_OVERRIDE_UINT32_2D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeOverrideArrayWord(fapi2::ID, PTARGET, VAL[0])
+/* global get override uint32_t 3D array macro */
+#define PLAT_ATTR_GET_OVERRIDE_UINT32_3D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeOverrideArrayWord(fapi2::ID, PTARGET, VAL[0][0])
+/* global get override uint32_t 4D array macro */
+#define PLAT_ATTR_GET_OVERRIDE_UINT32_4D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeOverrideArrayWord(fapi2::ID, PTARGET, VAL[0][0][0])
+
+
+/* global get override uint64_t 1D array macro */
+#define PLAT_ATTR_GET_OVERRIDE_UINT64_1D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeOverrideArrayDoubleWord(fapi2::ID, PTARGET, VAL)
+/* global get override uint64_t 2D array macro */
+#define PLAT_ATTR_GET_OVERRIDE_UINT64_2D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeOverrideArrayDoubleWord(fapi2::ID, PTARGET, VAL[0])
+/* global get override uint64_t 3D array macro */
+#define PLAT_ATTR_GET_OVERRIDE_UINT64_3D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeOverrideArrayDoubleWord(fapi2::ID, PTARGET, VAL[0][0])
+/* global get override uint64_t 4D array macro */
+#define PLAT_ATTR_GET_OVERRIDE_UINT64_4D_ARRAY(ID, PTARGET, VAL) \
+ fapi2::_getAttributeOverrideArrayDoubleWord(fapi2::ID, PTARGET, VAL[0][0][0])
+
+/* global get override int macro (uint8_t, 32 and 64) */
+#define PLAT_ATTR_GET_OVERRIDE_GLOBAL_INT(ID, PTARGET, VAL) \
+ fapi2::_getOverride<fapi2::ID##_Type>(fapi2::ID, PTARGET, VAL)
+
+/******************************************************************************/
+// Get string
+/******************************************************************************/
+
+extern "C"
+{
+ extern fapi2attr::ProcChipAttributes_t* G_proc_chip_attributes asm("G_proc_chip_attributes") __attribute__ ((section (".fixed")));
+ extern fapi2attr::PervAttributes_t* G_perv_attributes asm("G_perv_attributes") __attribute__ ((section (".fixed")));
+ extern fapi2attr::CoreAttributes_t* G_core_attributes asm("G_core_attributes") __attribute__ ((section (".fixed")));
+ extern fapi2attr::EQAttributes_t* G_eq_attributes asm("G_eq_attributes") __attribute__ ((section (".fixed")));
+ extern fapi2attr::EXAttributes_t* G_ex_attributes asm("G_ex_attributes") __attribute__ ((section (".fixed")));
+
+}
+
+namespace fapi2
+{
+
+
+// Parameters are done as pointers (vs references) to allow the attribute
+// storage to be relocated
+template<fapi2::TargetType K, typename TAttrStruct, typename TValue, fapi2::AttributeId AId>
+void __set( const fapi2::Target<K>* i_ptarget, TAttrStruct* object, const fapi2::AttributeId attrid, TValue* value );
+
+template<fapi2::TargetType K, typename TAttrStruct, typename TValue, fapi2::AttributeId AId>
+void __get( const fapi2::Target<K>* i_ptarget, TAttrStruct* object, const fapi2::AttributeId attrid, TValue* value );
+
+
+/* INSERT NEW GETTER AND SETTER FUNCTIONS HERE */
+
+
+
+//******************************************************************************
+// Get base template
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _get(const AttributeId i_Id,
+ const Target<K> * const i_pTarget,
+ T& o_value)
+{
+ return FAPI2_RC_SUCCESS;
+}
+
+//******************************************************************************
+// Get uint8_t
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _get(const fapi2::AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ uint8_t& o_value)
+{
+ static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch");
+
+ if(K & TARGET_TYPE_PROC_CHIP)
+ {
+ __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_PERV)
+ {
+ __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_CORE)
+ {
+ __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_EQ)
+ {
+ __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_EX)
+ {
+ __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes, i_id, &o_value );
+ }
+
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Get uint32_t
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _get(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ uint32_t& o_value)
+{
+ static_assert(std::is_same<T, uint32_t>::value, "Attribute type mismatch");
+
+ if(K & TARGET_TYPE_PROC_CHIP)
+ {
+ __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_PERV)
+ {
+ __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_CORE)
+ {
+ __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_EQ)
+ {
+ __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_EX)
+ {
+ __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes, i_id, &o_value );
+ }
+
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Get uint64_t
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _get(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ uint64_t& o_value)
+{
+ static_assert(std::is_same<T, uint64_t>::value, "Attribute type mismatch");
+
+
+ if(K & TARGET_TYPE_PROC_CHIP)
+ {
+ __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_PERV)
+ {
+ __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_CORE)
+ {
+ __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_EQ)
+ {
+ __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_EX)
+ {
+ __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes, i_id, &o_value );
+ }
+
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Get Override uint8_t
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _getOverride(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ uint8_t& o_value)
+{
+ static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch");
+
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Get Override uint32_t
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _getOverride(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ uint32_t& o_value)
+{
+ static_assert(std::is_same<T, uint32_t>::value, "Attribute type mismatch");
+
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Get Override uint64_t
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _getOverride(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ uint64_t& o_value)
+{
+ static_assert(std::is_same<T, uint64_t>::value, "Attribute type mismatch");
+
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Get override EC Feature (uint8_t)
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _getEcFeatureOverride(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ uint8_t& o_value)
+{
+ static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch");
+
+ // The way this is implemented, we want to return a non-zero return code if we found an override.
+ // Return 0 if there was an error.
+ // This is how it's implemented:
+ // PLAT_GET_CHIP_EC_FEATURE_OVERRIDE(ID, PTARGET, VAL) ? fapi::FAPI_RC_SUCCESS : fapi::fapiQueryChipEcFeature(fapi::ID, PTARGET, VAL)
+
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Get uint8_t array
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _getAttributeArrayShort(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ uint8_t * o_pValues)
+{
+// fapi2::Attributeta o_data;
+// fapi2::ReturnCode l_fapi_rc(FAPI2_RC_SUCCESS);
+// uint32_t l_ecmd_rc = ECMD_SUCCESS;
+//
+// ecmdChipTarget l_ecmd_target;
+// fapiTargetPointerToEcmdTarget(i_pTarget, l_ecmd_target);
+//
+// o_data.faValidMask = FAPI_ATTRIBUTE_TYPE_UINT8ARY;
+// o_data.faUint8ary = o_pValues;
+//
+// l_ecmd_rc = fapi2GetAttribute(l_ecmd_target, i_id, o_data);
+// if (l_ecmd_rc)
+// {
+// l_fapi_rc = (ReturnCodes) l_ecmd_rc;
+// }
+// return l_fapi_rc;
+ return FAPI2_RC_SUCCESS;
+}
+
+//******************************************************************************
+// Set uint8_t array
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _setAttributeArrayShort(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ uint8_t * i_pValues)
+{
+ if(K & TARGET_TYPE_PROC_CHIP)
+ {
+ __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, *i_pValues );
+ }
+
+ if(K & TARGET_TYPE_PERV)
+ {
+ __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_pValues );
+ }
+
+ if(K & TARGET_TYPE_CORE)
+ {
+ __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, *i_pValues );
+ }
+
+ if(K & TARGET_TYPE_EQ)
+ {
+ __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, *i_pValues );
+ }
+
+ if(K & TARGET_TYPE_EX)
+ {
+ __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, *i_pValues );
+ }
+
+ return FAPI2_RC_SUCCESS;
+}
+
+//******************************************************************************
+// Get uint32_t array
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _getAttributeArrayWord(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ uint32_t * o_pValues)
+{
+ return FAPI2_RC_SUCCESS;
+}
+
+//******************************************************************************
+// Set uint32_t array
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _setAttributeArrayWord(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ uint32_t * i_pValues)
+{
+ return FAPI2_RC_SUCCESS;
+}
+
+//******************************************************************************
+// Get uint64_t array
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _getAttributeArrayDoubleWord(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ uint64_t * o_pValues)
+{
+ return FAPI2_RC_SUCCESS;
+}
+
+//******************************************************************************
+// Set uint64_t array
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _setAttributeArrayDoubleWord(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ uint64_t * i_pValues)
+{
+ return FAPI2_RC_SUCCESS;
+}
+
+//******************************************************************************
+// Get Override uint8_t array
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _getAttributeOverrideArrayShort(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ uint8_t * o_pValues)
+{
+ return FAPI2_RC_SUCCESS;
+}
+
+//******************************************************************************
+// Get Override uint32_t array
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _getAttributeOverrideArrayWord(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ uint32_t * o_pValues)
+{
+ return FAPI2_RC_SUCCESS;
+}
+
+//******************************************************************************
+// Get Override uint64_t array
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _getAttributeOverrideArrayDoubleWord(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ uint64_t * o_pValues)
+{
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Set base template
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _set(const AttributeId i_Id,
+ const Target<K> * const i_pTarget,
+ T& i_value)
+{
+ return FAPI2_RC_SUCCESS;
+}
+
+
+
+//******************************************************************************
+// Set uint8_t
+//******************************************************************************
+template<typename T, TargetType K, typename A>
+ReturnCode _set(const AttributeId i_Id,
+ const Target<K> * const i_pTarget,
+ uint8_t& i_value)
+{
+ static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch"); // May need to remove
+
+ if(K & TARGET_TYPE_PROC_CHIP)
+ {
+ __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_PERV)
+ {
+ __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_CORE)
+ {
+ __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_EQ)
+ {
+ __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_EX)
+ {
+ __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, i_value );
+ }
+
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Set uint32_t
+//******************************************************************************
+template<typename T, TargetType K, typename A>
+ReturnCode _set(
+ const Target<K> * const i_pTarget,
+ uint32_t& i_value)
+{
+ static_assert(std::is_same<T, uint32_t>::value, "Attribute type mismatch"); // May need to remove
+
+ if(K & TARGET_TYPE_PROC_CHIP)
+ {
+ __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_PERV)
+ {
+ __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_CORE)
+ {
+ __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_EQ)
+ {
+ __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_EX)
+ {
+ __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, i_value );
+ }
+
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Set uint64_t
+//******************************************************************************
+
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _set(const AttributeId i_Id,
+ const Target<K> * const i_pTarget,
+ const uint64_t & i_value)
+{
+ static_assert(std::is_same<T, uint64_t>::value, "Attribute type mismatch"); // May need to remove
+
+ if(K & TARGET_TYPE_PROC_CHIP)
+ {
+ __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_PERV)
+ {
+ __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_CORE)
+ {
+ __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_EQ)
+ {
+ __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_EX)
+ {
+ __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, i_value );
+ }
+
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Get int8_t
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _get(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ int8_t& o_value)
+{
+ static_assert(std::is_same<T, int8_t>::value, "Attribute type mismatch");
+
+ if(K & TARGET_TYPE_PROC_CHIP)
+ {
+ __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_PERV)
+ {
+ __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_CORE)
+ {
+ __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_EQ)
+ {
+ __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_EX)
+ {
+ __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes, i_id, &o_value );
+ }
+
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Get int32_t
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _get(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ int32_t& o_value)
+{
+ static_assert(std::is_same<T, int32_t>::value, "Attribute type mismatch");
+
+ if(K & TARGET_TYPE_PROC_CHIP)
+ {
+ __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_PERV)
+ {
+ __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_CORE)
+ {
+ __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_EQ)
+ {
+ __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_EX)
+ {
+ __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes, i_id, &o_value );
+ }
+
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Get int64_t
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _get(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ int64_t& o_value)
+{
+ static_assert(std::is_same<T, int64_t>::value, "Attribute type mismatch");
+
+ if(K & TARGET_TYPE_PROC_CHIP)
+ {
+ __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_PERV)
+ {
+ __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_CORE)
+ {
+ __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_EQ)
+ {
+ __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes, i_id, &o_value );
+ }
+
+ if(K & TARGET_TYPE_EX)
+ {
+ __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes, i_id, &o_value );
+ }
+
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Get Override int8_t
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _getOverride(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ int8_t& o_value)
+{
+ static_assert(std::is_same<T, int8_t>::value, "Attribute type mismatch");
+
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Get Override int32_t
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _getOverride(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ int32_t& o_value)
+{
+ static_assert(std::is_same<T, int32_t>::value, "Attribute type mismatch");
+
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Get Override int64_t
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _getOverride(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ int64_t& o_value)
+{
+ static_assert(std::is_same<T, int64_t>::value, "Attribute type mismatch");
+
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Get int8_t array
+//******************************************************************************
+template<TargetType K>
+ReturnCode _getAttributeArraySignedShort(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ int8_t * o_pValues)
+{
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Set int8_t array
+//******************************************************************************
+template<TargetType K>
+ReturnCode _setAttributeArraySignedShort(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ int8_t * i_pValues)
+{
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Get int32_t array
+//******************************************************************************
+template<TargetType K>
+ReturnCode _getAttributeArraySignedWord(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ int32_t * o_pValues)
+{
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Set int32_t array
+//******************************************************************************
+template<TargetType K>
+ReturnCode _setAttributeArraySignedWord(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ int32_t * i_pValues)
+{
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Get int64_t array
+//******************************************************************************
+template<TargetType K>
+ReturnCode _getAttributeArraySignedDoubleWord(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ int64_t * o_pValues)
+{
+ return FAPI2_RC_SUCCESS;
+}
+
+//******************************************************************************
+// Set int64_t array
+//******************************************************************************
+template<TargetType K>
+ReturnCode _setAttributeArraySignedDoubleWord(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ int64_t * i_pValues)
+{
+ return FAPI2_RC_SUCCESS;
+}
+
+//******************************************************************************
+// Get Override int8_t array
+//******************************************************************************
+template<TargetType K>
+ReturnCode _getAttributeOverrideArraySignedShort(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ int8_t * o_pValues)
+{
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Get Override int32_t array
+//******************************************************************************
+template<TargetType K>
+ReturnCode _getAttributeOverrideArraySignedWord(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ int32_t * o_pValues)
+{
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Get Override int64_t array
+//******************************************************************************
+template<TargetType K>
+ReturnCode _getAttributeOverrideArraySignedDoubleWord(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ int64_t * o_pValues)
+{
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Set int8_t
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _set(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ int8_t& i_value)
+{
+ static_assert(std::is_same<T, int8_t>::value, "Attribute type mismatch"); // May need to remove
+
+ if(K & TARGET_TYPE_PROC_CHIP)
+ {
+ __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_PERV)
+ {
+ __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_CORE)
+ {
+ __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_EQ)
+ {
+ __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_EX)
+ {
+ __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, i_value );
+ }
+
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Set int32_t
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _set(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ int32_t& i_value)
+{
+ static_assert(std::is_same<T, int32_t>::value, "Attribute type mismatch"); // May need to remove
+
+ if(K & TARGET_TYPE_PROC_CHIP)
+ {
+ __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_PERV)
+ {
+ __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_CORE)
+ {
+ __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_EQ)
+ {
+ __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_EX)
+ {
+ __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, i_value );
+ }
+
+ return FAPI2_RC_SUCCESS;
+}
+
+
+//******************************************************************************
+// Set int64_t
+//******************************************************************************
+template<typename T, TargetType K, AttributeId A>
+ReturnCode _set(const AttributeId i_id,
+ const Target<K> * const i_pTarget,
+ const int64_t & i_value)
+{
+ static_assert(std::is_same<T, int64_t>::value, "Attribute type mismatch"); // May need to remove
+
+ if(K & TARGET_TYPE_PROC_CHIP)
+ {
+ __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_PERV)
+ {
+ __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_CORE)
+ {
+ __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_EQ)
+ {
+ __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, i_value );
+ }
+
+ if(K & TARGET_TYPE_EX)
+ {
+ __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, i_value );
+ }
+
+ return FAPI2_RC_SUCCESS;
+}
+
+
+} // namespace fapi2
+#endif // FAPIPLATATTRIBUTESERVICE_H_
OpenPOWER on IntegriCloud