From 823e88ea2b81d927cbc4d5f09a26ebd3c1d0803e Mon Sep 17 00:00:00 2001 From: Derk Rembold Date: Wed, 24 Jun 2015 15:48:00 +0200 Subject: move xml files to importtemp directory included fixed sections default settings included fixed image generation. updated Makefile run sections Change-Id: I97547e339f5c956b31d444a74c6faa8159884072 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/18699 Reviewed-by: Gregory S. Still Reviewed-by: Derk Rembold Tested-by: Derk Rembold --- tools/image/ppeSetFixed.pl | 120 ++++++++++++++++------------ tools/image/sbe_xip_tool.c | 105 +++++++++++++++++++++++- tools/scripts/core_attributes.xml | 37 --------- tools/scripts/eq_attributes.xml | 14 ---- tools/scripts/ex_attributes.xml | 64 --------------- tools/scripts/p9_ppe_attributes.xml | 83 ------------------- tools/scripts/p9_ppe_attributes1.xml | 83 ------------------- tools/scripts/perv_attributes.xml | 44 ---------- tools/scripts/ppe_attributes.xml | 109 ------------------------- tools/scripts/proc_attributes.xml | 151 ----------------------------------- 10 files changed, 171 insertions(+), 639 deletions(-) mode change 100644 => 100755 tools/image/ppeSetFixed.pl delete mode 100644 tools/scripts/core_attributes.xml delete mode 100644 tools/scripts/eq_attributes.xml delete mode 100644 tools/scripts/ex_attributes.xml delete mode 100644 tools/scripts/p9_ppe_attributes.xml delete mode 100644 tools/scripts/p9_ppe_attributes1.xml delete mode 100644 tools/scripts/perv_attributes.xml delete mode 100644 tools/scripts/ppe_attributes.xml delete mode 100644 tools/scripts/proc_attributes.xml (limited to 'tools') diff --git a/tools/image/ppeSetFixed.pl b/tools/image/ppeSetFixed.pl old mode 100644 new mode 100755 index cd65761a..8d781d23 --- a/tools/image/ppeSetFixed.pl +++ b/tools/image/ppeSetFixed.pl @@ -4,6 +4,9 @@ use strict; +my $attrpath = "../../importtemp/xml"; +my $sbedefaultpath = "../../script/image"; + #------------------------------------------------------------------------------ # Print Command Line Help #------------------------------------------------------------------------------ @@ -15,9 +18,15 @@ if ($numArgs < 3) print (" and parse the attribute file to lookup the types.\n"); print (" The default values will be set in the image.\n"); print ("example:\n"); - print ("./ppeSetFixed.pl ./sbe_main.bin ../scripts/ppe_attributes.xml \\\n" ); - print ("../scripts/perv_attributes.xml ../scripts/proc_attributes.xml \\\n" ); - print ("../scripts/ex_attributes.xml ../scripts/eq_attributes.xml ../scripts/core_attributes.xml \n"); + print ("./ppeSetFixed.pl \\\n" ); + print (". \\\n" ); + print (" ../../sbe/obj/seeprom_main.bin \\\n" ); + print ("$attrpath/p9_ppe_attributes.xml \\\n" ); + print ("$attrpath/attribute_info/perv_attributes.xml \\\n" ); + print ("$attrpath/attribute_info/proc_attributes.xml \\\n" ); + print ("$attrpath/attribute_info/ex_attributes.xml \\\n" ); + print ("$attrpath/attribute_info/eq_attributes.xml \\\n" ); + print ("$attrpath/attribute_info/core_attributes.xml \n"); exit(1); } @@ -47,8 +56,9 @@ my $attribute = 'attribute'; #------------------------------------------------------------------------------ # For each argument #------------------------------------------------------------------------------ -my $image = $ARGV[0]; -my $argfile = $ARGV[1]; +my $sbedefaultpath = $ARGV[0]; +my $image = $ARGV[1]; +my $argfile = $ARGV[2]; my $entries = $xml->XMLin($argfile, ForceArray => ['entry']); if ( ! -e $image) {die "ppeSetFixed.pl: $image $!"}; @@ -60,7 +70,7 @@ foreach my $entr (@{$entries->{entry}}) { # 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) + foreach my $argnum (3 .. $#ARGV) { my $infile = $ARGV[$argnum]; @@ -130,63 +140,71 @@ setFixed("TARGET_TYPE_PERV", @attrPervIds); sub setFixed { - + my ($string, @entries) = @_; + +foreach my $attr (@entries) +{ + + my $inname = $attr->{name}; - foreach my $attr (@entries) + my @values = $attr->{value}; + + + if(scalar @values > 0) { + + foreach my $val (@values) { + + if(defined $val && ref($val) eq "") { + + if ($val =~ /(0x)?[0-9a-fA-F]+/) { + + my $systemRc = system("$sbedefaultpath/sbe_default_tool $image $inname $val $string 0"); - my $inname = $attr->{name}; - - my @values = $attr->{value}; - - - if(scalar @values > 0) { - - foreach my $val (@values) - { + if ($systemRc) { + print "sbe_default_tool: error in execution\n"; + exit 1; + } - if(defined $val && ref($val) eq "") { - - if ($val =~ /(0x)?[0-9a-fA-F]+/) { - - my $systemRc = system("./sbe_default_tool $image $inname $val $string 0"); - + } else { + print ("ppeSetFixed.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 $systemRc = system("$sbedefaultpath/sbe_default_tool $image $inname $arr $string $index"); + if ($systemRc) { print "sbe_default_tool: error in execution\n"; exit 1; } - - } else { - print ("ppeSetFixed.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 $systemRc = system("./sbe_default_tool $image $inname $arr $string $index"); - - if ($systemRc) { - print "sbe_default_tool: error in execution\n"; - exit 1; - } - - - } - } - $index++; - } - } + } + $index++; } - } + + + + } + + + } } + + +} + } diff --git a/tools/image/sbe_xip_tool.c b/tools/image/sbe_xip_tool.c index ae136858..195a29ef 100644 --- a/tools/image/sbe_xip_tool.c +++ b/tools/image/sbe_xip_tool.c @@ -37,6 +37,7 @@ // sbe_xip_tool [- ...] setv [ ... ] // sbe_xip_tool [- ...] report [] // sbe_xip_tool [- ...] append
+// sbe_xip_tool [- ...] extract
// sbe_xip_tool [- ...] delete [ ... ] // sbe_xip_tool [- ...] dis
\n"// // @@ -91,6 +92,8 @@ // section as the final section of the image. The 'append' command writes the // relocatable image address where the input file was loaded to stdout. // +// The 'extract' command extracts a sections from the binary image. +// // The 'delete' command deletes 0 or more sections, starting with . // Each section to be deleted must either be the final (highest address) // section of the image at the time it is deleted, or must be empty. The @@ -115,6 +118,7 @@ const char* g_usage = " sbe_xip_tool [-i ...] setv [ ... ]\n" " sbe_xip_tool [-i ...] report []\n" " sbe_xip_tool [-i ...] append
\n" +" sbe_xip_tool [-i ...] extract
\n" " sbe_xip_tool [-i ...] delete [ ... ]\n" " sbe_xip_tool [-i ...] dis
\n"//\n" "\n" @@ -169,6 +173,8 @@ const char* g_usage = "section as the final section of the image. The 'append' command writes the\n" "relocatable image address where the input file was loaded to stdout.\n" "\n" +"The 'extract' command extracs a sections from a binary image.\n" +"\n" "The 'delete' command deletes 0 or more sections, starting with .\n" "Each section to be deleted must either be the final (highest address)\n" "section of the image at the time it is deleted, or must be empty. The\n" @@ -458,6 +464,7 @@ report(void* io_image, const int i_argc, const char** i_argv) control.regex = 1; } else { control.regex = 0; + dumpHeader(io_image); printf("TOC Report\n\n"); } @@ -789,7 +796,6 @@ localStrtoul(const char* s) // Append a file to section - int append(const char* i_imageFile, const int i_imageFd, void* io_image, int i_argc, const char** i_argv) @@ -813,8 +819,7 @@ append(const char* i_imageFile, const int i_imageFd, void* io_image, } section = i_argv[0]; file = i_argv[1]; - - + // Translate the section name to a section Id for (sectionId = 0; sectionId < SBE_XIP_SECTIONS; sectionId++) { @@ -919,6 +924,95 @@ append(const char* i_imageFile, const int i_imageFd, void* io_image, return rc; } + +// Extract section from a file +int +extract(const char* i_imageFile, const int i_imageFd, void* io_image, + int i_argc, const char** i_argv) +{ + int fileFd, newImageFd, sectionId, rc; + void* newImage; + const char* section; + const char* file; + struct stat buf; + SbeXipHeader header; + SbeXipSection* xSection; + uint32_t size; + uint32_t offset; + unsigned int i; + + do { + + if (i_argc != 2) { + fprintf(stderr, g_usage); + exit(1); + } + section = i_argv[0]; + file = i_argv[1]; + + printf("%s %s\n", section , file); + + for (sectionId = 0; sectionId < SBE_XIP_SECTIONS; sectionId++) { + if (strcmp(section, g_sectionNames[sectionId]) == 0) { + break; + } + } + if (sectionId == SBE_XIP_SECTIONS) { + fprintf(stderr, "Unrecognized section name : '%s;\n", + section); + exit(1); + } + + sbe_xip_translate_header(&header, (SbeXipHeader*)io_image); + + for (i = 0; i < SBE_XIP_SECTIONS; i++) { + xSection = &(header.iv_section[i]); + + if (strcmp(section, g_sectionNames[i]) == 0) { + + size = xSection->iv_size; + offset = xSection->iv_offset; + + printf("%-16s 0x%08x 0x%08x (%d)\n", + g_sectionNames[i], + xSection->iv_offset, xSection->iv_size, xSection->iv_size); + + break; + } + } + + newImage = malloc(size); + + if (newImage == 0) { + fprintf(stderr, "Can't malloc() a buffer for the new image\n"); + exit(1); + } + + memcpy(newImage, (void*)((uint64_t)io_image + offset), size); + + fileFd = open(file, O_CREAT | O_WRONLY | O_TRUNC, 0755); + if (fileFd < 0) { + perror("open() of the fixed section : "); + exit(1); + } + + rc = write(fileFd, newImage, size); + if ((rc < 0) || ((uint32_t)rc != size)) { + perror("write() of fixed section : "); + exit(1); + } + + rc = close(fileFd); + if (rc) { + perror("close() of fixed section : "); + exit(1); + } + + } while (0); + + return rc; + +} // Delete 0 or more sections in order. @@ -1923,6 +2017,11 @@ command(const char* i_imageFile, const int i_argc, const char** i_argv, const ui openAndMapWritable(i_imageFile, &fd, &image, i_maskIgnores); rc = append(i_imageFile, fd, image, i_argc - 1, &(i_argv[1])); + } else if (strcmp(i_argv[0], "extract") == 0) { + + openAndMapWritable(i_imageFile, &fd, &image, i_maskIgnores); + rc = extract(i_imageFile, fd, image, i_argc - 1, &(i_argv[1])); + } else if (strcmp(i_argv[0], "delete") == 0) { openAndMapWritable(i_imageFile, &fd, &image, i_maskIgnores); diff --git a/tools/scripts/core_attributes.xml b/tools/scripts/core_attributes.xml deleted file mode 100644 index 8855ffa8..00000000 --- a/tools/scripts/core_attributes.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - ATTR_CORE_REPR_RING - TARGET_TYPE_CORE - - - uint32 - - - - - - - ATTR_CORE_TIME_RING - TARGET_TYPE_CORE - - - uint32 - - - - - - - ATTR_CORE_GPTR_RING - TARGET_TYPE_CORE - - - uint32 - - - - - - diff --git a/tools/scripts/eq_attributes.xml b/tools/scripts/eq_attributes.xml deleted file mode 100644 index 36c0c03a..00000000 --- a/tools/scripts/eq_attributes.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - ATTR_DPLL_RING - TARGET_TYPE_EQ - - - uint32 - - - - - diff --git a/tools/scripts/ex_attributes.xml b/tools/scripts/ex_attributes.xml deleted file mode 100644 index 98dbfefc..00000000 --- a/tools/scripts/ex_attributes.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - ATTR_L2_REPR_RING - TARGET_TYPE_EX - - - uint32 - - - - - - ATTR_L2_TIME_RING - TARGET_TYPE_EX - - - uint32 - - - - - - ATTR_L2_GPTR_RING - TARGET_TYPE_EX - - - uint32 - - - - - - ATTR_L3_REPR_RING - TARGET_TYPE_EX - - - uint32 - - - - - - ATTR_L3_TIME_RING - TARGET_TYPE_EX - - - uint32 - - - - - - ATTR_L3_GPTR_RING - TARGET_TYPE_EX - - - uint32 - - - - - diff --git a/tools/scripts/p9_ppe_attributes.xml b/tools/scripts/p9_ppe_attributes.xml deleted file mode 100644 index b119dc26..00000000 --- a/tools/scripts/p9_ppe_attributes.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - ATTR_SCRATCH_UINT8_1 - - - ATTR_SCRATCH_UINT8_2 - - - ATTR_SCRATCH_UINT32_1 - - - ATTR_SCRATCH_UINT32_2 - - - ATTR_SCRATCH_UINT64_1 - - - ATTR_SCRATCH_UINT64_2 - - - ATTR_SCRATCH_INT8_1 - - - ATTR_SCRATCH_INT8_2 - - - ATTR_SCRATCH_INT32_1 - - - ATTR_SCRATCH_INT32_2 - - - ATTR_SCRATCH_INT64_1 - - - ATTR_SCRATCH_INT64_2 - - - ATTR_REPR_RING - - - ATTR_TIME_RING - - - ATTR_GPTR_RING - - - ATTR_PLL_RING - - - ATTR_CORE_REPR_RING - - - ATTR_CORE_TIME_RING - - - ATTR_CORE_GPTR_RING - - - ATTR_L2_REPR_RING - - - ATTR_L2_TIME_RING - - - ATTR_L2_GPTR_RING - - - ATTR_L3_REPR_RING - - - ATTR_L3_TIME_RING - - - ATTR_L3_GPTR_RING - - - ATTR_DPLL_RING - - diff --git a/tools/scripts/p9_ppe_attributes1.xml b/tools/scripts/p9_ppe_attributes1.xml deleted file mode 100644 index b119dc26..00000000 --- a/tools/scripts/p9_ppe_attributes1.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - ATTR_SCRATCH_UINT8_1 - - - ATTR_SCRATCH_UINT8_2 - - - ATTR_SCRATCH_UINT32_1 - - - ATTR_SCRATCH_UINT32_2 - - - ATTR_SCRATCH_UINT64_1 - - - ATTR_SCRATCH_UINT64_2 - - - ATTR_SCRATCH_INT8_1 - - - ATTR_SCRATCH_INT8_2 - - - ATTR_SCRATCH_INT32_1 - - - ATTR_SCRATCH_INT32_2 - - - ATTR_SCRATCH_INT64_1 - - - ATTR_SCRATCH_INT64_2 - - - ATTR_REPR_RING - - - ATTR_TIME_RING - - - ATTR_GPTR_RING - - - ATTR_PLL_RING - - - ATTR_CORE_REPR_RING - - - ATTR_CORE_TIME_RING - - - ATTR_CORE_GPTR_RING - - - ATTR_L2_REPR_RING - - - ATTR_L2_TIME_RING - - - ATTR_L2_GPTR_RING - - - ATTR_L3_REPR_RING - - - ATTR_L3_TIME_RING - - - ATTR_L3_GPTR_RING - - - ATTR_DPLL_RING - - diff --git a/tools/scripts/perv_attributes.xml b/tools/scripts/perv_attributes.xml deleted file mode 100644 index 50c0f835..00000000 --- a/tools/scripts/perv_attributes.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - ATTR_REPR_RING - TARGET_TYPE_PERV - - - uint32 - - - - - - ATTR_TIME_RING - TARGET_TYPE_PERV - - - uint32 - - - - - - ATTR_GPTR_RING - TARGET_TYPE_PERV - - - uint32 - - - - - - ATTR_PLL_RING - TARGET_TYPE_PERV - - - uint32 - - - - - diff --git a/tools/scripts/ppe_attributes.xml b/tools/scripts/ppe_attributes.xml deleted file mode 100644 index 519dd321..00000000 --- a/tools/scripts/ppe_attributes.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - ATTR_SCRATCH_UINT8_1 - proc_attributes.xml - - - ATTR_SCRATCH_UINT8_2 - proc_attributes.xml - - - ATTR_SCRATCH_UINT32_1 - proc_attributes.xml - - - ATTR_SCRATCH_UINT32_2 - proc_attributes.xml - - - ATTR_SCRATCH_UINT64_1 - proc_attributes.xml - - - ATTR_SCRATCH_UINT64_2 - proc_attributes.xml - - - ATTR_SCRATCH_INT8_1 - proc_attributes.xml - - - ATTR_SCRATCH_INT8_2 - proc_attributes.xml - - - ATTR_SCRATCH_INT32_1 - proc_attributes.xml - - - ATTR_SCRATCH_INT32_2 - proc_attributes.xml - - - ATTR_SCRATCH_INT64_1 - proc_attributes.xml - - - ATTR_SCRATCH_INT64_2 - proc_attributes.xml - - - ATTR_REPR_RING - perv_attributes.xml - - - ATTR_TIME_RING - perv_attributes.xml - - - ATTR_GPTR_RING - perv_attributes.xml - - - ATTR_PLL_RING - perv_attributes.xml - - - ATTR_CORE_REPR_RING - core_attributes.xml - - - ATTR_CORE_TIME_RING - core_attributes.xml - - - ATTR_CORE_GPTR_RING - core_attributes.xml - - - ATTR_L2_REPR_RING - ex_attributes.xml - - - ATTR_L2_TIME_RING - ex_attributes.xml - - - ATTR_L2_GPTR_RING - ex_attributes.xml - - - ATTR_L3_REPR_RING - ex_attributes.xml - - - ATTR_L3_TIME_RING - ex_attributes.xml - - - ATTR_L3_GPTR_RING - ex_attributes.xml - - - ATTR_DPLL_RING - eq_attributes.xml - - diff --git a/tools/scripts/proc_attributes.xml b/tools/scripts/proc_attributes.xml deleted file mode 100644 index 4273a93f..00000000 --- a/tools/scripts/proc_attributes.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - - - ATTR_SCRATCH_UINT8_1 - TARGET_TYPE_PROC_CHIP - - - uint8 - - - - - - - ATTR_SCRATCH_UINT8_2 - TARGET_TYPE_PROC_CHIP - - - uint8 - - - - - - - ATTR_SCRATCH_UINT32_1 - TARGET_TYPE_PROC_CHIP - - - uint32 - - - - - - ATTR_SCRATCH_UINT32_2 - TARGET_TYPE_PROC_CHIP - - - uint32 - - - - - - ATTR_SCRATCH_UINT64_1 - TARGET_TYPE_PROC_CHIP - - - uint64 - - - - - - - ATTR_SCRATCH_UINT64_2 - TARGET_TYPE_PROC_CHIP - - - uint64 - VAL_A = 0, VAL_B = 5, VAL_C = 0xffffffffffffffff - - - - - - ATTR_SIGNED_TEST_8 - TARGET_TYPE_PROC_CHIP - - - int8 - - - - - - ATTR_SIGNED_TEST_64 - TARGET_TYPE_PROC_CHIP - - - int64 - - - - - - ATTR_SCRATCH_INT8_1 - TARGET_TYPE_PROC_CHIP - - - int8 - - - - - - ATTR_SCRATCH_INT8_2 - TARGET_TYPE_PROC_CHIP - - - int8 - - - - - - ATTR_SCRATCH_INT32_1 - TARGET_TYPE_PROC_CHIP - - - int32 - - - - - - - ATTR_SCRATCH_INT32_2 - TARGET_TYPE_PROC_CHIP - - - int32 - - - - - - - ATTR_SCRATCH_INT64_1 - TARGET_TYPE_PROC_CHIP - - - int64 - - - - - - ATTR_SCRATCH_INT64_2 - TARGET_TYPE_PROC_CHIP - - - int64 - VAL_A = 0, VAL_B = 5, VAL_C = 0xffffffffffffffff - - - - - -- cgit v1.2.1