From 7c73f96c7e3f309210d58332dc7f3fc4012118ef Mon Sep 17 00:00:00 2001 From: "Richard J. Knight" Date: Thu, 17 Jan 2013 14:15:52 -0600 Subject: Unload unused modules - simple version Created a list of dependant modules for each istep. modules for previous step are unloaded before loading the modules for new step Added perl script to validate istep dependancies during the build. Change-Id: Ia916814328ac37c24e4275ec42827520dada8686 RTC:51709 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/2979 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III --- config.mk | 3 + makefile | 22 +- src/build/tools/listdeps.pl | 389 ++++++++++++++++++++++ src/include/usr/isteps/istep06list.H | 15 +- src/include/usr/isteps/istep07list.H | 55 +-- src/include/usr/isteps/istep08list.H | 55 +-- src/include/usr/isteps/istep09list.H | 13 +- src/include/usr/isteps/istep10list.H | 57 ++-- src/include/usr/isteps/istep11list.H | 13 +- src/include/usr/isteps/istep12list.H | 56 ++-- src/include/usr/isteps/istep13list.H | 56 ++-- src/include/usr/isteps/istep14list.H | 56 ++-- src/include/usr/isteps/istep15list.H | 56 ++-- src/include/usr/isteps/istep16list.H | 13 +- src/include/usr/isteps/istep18list.H | 54 +-- src/include/usr/isteps/istep21list.H | 13 +- src/include/usr/isteps/istepmasterlist.H | 48 +-- src/usr/hwpf/hwp/dram_training/makefile | 31 +- src/usr/initservice/extinitsvc/extinitsvctasks.H | 38 +-- src/usr/initservice/istepdispatcher/istepWorker.C | 100 ++++++ 20 files changed, 853 insertions(+), 290 deletions(-) create mode 100755 src/build/tools/listdeps.pl diff --git a/config.mk b/config.mk index 4a11aaefe..834d730a4 100644 --- a/config.mk +++ b/config.mk @@ -398,6 +398,9 @@ ifdef OBJS rm ${OBJS:.o=.gcno} ${OBJS:.o=.gcda} -f endif +check_istep_modules: ${OBJS} + listdeps.pl ${IMGDIR} -v + cleanud : rm -f ${UD_OBJS} diff --git a/makefile b/makefile index 618d0f585..3fdd33b7d 100644 --- a/makefile +++ b/makefile @@ -1,29 +1,29 @@ # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. -# +# # $Source: makefile $ -# +# # IBM CONFIDENTIAL -# -# COPYRIGHT International Business Machines Corp. 2010,2012 -# +# +# COPYRIGHT International Business Machines Corp. 2010,2013 +# # p1 -# +# # Object Code Only (OCO) source materials # Licensed Internal Code Source Materials # IBM HostBoot Licensed Internal Code -# +# # The source code for this program is not published or otherwise # divested of its trade secrets, irrespective of what has been # deposited with the U.S. Copyright Office. -# +# # Origin: 30 -# -# IBM_PROLOG_END_TAG +# +# IBM_PROLOG_END_TAG SUBDIRS = src.d ROOTPATH = . -EXTRA_PARTS = ${GENDIR}/hwp_id.html cscope ctags +EXTRA_PARTS = ${GENDIR}/hwp_id.html check_istep_modules cscope ctags include ./config.mk diff --git a/src/build/tools/listdeps.pl b/src/build/tools/listdeps.pl new file mode 100755 index 000000000..b9c2f3675 --- /dev/null +++ b/src/build/tools/listdeps.pl @@ -0,0 +1,389 @@ +#!/usr/bin/perl +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/build/tools/listdeps.pl $ +# +# IBM CONFIDENTIAL +# +# COPYRIGHT International Business Machines Corp. 2013 +# +# p1 +# +# Object Code Only (OCO) source materials +# Licensed Internal Code Source Materials +# IBM HostBoot Licensed Internal Code +# +# The source code for this program is not published or otherwise +# divested of its trade secrets, irrespective of what has been +# deposited with the U.S. Copyright Office. +# +# Origin: 30 +# +# IBM_PROLOG_END_TAG +# +# 1. Create a hash with all library names and function names as the key-pair +# value. +# 2. Get a list of all undefined functions from the istep modules. +# 3. Figure out which libraries are required for each istep using the two lists +# above. +# +# NOTE: The script only checks the first level of dependency for each module. + +use strict; +use File::Find (); +use File::Path; +use Cwd; + +# validate the number of input args +if( $#ARGV == -1 || $#ARGV > 4 ) +{ + usage(); +} + +# return -1 if we fail validation, otherwise default to success +my $rc = 0; + +# directory where modules (.so's) are located, passed in from cmdline +my $image_directory = shift; + +if( $image_directory eq "-h" || $image_directory eq "--help") +{ + usage(); +} + +# the name of a specific module to check +my $module_to_check = ""; + +my $count = $#ARGV+2; + +# should we validate against the existing +# g_istepDep structure? +my $validate_deps = 0; + +# print out the depedancies for each module +my $print_deps = 0; + +# list all, event resident modules +my $list_all = 0; + +while ( $count ) +{ + $count--; + + my $arg = shift; + + next if( $arg eq "" ); + + if( $arg eq "-h" || $arg eq "--help") + { + usage(); + } + + if( $arg eq "-v" ) + { + $validate_deps = 1; + } + elsif( $arg eq "-p" ) + { + $print_deps = 1; + } + elsif( $arg eq "-All" ) + { + $list_all = 1; + } + else + { + $module_to_check = $arg; + } +} + +# dont allow a validation for list all option +if( $list_all && $validate_deps ) +{ + printf("\nSorry not able to validate non-istep modules please "); + printf("remove either the or the -All option and try again.\n\n"); + exit; +} + +# go to the image directory passed in +chdir "$image_directory"; + +my $module_name; +my $depends; +my %FunctionMap; + +#slurp in all the modules names from the img directory +my @module_names = < *.so >; + +# for each module, grab the defined functions and create a hash +# with the key being the function name and the value returned as the +# shared library where it is defined. +foreach $module_name (@module_names ) +{ + my @output = `ppc64-mcp6-nm -AD --defined-only $module_name`; + + chomp @output; + + foreach my $line (@output) + { + my @values = split(':', $line); + + my $library = $values[0]; + + @values = split( ' ' , $line ); + + my $function = $values[2]; + + %FunctionMap->{ $function } = $library; + } +} + +# if there was a library name passed in use that +# otherwise if they asked to list all dependencies +# then use the list we already created above, +# default is to the list required libs of istep modules +my @istep_modules = (); + +if( $module_to_check ) +{ + @istep_modules = ( $module_to_check ); +} +elsif ( $list_all ) +{ + @istep_modules = @module_names; +} +else +{ + @istep_modules = ( + "libslave_sbe.so", + "libnest_chiplets.so" , + "libedi_ei_initialization.so" , + "libactivate_powerbus.so" , + "libmc_config.so" , + "libdram_training.so" , + "libdram_initialization.so" , + "libsbe_centaur_init.so" , + "libdmi_training.so" , + "libbuild_winkle_images.so" , + "libcore_activate.so" , + "libestablish_system_smp.so" , + "libstart_payload.so" , + ); +} + +# list of libs which are not unloaded +my %resident_modules = ( + "libtargeting.so" => '1', + "libhwas.so" => '1' , + "libdevicefw.so" => '1', + "liberrl.so" => '1', + "libtrace.so" => '1', + "libvfs.so" => '1', + "libfapi.so" => '1', + "libecmddatabuffer.so" => '1', + "libpnor.so" => '1', + "libmbox.so" => '1', + "libinitservice.so" => '1', + "libistepdisp.so" => '1', + "libextinitsvc.so" => '1', + "libplat.so" => '1', + "libhwp.so" => '1', + "libbus_training.so" => '1', + "libintr.so" => '1', + "libprdf.so" => '1', + "libmdia.so" => '1', + "libattn.so" => '1', + "libi2c.so" => '1', + +); + +# has with library to istep list file were the DepMod array is kept +my %istepFiles = ( + "libslave_sbe.so" => "istep06list.H" , + "libnest_chiplets.so" => "istep07list.H" , + "libedi_ei_initialization.so" => "istep08list.H" , + "libactivate_powerbus.so" => "istep09list.H" , + "libsbe_centaur_init.so" => "istep10list.H" , + "libdmi_training.so" => "istep11list.H" , + "libmc_config.so" => "istep12list.H" , + "libdram_training.so" => "istep13list.H" , + "libdram_initialization.so" => "istep14list.H" , + "libbuild_winkle_images.so" => "istep15list.H" , + "libcore_activate.so" => "istep16list.H" , + "libestablish_system_smp.so" => "istep18list.H" , + "libstart_payload.so" => "istep21list.H" , +); + +# array to hold list of dependent libraries +my @Dependencies; + +# hash to help with unique module names +my %seen = (); + +foreach my $module_name (@istep_modules ) +{ + if( $list_all ) + { + %seen = (); + } + else + { + %seen = %resident_modules; + } + + @Dependencies = (); + + # the library will have a dependency on itself + push(@Dependencies, $module_name); + + # get an array with all the undefined functions from this module + my @output = `ppc64-mcp6-nm --undefined-only $module_name`; + + chomp @output; + + foreach my $line (@output) + { + my @values = split( ' ' , $line ); + + my $elem = $values[1]; + + my $lib = %FunctionMap->{ $elem}; + + # if we have this module in our "seen it" array, just skip it + # otherwise we will add it as a new dependency + next if $seen{ $lib }++; + push @Dependencies, $lib; + + } + + # should we validate? + if( $validate_deps ) + { + validate( $module_name, %istepFiles->{$module_name} ); + } + + # does user want us to print the dependencies to the screen? + if( $print_deps ) + { + # print out the list of dependencies for this + # particular library + print ( "$module_name requires => \n"); + + foreach my $required_lib ( @Dependencies ) + { + $_ = $required_lib; + next if ( m/test/ ); + next if ( !m/lib/ ); + if( $list_all ) + { + # just print it for looking.. + print "\t\t$required_lib\n"; + } + else + { + #format so I can cut and paste + print "\t\tDEP_LIB($required_lib),\n"; + } + } + print "\n"; + } +} + +exit($rc); + +#/====================== S U B R O U T I N E S ===============================/ + +# validate the current dependencies for the passed in module name +# NOTE: the @Dependencies array is a global constructed above. +sub validate +{ + my @list = (); + + my ($module, $istepFile ) = @_; + + my $path = "../src/include/usr/isteps/"; + + my $file = $path . $istepFile; + + open FILE, "< $file" or die $!; + + # read the file one line at a time until we find the + # spot we are looking for + while() + { + my $line = $_; + next if ( !m/DEP_LIB/ ); + chomp($line); + $line =~ s/^\s*(.*?)\s*$/$1/; + $line =~s/DEP_LIB\(//; + $line =~s/\),//; + #print "$line\n"; + push( @list,$line); + # we are at the start of the dependencies list + # lets go into a new read till we find the closing + # bracket of the array; + while() + { + my $line = $_; + chomp($line); + last if( m/\}/ ); + $line =~ s/^\s*(.*?)\s*$/$1/; + $line =~s/DEP_LIB\(//; + $line =~s/\),//; + # print "$line\n"; + push( @list, $line ); + } + if( @list > 4 ) + { + print "\n-- WARNING -- too many dependencies listed (MAX=4) in"; + print " src/include/usr/isteps/$istepFile\n\n"; + } + } + + # ok we have a list of dependencys from the actual istepXXlist.H file + # convert array to a hash with the array elements as the hash keys, + # the value is not important, so I set them all to 1 + my %ListedDeps = map {$_ => 1} @list; + + foreach my $match ( @Dependencies ) + { + # check if the there exists a match + if ( !(defined $ListedDeps{$match}) && ($match) && + !(defined $resident_modules{ $match } ) ) + { + print "$module is MISSING DEPENDENCY $match\n"; + print "\nplease add \"DEP_LIB($match),\""; + print " to src/include/usr/isteps/$istepFile\n\n"; + $rc = -1; + } + } + + close FILE; +} + +# the help text +sub usage +{ + print "Usage:\n"; + print "\t$0 [ module to check ]\n\n"; + + print "Example: to list all istep modules and dependencies.\n"; + print "\n\t$0 ~/my-hostboot-repo/img -p \n\n"; + + print "Example: to validate all istep modules and top level dependencies.\n"; + print "\n\t$0 ~/my-hostboot-repo/img -v \n\n"; + + + print "Example: to list the dependencies for a specific module.\n"; + print "\n\t$0 ~/my-hostboot-repo/img libslave_sbe.so \n\n"; + + print "-v will validate existing istep dependencies\n"; + print "-p will print dependency requirements\n"; + print "-All will print all dependency requirements (not just istep modules)\n"; + print "requires the -p option.\n\n"; + + exit 0; +} + + diff --git a/src/include/usr/isteps/istep06list.H b/src/include/usr/isteps/istep06list.H index 1d1e39928..ec2173ada 100644 --- a/src/include/usr/isteps/istep06list.H +++ b/src/include/usr/isteps/istep06list.H @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2012 */ +/* COPYRIGHT International Business Machines Corp. 2011,2013 */ /* */ /* p1 */ /* */ @@ -213,12 +213,21 @@ const TaskInfo g_istep06[] = { // END OF LIST! }; + +const DepModInfo g_istep06Dependancies = { + { + DEP_LIB(libslave_sbe.so), + { 0 }, + } +}; + // make a struct from the above with the number of items included const ExtTaskInfo g_istep06TaskList = { &(g_istep06[0]), ( sizeof(g_istep06)/sizeof(TaskInfo) ), - NULL -}; + &(g_istep06Dependancies), + }; + }; // end namespace diff --git a/src/include/usr/isteps/istep07list.H b/src/include/usr/isteps/istep07list.H index dfaa26676..41b95117b 100644 --- a/src/include/usr/isteps/istep07list.H +++ b/src/include/usr/isteps/istep07list.H @@ -1,26 +1,25 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/include/usr/isteps/istep07list.H $ - * - * IBM CONFIDENTIAL - * - * COPYRIGHT International Business Machines Corp. 2012 - * - * p1 - * - * Object Code Only (OCO) source materials - * Licensed Internal Code Source Materials - * IBM HostBoot Licensed Internal Code - * - * The source code for this program is not published or other- - * wise divested of its trade secrets, irrespective of what has - * been deposited with the U.S. Copyright Office. - * - * Origin: 30 - * - * IBM_PROLOG_END_TAG - */ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/isteps/istep07list.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __ISTEPS_ISTEP07LIST_H #define __ISTEPS_ISTEP07LIST_H @@ -163,11 +162,19 @@ namespace INITSERVICE // END OF LIST! }; + +const DepModInfo g_istep07Dependancies = { + { + DEP_LIB(libnest_chiplets.so), + { 0 }, + } +}; + // make a struct from the above with the number of items included const ExtTaskInfo g_istep07TaskList = { &(g_istep07[0]), ( sizeof(g_istep07)/sizeof(TaskInfo) ), - NULL // later, depModules struct + &g_istep07Dependancies // later, depModules struct }; }; // end namespace diff --git a/src/include/usr/isteps/istep08list.H b/src/include/usr/isteps/istep08list.H index ec8ce8e75..94116142c 100644 --- a/src/include/usr/isteps/istep08list.H +++ b/src/include/usr/isteps/istep08list.H @@ -1,26 +1,25 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/include/usr/isteps/istep08list.H $ - * - * IBM CONFIDENTIAL - * - * COPYRIGHT International Business Machines Corp. 2012 - * - * p1 - * - * Object Code Only (OCO) source materials - * Licensed Internal Code Source Materials - * IBM HostBoot Licensed Internal Code - * - * The source code for this program is not published or other- - * wise divested of its trade secrets, irrespective of what has - * been deposited with the U.S. Copyright Office. - * - * Origin: 30 - * - * IBM_PROLOG_END_TAG - */ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/isteps/istep08list.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __ISTEPS_ISTEP08LIST_H #define __ISTEPS_ISTEP08LIST_H @@ -177,11 +176,19 @@ namespace INITSERVICE // END OF LIST! }; +const DepModInfo g_istep08Dependancies = { + { + DEP_LIB(libedi_ei_initialization.so), + DEP_LIB(libdmi_training.so), + { 0 }, + } +}; + // make a struct from the above with the number of items included const ExtTaskInfo g_istep08TaskList = { &(g_istep08[0]), ( sizeof(g_istep08)/sizeof(TaskInfo) ), - NULL // later, depModules struct + &g_istep08Dependancies // later, depModules struct }; }; // end namespace diff --git a/src/include/usr/isteps/istep09list.H b/src/include/usr/isteps/istep09list.H index 29555205a..a273d58bc 100644 --- a/src/include/usr/isteps/istep09list.H +++ b/src/include/usr/isteps/istep09list.H @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012 */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ /* */ /* p1 */ /* */ @@ -91,11 +91,20 @@ namespace INITSERVICE // END OF LIST! }; +const DepModInfo g_istep09Dependancies = { + { + DEP_LIB(libactivate_powerbus.so), + DEP_LIB(libdram_initialization.so), + { 0 }, + } +}; + + // make a struct from the above with the number of items included const ExtTaskInfo g_istep09TaskList = { &(g_istep09[0]), ( sizeof(g_istep09)/sizeof(TaskInfo) ), - NULL // later, depModules struct + &g_istep09Dependancies // later, depModules struct }; }; // end namespace diff --git a/src/include/usr/isteps/istep10list.H b/src/include/usr/isteps/istep10list.H index 350c23445..4b554284e 100644 --- a/src/include/usr/isteps/istep10list.H +++ b/src/include/usr/isteps/istep10list.H @@ -1,26 +1,25 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/include/usr/isteps/istep10list.H $ - * - * IBM CONFIDENTIAL - * - * COPYRIGHT International Business Machines Corp. 2012 - * - * p1 - * - * Object Code Only (OCO) source materials - * Licensed Internal Code Source Materials - * IBM HostBoot Licensed Internal Code - * - * The source code for this program is not published or other- - * wise divested of its trade secrets, irrespective of what has - * been deposited with the U.S. Copyright Office. - * - * Origin: 30 - * - * IBM_PROLOG_END_TAG - */ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/isteps/istep10list.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __ISTEPS_ISTEP10LIST_H #define __ISTEPS_ISTEP10LIST_H @@ -233,11 +232,21 @@ const TaskInfo g_istep10[] = { // END OF LIST! }; +const DepModInfo g_istep10Dependancies = { + { + DEP_LIB(libsbe_centaur_init.so), + DEP_LIB(libfapiporeve.so), + DEP_LIB(libporeve.so), + { 0 }, + } +}; + + // make a struct from the above with the number of items included const ExtTaskInfo g_istep10TaskList = { &(g_istep10[0]), ( sizeof(g_istep10)/sizeof(TaskInfo) ), - NULL + &g_istep10Dependancies }; }; // end namespace diff --git a/src/include/usr/isteps/istep11list.H b/src/include/usr/isteps/istep11list.H index 18c450943..408a94a89 100644 --- a/src/include/usr/isteps/istep11list.H +++ b/src/include/usr/isteps/istep11list.H @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2012 */ +/* COPYRIGHT International Business Machines Corp. 2011,2013 */ /* */ /* p1 */ /* */ @@ -210,11 +210,20 @@ const TaskInfo g_istep11[] = { // END OF LIST! }; +const DepModInfo g_istep11Dependancies = { + { + DEP_LIB(libdmi_training.so), + DEP_LIB(libedi_ei_initialization.so), + { 0 }, + } +}; + + // make a struct from the above with the number of items included const ExtTaskInfo g_istep11TaskList = { &(g_istep11[0]), ( sizeof(g_istep11)/sizeof(TaskInfo) ), - NULL + &g_istep11Dependancies }; }; // end namespace diff --git a/src/include/usr/isteps/istep12list.H b/src/include/usr/isteps/istep12list.H index 2a4caac6b..f980e7a44 100644 --- a/src/include/usr/isteps/istep12list.H +++ b/src/include/usr/isteps/istep12list.H @@ -1,26 +1,25 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/include/usr/isteps/istep12list.H $ - * - * IBM CONFIDENTIAL - * - * COPYRIGHT International Business Machines Corp. 2012 - * - * p1 - * - * Object Code Only (OCO) source materials - * Licensed Internal Code Source Materials - * IBM HostBoot Licensed Internal Code - * - * The source code for this program is not published or other- - * wise divested of its trade secrets, irrespective of what has - * been deposited with the U.S. Copyright Office. - * - * Origin: 30 - * - * IBM_PROLOG_END_TAG - */ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/isteps/istep12list.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __ISTEPS_ISTEP12LIST_H #define __ISTEPS_ISTEP12LIST_H @@ -113,11 +112,20 @@ const TaskInfo g_istep12[] = { // END OF LIST! }; +const DepModInfo g_istep12Dependancies = { + { + DEP_LIB(libmc_config.so), + { 0 }, + } +}; + + + // make a struct from the above with the number of items included const ExtTaskInfo g_istep12TaskList = { &(g_istep12[0]), ( sizeof(g_istep12)/sizeof(TaskInfo) ), - NULL // later, depModules struct + &g_istep12Dependancies // later, depModules struct }; }; // end namespace diff --git a/src/include/usr/isteps/istep13list.H b/src/include/usr/isteps/istep13list.H index 13a8ec457..655975ad1 100644 --- a/src/include/usr/isteps/istep13list.H +++ b/src/include/usr/isteps/istep13list.H @@ -1,26 +1,25 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/include/usr/isteps/istep13list.H $ - * - * IBM CONFIDENTIAL - * - * COPYRIGHT International Business Machines Corp. 2012 - * - * p1 - * - * Object Code Only (OCO) source materials - * Licensed Internal Code Source Materials - * IBM HostBoot Licensed Internal Code - * - * The source code for this program is not published or other- - * wise divested of its trade secrets, irrespective of what has - * been deposited with the U.S. Copyright Office. - * - * Origin: 30 - * - * IBM_PROLOG_END_TAG - */ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/isteps/istep13list.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __ISTEPS_ISTEP13LIST_H #define __ISTEPS_ISTEP13LIST_H @@ -198,11 +197,20 @@ const TaskInfo g_istep13[] = { // END OF LIST! }; +const DepModInfo g_istep13Dependancies = { + { + DEP_LIB(libdram_training.so), + { 0 }, + } +}; + + + // make a struct from the above with the number of items included const ExtTaskInfo g_istep13TaskList = { &(g_istep13[0]), ( sizeof(g_istep13)/sizeof(TaskInfo) ), - NULL // later, depModules struct + &g_istep13Dependancies // later, depModules struct }; }; // end namespace diff --git a/src/include/usr/isteps/istep14list.H b/src/include/usr/isteps/istep14list.H index 5880313ed..5aa93574c 100644 --- a/src/include/usr/isteps/istep14list.H +++ b/src/include/usr/isteps/istep14list.H @@ -1,26 +1,25 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/include/usr/isteps/istep14list.H $ - * - * IBM CONFIDENTIAL - * - * COPYRIGHT International Business Machines Corp. 2012 - * - * p1 - * - * Object Code Only (OCO) source materials - * Licensed Internal Code Source Materials - * IBM HostBoot Licensed Internal Code - * - * The source code for this program is not published or other- - * wise divested of its trade secrets, irrespective of what has - * been deposited with the U.S. Copyright Office. - * - * Origin: 30 - * - * IBM_PROLOG_END_TAG - */ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/isteps/istep14list.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __ISTEPS_ISTEP14LIST_H #define __ISTEPS_ISTEP14LIST_H @@ -180,11 +179,20 @@ namespace INITSERVICE // END OF LIST! }; +const DepModInfo g_istep14Dependancies = { + { + DEP_LIB(libdram_initialization.so), + { 0 }, + } +}; + + + // make a struct from the above with the number of items included const ExtTaskInfo g_istep14TaskList = { &(g_istep14[0]), ( sizeof(g_istep14)/sizeof(TaskInfo) ), - NULL // later, depModules struct + &g_istep14Dependancies // later, depModules struct }; }; // end namespace diff --git a/src/include/usr/isteps/istep15list.H b/src/include/usr/isteps/istep15list.H index 04c6cd908..e79fb360b 100644 --- a/src/include/usr/isteps/istep15list.H +++ b/src/include/usr/isteps/istep15list.H @@ -1,26 +1,25 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/include/usr/isteps/istep15list.H $ - * - * IBM CONFIDENTIAL - * - * COPYRIGHT International Business Machines Corp. 2012 - * - * p1 - * - * Object Code Only (OCO) source materials - * Licensed Internal Code Source Materials - * IBM HostBoot Licensed Internal Code - * - * The source code for this program is not published or other- - * wise divested of its trade secrets, irrespective of what has - * been deposited with the U.S. Copyright Office. - * - * Origin: 30 - * - * IBM_PROLOG_END_TAG - */ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/isteps/istep15list.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __ISTEPS_ISTEP15LIST_H #define __ISTEPS_ISTEP15LIST_H @@ -99,11 +98,20 @@ namespace INITSERVICE // END OF LIST! }; + +const DepModInfo g_istep15Dependancies = { + { + DEP_LIB(libbuild_winkle_images.so), + { 0 }, + } +}; + + // make a struct from the above with the number of items included const ExtTaskInfo g_istep15TaskList = { &(g_istep15[0]), ( sizeof(g_istep15)/sizeof(TaskInfo) ), - NULL // later, depModules struct + &g_istep15Dependancies // later, depModules struct }; }; // end namespace diff --git a/src/include/usr/isteps/istep16list.H b/src/include/usr/isteps/istep16list.H index 05fd5615a..77c9bcaa9 100644 --- a/src/include/usr/isteps/istep16list.H +++ b/src/include/usr/isteps/istep16list.H @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012 */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ /* */ /* p1 */ /* */ @@ -107,11 +107,20 @@ namespace INITSERVICE // END OF LIST! }; +const DepModInfo g_istep16Dependancies = { + { + DEP_LIB(libcore_activate.so), + DEP_LIB(libbuild_winkle_images.so), + { 0 }, + } +}; + + // make a struct from the above with the number of items included const ExtTaskInfo g_istep16TaskList = { &(g_istep16[0]), ( sizeof(g_istep16)/sizeof(TaskInfo) ), - NULL // later, depModules struct + &g_istep16Dependancies // later, depModules struct }; }; // end namespace diff --git a/src/include/usr/isteps/istep18list.H b/src/include/usr/isteps/istep18list.H index 81cb1271a..beea51552 100644 --- a/src/include/usr/isteps/istep18list.H +++ b/src/include/usr/isteps/istep18list.H @@ -1,26 +1,25 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/include/usr/isteps/istep18list.H $ - * - * IBM CONFIDENTIAL - * - * COPYRIGHT International Business Machines Corp. 2012 - * - * p1 - * - * Object Code Only (OCO) source materials - * Licensed Internal Code Source Materials - * IBM HostBoot Licensed Internal Code - * - * The source code for this program is not published or other- - * wise divested of its trade secrets, irrespective of what has - * been deposited with the U.S. Copyright Office. - * - * Origin: 30 - * - * IBM_PROLOG_END_TAG - */ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/isteps/istep18list.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __ISTEPS_ISTEP18LIST_H #define __ISTEPS_ISTEP18LIST_H @@ -178,11 +177,18 @@ namespace INITSERVICE // END OF LIST! }; +const DepModInfo g_istep18Dependancies = { + { + DEP_LIB(libestablish_system_smp.so), + { 0 }, + } +}; + // make a struct from the above with the number of items included const ExtTaskInfo g_istep18TaskList = { &(g_istep18[0]), ( sizeof(g_istep18)/sizeof(TaskInfo) ), - NULL // later, depModules struct + &g_istep18Dependancies // later, depModules struct }; }; // end namespace diff --git a/src/include/usr/isteps/istep21list.H b/src/include/usr/isteps/istep21list.H index 4256b47ca..0d0f6108a 100644 --- a/src/include/usr/isteps/istep21list.H +++ b/src/include/usr/isteps/istep21list.H @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012 */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ /* */ /* p1 */ /* */ @@ -103,11 +103,20 @@ namespace INITSERVICE // END OF LIST! }; +const DepModInfo g_istep21Dependancies = { + { + DEP_LIB(libstart_payload.so), + DEP_LIB(libruntime.so), + { 0 }, + } +}; + + // make a struct from the above with the number of items included const ExtTaskInfo g_istep21TaskList = { &(g_istep21[0]), ( sizeof(g_istep21)/sizeof(TaskInfo) ), - NULL // later, depModules struct + &g_istep21Dependancies // later, depModules struct }; }; // end namespace diff --git a/src/include/usr/isteps/istepmasterlist.H b/src/include/usr/isteps/istepmasterlist.H index 902ba4277..74b296be8 100644 --- a/src/include/usr/isteps/istepmasterlist.H +++ b/src/include/usr/isteps/istepmasterlist.H @@ -1,26 +1,25 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/include/usr/isteps/istepmasterlist.H $ - * - * IBM CONFIDENTIAL - * - * COPYRIGHT International Business Machines Corp. 2011-2012 - * - * p1 - * - * Object Code Only (OCO) source materials - * Licensed Internal Code Source Materials - * IBM HostBoot Licensed Internal Code - * - * The source code for this program is not published or other- - * wise divested of its trade secrets, irrespective of what has - * been deposited with the U.S. Copyright Office. - * - * Origin: 30 - * - * IBM_PROLOG_END_TAG - */ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/isteps/istepmasterlist.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2011,2013 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __ISTEPS_ISTEPMASTERLIST_H #define __ISTEPS_ISTEPMASTERLIST_H @@ -56,6 +55,9 @@ #include #include +// macro to expand library dependancies +#define DEP_LIB(x) { #x } + // ----- istep include files ----- // isteps 1-5 run before hostboot diff --git a/src/usr/hwpf/hwp/dram_training/makefile b/src/usr/hwpf/hwp/dram_training/makefile index 4c0ab9d0e..e251b81e7 100644 --- a/src/usr/hwpf/hwp/dram_training/makefile +++ b/src/usr/hwpf/hwp/dram_training/makefile @@ -1,25 +1,25 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. # -# $Source: src/usr/hwpf/hwp/dram_training/makefile $ +# $Source: src/usr/hwpf/hwp/dram_training/makefile $ # -# IBM CONFIDENTIAL +# IBM CONFIDENTIAL # -# COPYRIGHT International Business Machines Corp. 2012 +# COPYRIGHT International Business Machines Corp. 2012,2013 # -# p1 +# p1 # -# Object Code Only (OCO) source materials -# Licensed Internal Code Source Materials -# IBM HostBoot Licensed Internal Code +# Object Code Only (OCO) source materials +# Licensed Internal Code Source Materials +# IBM HostBoot Licensed Internal Code # -# The source code for this program is not published or other- -# wise divested of its trade secrets, irrespective of what has -# been deposited with the U.S. Copyright Office. +# The source code for this program is not published or otherwise +# divested of its trade secrets, irrespective of what has been +# deposited with the U.S. Copyright Office. # -# Origin: 30 +# Origin: 30 # -# IBM_PROLOG_END_TAG +# IBM_PROLOG_END_TAG ROOTPATH = ../../../../.. MODULE = dram_training @@ -53,7 +53,6 @@ EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/dram_training/mss_draminit_trainadv OBJS = dram_training.o \ mss_draminit.o \ mss_funcs.o \ - mss_unmask_errors.o \ mss_draminit_mc.o \ mss_draminit_training.o \ mss_ddr_phy_reset.o \ @@ -68,7 +67,7 @@ OBJS = dram_training.o \ mss_mcbist.o \ mss_mcbist_common.o\ hbVddrMsg.o - + ## NOTE: add a new directory onto the vpaths when you add a new HWP ##@ VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/??? VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/dram_training/mss_draminit_training diff --git a/src/usr/initservice/extinitsvc/extinitsvctasks.H b/src/usr/initservice/extinitsvc/extinitsvctasks.H index 1ae0d4932..b3f4912f8 100644 --- a/src/usr/initservice/extinitsvc/extinitsvctasks.H +++ b/src/usr/initservice/extinitsvc/extinitsvctasks.H @@ -176,16 +176,10 @@ const TaskInfo g_exttaskinfolist[] = { EXT_IMAGE, // Extended Module } }, - -// TODO: Added this in order to successfull init.. Need to remove this and put -// the module load and unload from a the istep dispatcher -// PW - Is this really TODO? Don't we need the hwas module from errl to do -// gard / deconfig? /** * @brief HWAS, + * need the hwas module for errl dependency gard / deconfig */ - - { "libhwas.so" , // taskname NULL, // no pointer to fn @@ -194,8 +188,6 @@ const TaskInfo g_exttaskinfolist[] = { EXT_IMAGE, // Extended Module } }, -// end TODO - /** * @brief ecmddatabuffer task, */ @@ -264,31 +256,6 @@ const TaskInfo g_exttaskinfolist[] = { } }, -// TODO: Should these be automatically loaded / unloaded by istepdispatcher? - /** - * @brief VSBE FAPI interface code library. - */ - { - "libfapiporeve.so" , // taskname - NULL, // no pointer to fn - { - INIT_TASK, // task type - EXT_IMAGE, // Extended Module - } - }, - - /** - * @brief VSBE code library - */ - { - "libporeve.so" , // taskname - NULL, // no pointer to fn - { - INIT_TASK, // task type - EXT_IMAGE, // Extended Module - } - }, - /** * @brief bus_training library. */ @@ -337,9 +304,6 @@ const TaskInfo g_exttaskinfolist[] = { } }, - -// end TODO. - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // NOTE: libistepdisp.so needs to always be last in this list!! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/src/usr/initservice/istepdispatcher/istepWorker.C b/src/usr/initservice/istepdispatcher/istepWorker.C index 0a42be139..cbf76a76c 100644 --- a/src/usr/initservice/istepdispatcher/istepWorker.C +++ b/src/usr/initservice/istepdispatcher/istepWorker.C @@ -35,6 +35,7 @@ #include #include +#include #include @@ -65,6 +66,8 @@ namespace INITSERVICE extern trace_desc_t *g_trac_initsvc; bool getSyncEnabledAttribute(); +void loadModules( uint32_t istep ); +void unLoadModules( uint32_t istep ); // ---------------------------------------------------------------------------- // startIStepWorkerThread @@ -98,6 +101,7 @@ void iStepWorkerThread ( void * i_msgQ ) msg_t * theMsg = NULL; uint32_t istep = 0x0; uint32_t substep = 0x0; + uint32_t prevStep = 0x0; uint64_t progressCode = 0x0; bool first = true; @@ -150,6 +154,7 @@ void iStepWorkerThread ( void * i_msgQ ) istep = ((theMsg->data[0] & 0xFF00) >> 8); substep = (theMsg->data[0] & 0xFF); + // Post the Progress Code // TODO - Covered with RTC: 34046 InitService::getTheInstance().setProgressCode( progressCode ); @@ -158,6 +163,16 @@ void iStepWorkerThread ( void * i_msgQ ) const TaskInfo * theStep = findTaskInfo( istep, substep ); + if( prevStep != istep ) + { + // unload the modules from the previous step + unLoadModules( prevStep ); + // load modules for this step + loadModules( istep ); + prevStep = istep; + } + + if( NULL != theStep ) { TRACFCOMP( g_trac_initsvc, @@ -165,6 +180,7 @@ void iStepWorkerThread ( void * i_msgQ ) "- %s", istep, substep, theStep->taskname ); + err = InitService::getTheInstance().executeFn( theStep, NULL ); @@ -213,6 +229,7 @@ void iStepWorkerThread ( void * i_msgQ ) theStep->taskname); } } + } else { @@ -264,6 +281,89 @@ void iStepWorkerThread ( void * i_msgQ ) } +// load module routine used in simple temp solution +// for module management +void loadModules( uint32_t istepNumber ) +{ + errlHndl_t l_errl = NULL; + do + { + // if no dep modules then just exit out, let the call to + // executeFN load the module based on the function being + // called. + if( g_isteps[istepNumber].depModules == NULL) + { + TRACDCOMP( g_trac_initsvc, + "g_isteps[%d].depModules == NULL", + i_IStep ); + break; + } + uint32_t i = 0; + + while( ( l_errl == NULL ) && + ( g_isteps[istepNumber].depModules->modulename[i][0] != 0) ) + { + TRACFCOMP( g_trac_initsvc, + "loading [%s]", + g_isteps[istepNumber].depModules->modulename[i]); + + l_errl = VFS::module_load( + g_isteps[istepNumber].depModules->modulename[i] ); + i++; + } + + if( l_errl ) + { + errlCommit( l_errl, ISTEP_COMP_ID ); + assert(0); + } + + }while(0); +} + + +// unload module routine used in simple temp solution +// for module management +void unLoadModules( uint32_t istepNumber ) +{ + errlHndl_t l_errl = NULL; + + do + { + // if no dep modules then just exit out + if( g_isteps[istepNumber].depModules == NULL) + { + TRACDCOMP( g_trac_initsvc, + "g_isteps[%d].depModules == NULL", + i_IStep ); + break; + } + uint32_t i = 0; + + while( ( l_errl == NULL ) && + ( g_isteps[istepNumber].depModules->modulename[i][0] != 0) ) + { + TRACFCOMP( g_trac_initsvc, + "unloading [%s]", + g_isteps[istepNumber].depModules->modulename[i]); + + l_errl = VFS::module_unload( + g_isteps[istepNumber].depModules->modulename[i] ); + + i++; + } + + if( l_errl ) + { + TRACFCOMP( g_trac_initsvc, + " failed to unload module, commit error and move on"); + errlCommit(l_errl, INITSVC_COMP_ID ); + l_errl = NULL; + } + + }while(0); +} + // ---------------------------------------------------------------------------- // findTaskInfo() // ---------------------------------------------------------------------------- -- cgit v1.2.1