summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSachin Gupta <sgupta2m@in.ibm.com>2015-12-01 05:17:22 -0600
committerAmit J. Tendolkar <amit.tendolkar@in.ibm.com>2015-12-08 00:52:20 -0600
commitb50b79a16f7face41d9d4fbb5983af76c7d3de26 (patch)
treec33f7d1900a7aef4a1986ad7c164e5b215b5e3ba
parentfaf39456308c7d90bb1cd5d5f88c2b7136a81923 (diff)
downloadtalos-sbe-b50b79a16f7face41d9d4fbb5983af76c7d3de26.tar.gz
talos-sbe-b50b79a16f7face41d9d4fbb5983af76c7d3de26.zip
Workaround for fixed section in PIBMEM
Change-Id: I0fc1891dbb6546a05569b7a13101be65d57b2991 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/22361 Tested-by: Jenkins Server Reviewed-by: Santosh S. Puranik <santosh.puranik@in.ibm.com> Reviewed-by: Amit J. Tendolkar <amit.tendolkar@in.ibm.com>
-rw-r--r--sbe/image/Makefile12
-rw-r--r--sbe/sbefw/sbefwfiles.mk1
-rw-r--r--sbe/sbefw/sbemain.C9
-rwxr-xr-xtools/image/ppeSetFixedPibmem.pl212
4 files changed, 230 insertions, 4 deletions
diff --git a/sbe/image/Makefile b/sbe/image/Makefile
index a5af22c9..d6cbd799 100644
--- a/sbe/image/Makefile
+++ b/sbe/image/Makefile
@@ -115,7 +115,10 @@ $(OBJDIR)/$(IMAGE_SEEPROM_NAME).bin $(OBJDIR)/$(IMAGE_SEEPROM_NAME).dis: $(OBJDI
ifndef FAPI2_TEST
# This is the production build of the SEEPROM
#create a linked ELF executable
-$(OBJDIR)/$(IMAGE_SEEPROM_NAME).out: buildInfo $(LINK_OBJS) $(LINK_SCRIPT_SEEPROM)
+# TODO via RTC 142365
+# Remove pibMemAttrSet from this file once we have support to copy fixed section
+# from SEEPROM to PIBMEM.
+$(OBJDIR)/$(IMAGE_SEEPROM_NAME).out: pibMemAttrSet buildInfo $(LINK_OBJS) $(LINK_SCRIPT_SEEPROM)
@echo ">>>>> Production Build <<<<<<"
$(LD) -e __system_reset -T$(LINK_SCRIPT_SEEPROM) -Map $(OBJDIR)/$(IMAGE_SEEPROM_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out $(OBJS) $(LIB_DIRS) -leabi -lmath
else
@@ -139,7 +142,7 @@ $(OBJDIR)/$(IMAGE_SBE_NAME).bin $(OBJDIR)/$(IMAGE_SBE_NAME).dis: $(OBJDIR)/$(IMA
$(NM) $< > $(OBJDIR)/$(IMAGE_SBE_NAME).syms
# create a linked ELF executable
-$(OBJDIR)/$(IMAGE_SBE_NAME).out: buildInfo $(OBJDIR)/base_sbe_fixed.o $(LINK_OBJS) $(LINK_SCRIPT_SBE)
+$(OBJDIR)/$(IMAGE_SBE_NAME).out: pibMemAttrSet buildInfo $(OBJDIR)/base_sbe_fixed.o $(LINK_OBJS) $(LINK_SCRIPT_SBE)
$(LD) -e __system_reset -T$(LINK_SCRIPT_SBE) -Map $(OBJDIR)/$(IMAGE_SBE_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_SBE_NAME).out $(LIB_DIRS) $(OBJDIR)/base_sbe_fixed.o --start-group $(LLIBS) -leabi -lmath --end-group
# pass the link command file through the C preprocessor to evaluate macros and remove comments
@@ -209,7 +212,7 @@ $(OBJDIR):
$(TOOLS_ATTR_DIR)/ppeCreateIfAttrService.pl $(PPE_FAPI2_DIR)/include $(IMPORT_XML_DIR)/p9_ppe_attributes.xml $(ATTRFILES)
mkdir -p $(OBJDIR)
-.PHONY: clean topfixedheaders $(PKLIB) $(P2PLIB) $(PPELIB) $(FAPI2LIB) $(CACHELIB) $(CORELIB) $(PERVLIB) $(NESTLIB) $(HWPLIB) buildInfo
+.PHONY: clean topfixedheaders $(PKLIB) $(P2PLIB) $(PPELIB) $(FAPI2LIB) $(CACHELIB) $(CORELIB) $(PERVLIB) $(NESTLIB) $(HWPLIB) buildInfo pibMemAttrSet
#errxml: topfixedheaders attrids platattr attrserv
@@ -326,6 +329,9 @@ tracehash:
mkdir -p $(OBJDIR)
$(THASH) -c -d $(OBJDIR) -s $(OBJDIR)/trexStringFile
+pibMemAttrSet:
+ $(TOOLS_IMAGE_DIR)/ppeSetFixedPibmem.pl $(IMPORT_XML_DIR)/p9_ppe_attributes.xml $(ATTRFILES)
+
#clean the kernel directory first, then the application level clean
clean:
rm -fr $(OBJDIR)
diff --git a/sbe/sbefw/sbefwfiles.mk b/sbe/sbefw/sbefwfiles.mk
index bc44e6bb..e8012cb7 100644
--- a/sbe/sbefw/sbefwfiles.mk
+++ b/sbe/sbefw/sbefwfiles.mk
@@ -8,6 +8,7 @@ SBEFW-CPP-SOURCES += sbecmdiplcontrol.C
SBEFW-CPP-SOURCES += pool.C
SBEFW-CPP-SOURCES += sbecmdgeneric.C
SBEFW-CPP-SOURCES += sbeFifoMsgUtils.C
+SBEFW-CPP-SOURCES += attr.C
SBEFW-C-SOURCES =
SBEFW-S-SOURCES =
diff --git a/sbe/sbefw/sbemain.C b/sbe/sbefw/sbemain.C
index a10c1799..88f0c770 100644
--- a/sbe/sbefw/sbemain.C
+++ b/sbe/sbefw/sbemain.C
@@ -17,7 +17,10 @@
#include "sbetrace.H"
#include "fapi2.H" // For target init
-
+// TODO via RTC 142365
+// Remove this workaround once we have support to copy fixed section
+// from SEEPROM to PIBMEM.
+extern void initAttrWA();
////////////////////////////////////////////////////////////////
// @brief Global semaphores
////////////////////////////////////////////////////////////////
@@ -297,6 +300,10 @@ uint32_t main(int argc, char **argv)
// enable FSP to get FFDC for this failure.
break;
}
+ // TODO via RTC 142365
+ // Remove this workaround once we have support to copy fixed section
+ // from SEEPROM to PIBMEM.
+ initAttrWA();
// Start running the highest priority thread.
// This function never returns
pk_start_threads();
diff --git a/tools/image/ppeSetFixedPibmem.pl b/tools/image/ppeSetFixedPibmem.pl
new file mode 100755
index 00000000..cbc5d24e
--- /dev/null
+++ b/tools/image/ppeSetFixedPibmem.pl
@@ -0,0 +1,212 @@
+#!/usr/bin/perl
+# Purpose: This perl script will parse the attribute and default list and
+# and set the default values into the image.
+# TODO via RTC 142365
+# Remove this file once we have support to copy fixed section
+# from SEEPROM to PIBMEM.
+
+use strict;
+
+
+#------------------------------------------------------------------------------
+my $numArgs = $#ARGV + 1;
+if ($numArgs < 2)
+{
+ print ("Usage: ppeSetFixedPibmem.pl <attributes and default list> <attribute file> ...\n");
+ print (" This perl script will the attributes and default list to lookup the defaults\n");
+ print (" and parse the attribute file to lookup the types.\n");
+ print (" The default values will be set in the image.\n");
+ print (" This is WORKAROUND\n");
+ print (". \\\n" );
+ exit(1);
+}
+
+#------------------------------------------------------------------------------
+# Specify perl modules to use
+#------------------------------------------------------------------------------
+use XML::Simple;
+my $xml = new XML::Simple (KeyAttr=>[]);
+
+
+my $xmlFiles = 0;
+my $attCount = 0;
+my $numIfAttrFiles = 0;
+my @attrSystemIds;
+my @attrChipIds;
+my @attrExIds;
+my @attrCoreIds;
+my @attrEqIds;
+my @attrPervIds;
+
+
+
+#------------------------------------------------------------------------------
+# Element names
+#------------------------------------------------------------------------------
+my $attribute = 'attribute';
+
+#------------------------------------------------------------------------------
+# For each argument
+#------------------------------------------------------------------------------
+my $argfile = $ARGV[0];
+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 (1 .. $#ARGV)
+ {
+ my $infile = $ARGV[$argnum];
+
+ if ( ! -e $infile) {die "ppeSetFixedPibmem.pl: $infile $!"};
+
+ my $attributes = $xml->XMLin($infile, ForceArray => ['attribute']);
+
+ #--------------------------------------------------------------------------
+ # For each Attribute
+ #--------------------------------------------------------------------------
+ foreach my $attr (@{$attributes->{attribute}})
+ {
+ if($attr->{id} eq $inname) {
+
+ #------------------------------------------------------------------
+ # Check that the AttributeId exists
+ #------------------------------------------------------------------
+ if (! exists $attr->{id})
+ {
+ print ("ppeSbeFixed.pl ERROR. Att 'id' missing\n");
+ exit(1);
+ }
+
+ if($attr->{targetType} eq "TARGET_TYPE_SYSTEM") {
+
+ push(@attrSystemIds, $entr);
+
+ } elsif($attr->{targetType} eq "TARGET_TYPE_PROC_CHIP") {
+
+ push(@attrChipIds, $entr);
+
+ } elsif($attr->{targetType} eq "TARGET_TYPE_CORE") {
+
+ push(@attrCoreIds, $entr);
+
+ } elsif($attr->{targetType} eq "TARGET_TYPE_EQ") {
+
+ push(@attrEqIds, $entr);
+
+ } elsif($attr->{targetType} eq "TARGET_TYPE_EX") {
+
+ push(@attrExIds, $entr);
+
+ } elsif($attr->{targetType} eq "TARGET_TYPE_PERV") {
+
+ push(@attrPervIds, $entr);
+
+ } else {
+
+ print ("ppeSetFixedPibmem.pl ERROR. Wrong attribute type: $attr->{targetType}\n");
+ exit(1);
+
+ }
+ }
+ }
+ }
+}
+my $file = "../sbefw/attr.C";
+unless(open FILE, '>'.$file) {
+#Die with error message
+ die "\nUnable to create $file\n";
+ }
+ #
+print FILE "#include <fapi2.H>\n";
+print FILE "extern fapi2attr::SystemAttributes_t G_system_attributes;\n";
+print FILE "extern fapi2attr::ProcChipAttributes_t G_proc_chip_attributes;\n";
+print FILE "extern fapi2attr::PervAttributes_t G_perv_attributes;\n";
+print FILE "extern fapi2attr::CoreAttributes_t G_core_attributes;\n";
+print FILE "extern fapi2attr::EQAttributes_t G_eq_attributes;\n";
+print FILE "extern fapi2attr::EXAttributes_t G_ex_attributes;\n";
+
+print FILE "void initAttrWA() \n";
+print FILE "{ \n";
+print FILE "////// workaround start \n";
+print FILE "#ifndef SBE_SEEPROM_FIXED_SECTION\n";
+
+
+setFixed("TARGET_TYPE_SYSTEM", @attrSystemIds);
+setFixed("TARGET_TYPE_PROC_CHIP", @attrChipIds);
+setFixed("TARGET_TYPE_CORE", @attrCoreIds);
+setFixed("TARGET_TYPE_EQ", @attrEqIds);
+setFixed("TARGET_TYPE_EX", @attrExIds);
+setFixed("TARGET_TYPE_PERV", @attrPervIds);
+print FILE "#endif //SBE_SEEPROM_FIXED_SECTION \n";
+print FILE "} \n";
+close FILE;
+
+
+sub setFixed {
+
+ my ($string, @entries) = @_;
+
+ foreach my $attr (@entries)
+ {
+
+ my $inname = $attr->{name};
+
+ my @values = $attr->{value};
+
+
+ if(scalar @values > 0) {
+ foreach my $val (@values)
+ {
+ my $prefixVal1 = "";
+
+ if($string eq "TARGET_TYPE_SYSTEM") {
+ $prefixVal1 = "G_system_attributes.fapi2attr::SystemAttributes_t::";
+ } elsif($string eq "TARGET_TYPE_PROC_CHIP") {
+ $prefixVal1 = "G_proc_chip_attributes.fapi2attr::ProcChipAttributes_t::";
+ } elsif($string eq "TARGET_TYPE_PERV") {
+ $prefixVal1 = "G_perv_attributes.fapi2attr::PervAttributes_t::";
+ } elsif($string eq "TARGET_TYPE_CORE") {
+ $prefixVal1 = "G_core_attributes.fapi2attr::CoreAttributes_t::";
+ } elsif($string eq "TARGET_TYPE_EQ") {
+ $prefixVal1 = "G_eq_attributes.fapi2attr::EQAttributes_t::";
+ } elsif($string eq "TARGET_TYPE_EX") {
+ $prefixVal1 = "G_ex_attributes.fapi2attr::EXAttributes_t::";
+ }
+ if(defined $val && ref($val) eq "") {
+
+ if ($val =~ /(0x)?[0-9a-fA-F]+/) {
+
+ my $line = "$prefixVal1$inname=$val;\n";
+ print FILE $line;
+ } else {
+ print ("ppeSetFixedPibmem.pl ERROR. not hex\n");
+ exit(1);
+ }
+
+ } elsif(defined $val && ref($val) eq "ARRAY") {
+
+ my $index = 0;
+
+ foreach my $arr (@{$val}) {
+
+ if(defined $arr && ref($arr) eq "") {
+ if ($arr =~ /(0x)?[0-9a-fA-F]+/) {
+
+ my $line = "$prefixVal1$inname\[$index\]=$arr;\n";
+ print FILE $line;
+
+ }
+ }
+ $index++;
+ }
+ }
+ }
+ }
+ }
+}
+
+
OpenPOWER on IntegriCloud