From a577e41f193dafd6d866e67c754b3c1a30e34f59 Mon Sep 17 00:00:00 2001 From: Mark Wenning Date: Tue, 16 Oct 2012 23:49:07 -0500 Subject: Move to using ISTEP_MODE when FSP is present Also add code to clear status reg before starting splessmode. Change-Id: I96c8ff7fef7fd62ae8958104e47319303d9aa080 RTC: 51001 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/2104 Tested-by: Jenkins Server Reviewed-by: Thi N. Tran Reviewed-by: A. Patrick Williams III --- src/build/debug/Hostboot/Istep.pm | 62 ++++----- src/build/vpo/hb-istep | 144 +++++++++------------ src/usr/initservice/istepdispatcher/splesscommon.C | 26 ++-- 3 files changed, 102 insertions(+), 130 deletions(-) diff --git a/src/build/debug/Hostboot/Istep.pm b/src/build/debug/Hostboot/Istep.pm index a1b868955..06d6f8594 100755 --- a/src/build/debug/Hostboot/Istep.pm +++ b/src/build/debug/Hostboot/Istep.pm @@ -22,18 +22,18 @@ # # IBM_PROLOG_END_TAG # -# Purpose: This perl script works in concert with do_sprint to -# implement isteps on AWAN. +# Purpose: This perl script implements isteps on AWAN. # -# Description: -# The do_sprint script will run first to set up the AWAN environment, -# Then call hb_Istep twice: +# Procedure: +# Call hb_Istep twice: # 1) hb_Istep [--]istepmode # called after loading but before starting HostBoot # this will check to see if the user has set istep mode, if so # it will write the Istep_mode signature to L3 memory to put -# HostBoot mode into single-step mode (spless or FSP). +# HostBoot mode into single-step mode (spless). +# Then it will boot HostBoot until it is ready to receive commands. # 2) hb_Istep [--]command +# Submit a istep/substep command for hostboot to run. # Periodically call ::executeInstrCycles() to step through HostBoot. # Checks for status from previous Isteps, and reports status. # @@ -68,7 +68,6 @@ our @EXPORT_OK = ('main'); #------------------------------------------------------------------------------ ## @todo extract these from splesscommon.H use constant SPLESS_MODE_SIGNATURE => 0x4057b0074057b007; -use constant FSP_MODE_SIGNATURE => 0x700b7504700b7504; use constant RUN_ALL_MODE_SIGNATURE => 0xBADC0FFEE0DDF00D; use constant SPLESS_SINGLE_ISTEP_CMD => 0x00; @@ -79,10 +78,10 @@ use constant MAX_ISTEPS => 25; use constant MAX_SUBSTEPS => 25; ## Mailbox Scratchpad regs -use constant MBOX_SCRATCH0 => 0x00050038; -use constant MBOX_SCRATCH1 => 0x00050039; -use constant MBOX_SCRATCH2 => 0x0005003a; -use constant MBOX_SCRATCH3 => 0x0005003b; +use constant MBOX_SCRATCH0 => 0x00050038; ## contTrace +use constant MBOX_SCRATCH1 => 0x00050039; ## sts LO +use constant MBOX_SCRATCH2 => 0x0005003a; ## sts HI +use constant MBOX_SCRATCH3 => 0x0005003b; ## cmd reg ## extra parm for ::executeInstrCycles use constant NOSHOW => 1; @@ -152,7 +151,7 @@ sub main ::userDisplay "args: $k => $v\n"; } - ::userDisplay "Welcome to hb-Istep 3.33 .\n"; + ::userDisplay "Welcome to hb-Istep 3.34 .\n"; ::userDisplay "Note that in simics, multiple options must be in quotes,"; ::userDisplay "separated by spaces\n\n"; @@ -180,11 +179,11 @@ sub main ## fetch the istep list get_istep_list(); - ## $$ debug, dump all the environment vars that we are interested in - dumpEnvVar( "HB_TOOLS" ); - dumpEnvVar( "HB_IMGDIR" ); - dumpEnvVar( "HB_VBUTOOLS" ); - dumpEnvVar( "HB_COUNT" ); + ## debug, dump all the environment vars that we are interested in + ## dumpEnvVar( "HB_TOOLS" ); + ## dumpEnvVar( "HB_IMGDIR" ); + ## dumpEnvVar( "HB_VBUTOOLS" ); + ## dumpEnvVar( "HB_COUNT" ); ##-------------------------------------------------------------------------- ## Start processing options @@ -292,7 +291,7 @@ sub main if ( $opt_debug ) { ::userDisplay "=== check ShutDown Status...\n"; } if ( isShutDown() ) { - ::userDisplay "Cannot run hb-Istep.\n"; + ::userDisplay "Shutdown detected: cannot run HostBoot.\n"; exit; } @@ -309,7 +308,7 @@ sub main if ( $opt_istepmode ) { - ::userDisplay "istepmode no longer used - use splessmode, or fspmode\n"; + ::userDisplay "istepmode no longer used - use splessmode\n"; exit; } @@ -323,16 +322,14 @@ sub main if ( $opt_fspmode ) { - ::userDisplay "ENable fspmode\n"; - setMode( "fsp" ); - ::userDisplay "Done.\n"; + ::userDisplay "istepmode no longer used - use splessmode\n"; exit; } ## don't do any other commands unless ready bit is on. if ( ! isReadyBitOn() ) { - ::userDisplay "Ready bit is off, must run splessmode or fspmode first.\n"; + ::userDisplay "Ready bit is off, must run splessmode first.\n"; exit; } @@ -374,7 +371,6 @@ sub helpInfo intro => ["Executes isteps."], options => { "list" => [" list out all supported isteps "], "splessmode" => ["enable istep mode"], - "fspmode" => ["enable istep mode"], "resume" => ["resume an istep that is at a break point"], "clear-trace" => ["clear trace buffers before starting"], "sN" => ["run istep N"], @@ -395,6 +391,8 @@ sub bumpSeqNum() $g_SeqNum %= 64; + $g_SeqNum += ($g_SeqNum == 0) ? 1 : 0; + return $g_SeqNum; } @@ -897,7 +895,7 @@ sub process_command( $ ) ## write to mem to set istep or normal mode, check return status ## ## Note that this only happens once at the beginning, when "splessmode" -## or "fsplessmode" is run. +## is run. ## sub setMode( $ ) { @@ -912,11 +910,6 @@ sub setMode( $ ) writeIstepModeReg( SPLESS_MODE_SIGNATURE ); $expected = 1; } - elsif ( $cmd eq "fsp" ) - { - writeIstepModeReg( FSP_MODE_SIGNATURE ); - $expected = 1; - } else { ::userDisplay "invalid setMode command: $cmd\n" ; @@ -930,6 +923,13 @@ sub setMode( $ ) ::userDisplay "=== IstepModeReg readback: ", sprintf("0x%x", $result), "\n" ; } + ## Clear status reg(s) before we start. If the status reg is initialized + ## to garbage, there is a chance that it will mistaken for the readybit + ::writeScom( MBOX_SCRATCH2, 8, 0 ); ## clear hi + ::writeScom( MBOX_SCRATCH1, 8, 0 ); ## clear lo + + ## Clear command reg as well. + ::writeScom( MBOX_SCRATCH3, 8, 0 ); ## clear cmd. ## Loop, advancing clock, and wait for readybit $count = $hbCount ; @@ -949,7 +949,7 @@ sub setMode( $ ) ## check for system crash if ( isShutDown( ) ) { - ::userDisplay "Cannot run HostBoot.\n"; + ::userDisplay "Shutdown detected: cannot run HostBoot.\n"; return -1; } diff --git a/src/build/vpo/hb-istep b/src/build/vpo/hb-istep index d33f37aa4..21eebae99 100755 --- a/src/build/vpo/hb-istep +++ b/src/build/vpo/hb-istep @@ -1,39 +1,39 @@ #!/usr/bin/perl -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/build/vpo/hb-istep $ -# -# 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 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_BEGIN_TAG +# This is an automatically generated prolog. # -# Purpose: This perl script works in concert with do_sprint to -# implement isteps on AWAN. +# $Source: src/build/vpo/hb-istep $ # -# Description: -# The do_sprint script will run first to set up the AWAN environment, -# Then call hb_istep twice: +# 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 otherwise +# divested of its trade secrets, irrespective of what has been +# deposited with the U.S. Copyright Office. +# +# Origin: 30 +# +# IBM_PROLOG_END_TAG +# +# Purpose: This perl script implements isteps on AWAN. +# +# How to run this program: +# Call hb_istep twice: # 1) hb_istep [--]istepmode -# called after loading but before starting HostBoot +# Called after loading but before starting HostBoot # this will check to see if the user has set istep mode, if so # it will write the Istep_mode signature to L3 memory to put -# HostBoot mode into single-step mode (spless or FSP). +# HostBoot mode into single-step mode (spless ). +# Then it will boot HostBoot until it is ready to recieve commands. # 2) hb_istep [--]command +# Submit a istep/substep command for hostboot to run. # Periodically call RunClocks() to step through HostBoot. # Checks for status from previous Isteps, and reports status. # @@ -91,7 +91,6 @@ my $CORE = "-cft"; ## @todo extract these from splesscommon.H use constant SPLESS_MODE_SIGNATURE => "0x4057b0074057b007"; -use constant FSP_MODE_SIGNATURE => "0x700b7504700b7504"; use constant RUN_ALL_MODE_SIGNATURE => "0xBADC0FFEE0DDF00D"; use constant SPLESS_SINGLE_ISTEP_CMD => 0x00; @@ -184,7 +183,7 @@ if ( ! -e "$hbSymsFile" ) { die "Can't find symbols file $hbSymsFile\n"; } if ( ! -e "$CSVfile" ) { die "Can't find isteplist file $hbSymsFile\n"; } -print STDOUT "Welcome to hb-istep 3.03 .\n"; +print STDOUT "Welcome to hb-istep 3.04 .\n"; ## exit if no args @@ -370,7 +369,12 @@ sub main() if ( $opt_istepmode ) { - print STDOUT "istepmode no longer used - use splessmode, or fspmode\n"; + print STDOUT "istepmode no longer used - use splessmode\n"; + exit; + } + if ( $opt_fspmode == 1 ) + { + print STDOUT "fspmode no longer used - use splessmode \n"; exit; } @@ -386,41 +390,16 @@ sub main() } - if ( ( $opt_splessmode == 1 ) - || ( $opt_fspmode == 1 ) - ) - { - my $result = VBU_Cacheline::CLread( sprintf( "%x", $IstepModeReg ) ); - - if ( $opt_debug ) - { - printf STDERR "=== Entry: IStep Mode Reg = 0x%x\n", $result; - } - - if ( $result =~ /^.*RUN_ALL_MODE_SIGNATURE/ ) - { - print STDOUT "HostBoot has already started in automatic mode. Please restart and then try again.\n"; - exit; - } - } - - ## ## process --Istep Mode command ## if ( $opt_splessmode == 1 ) { - print STDOUT "ENable splessmode\n"; + print STDOUT "ENable splessmode...\n"; setMode( "spless" ); exit; } - if ( $opt_fspmode == 1 ) - { - print STDOUT "ENable fspmode\n"; - setMode( "fsp" ); - exit; - } if ( $opt_clear_trace ) { @@ -472,13 +451,12 @@ sub printUsage() { print STDOUT "\nUsage: hb-istep [--help]\n"; print STDOUT " [--splessmode] (enable spless mode)\n" ; - print STDOUT " [--fspmode] (enable fsp mode)\n" ; print STDOUT " [--command sN] (run istep N)\n" ; print STDOUT " [--command sN..M] (run isteps N through M)\n" ; print STDOUT " [--command ] (run named istep \"foo\")\n" ; print STDOUT " [--command ..] (run named isteps \"foo\" through \"bar\")\n" ; print STDOUT " [--resume] (resume an istep that is at a break point)\n" ; - print STDOUT " [--clock] (spless mode -- poll for istep, fspmode -- clock indefinately))\n" ; + print STDOUT " [--clock] (spless mode -- poll for istep ))\n" ; print STDOUT " [--clear-trace] (clear trace buffers before starting)\n"; print STDOUT "\n" ; @@ -982,7 +960,7 @@ sub parse_command( $ ) } ## -## write IStepModeReg in memory to set istep or fsp mode, check return status +## write IStepModeReg in memory to set istep or check return status ## This does not write to a scom reg, I don't have one to write to. ## sub setMode( $ ) @@ -1006,11 +984,6 @@ sub setMode( $ ) VBU_Cacheline::CLwrite( $hexstr, SPLESS_MODE_SIGNATURE ); $expected = 1; } - elsif ( $cmd eq "fsp" ) - { - VBU_Cacheline::CLwrite( $hexstr, FSP_MODE_SIGNATURE ); - $expected = 1; - } else { print "invalid setMode command: %s\n", $cmd ; @@ -1024,6 +997,28 @@ sub setMode( $ ) printf STDERR "=== istepmodereg readback: 0x%lx\n", $result ; } + ## Clear status reg(s) before we start. If the status reg is initialized + ## to garbage, there is a chance that it will mistaken for the readybit + + $cmd = "putscom pu 05003a -p0 -quiet 0" ; ## hi reg + + if ( $opt_debug ) { print STDERR __LINE__, "-- run $cmd ...\n"; } + ( system( $cmd ) == 0 ) + or die "$cmd failed, $? : $! \n"; + + $cmd = "putscom pu 050039 -p0 -quiet 0" ; ## lo reg + + if ( $opt_debug ) { print STDERR __LINE__, "-- run $cmd ...\n"; } + ( system( $cmd ) == 0 ) + or die "$cmd failed, $? : $! \n"; + + ## clear command reg as well. + $cmd = "putscom pu 05003b -p0 -quiet 0" ; ## cmd reg + + if ( $opt_debug ) { print STDERR __LINE__, "-- run $cmd ...\n"; } + ( system( $cmd ) == 0 ) + or die "$cmd failed, $? : $! \n"; + ## Loop, advancing clock, and wait for readybit ## @todo revisit @@ -1071,23 +1066,6 @@ sub setMode( $ ) $result = getStatus( ); $readybit = ( ( $result & 0x4000000000000000 ) >> 62 ); } - else # fsp mode - { - $cmd = "getscom pu 050033 -p0 -quiet"; - - if ( $opt_debug ) { print STDERR __LINE__, "-- run $cmd ...\n"; } - $resultRaw = `$cmd` ; - if ( $opt_debug ) { printf STDERR "=== resultRaw=$resultRaw ...\n"; } - $resultRaw =~ s/.*0x/0x/g; - $resultRaw =~ s/\n//g; - $result = hex $resultRaw; - - if ( $opt_debug ) { printf STDERR "=== result=0x%lx ...\n", $result; } - if (($result & 0x0000000300000000) eq 0x0000000300000000) - { - $readybit = 1; - } - } if ($opt_debug) { diff --git a/src/usr/initservice/istepdispatcher/splesscommon.C b/src/usr/initservice/istepdispatcher/splesscommon.C index 809915014..0f30d741b 100644 --- a/src/usr/initservice/istepdispatcher/splesscommon.C +++ b/src/usr/initservice/istepdispatcher/splesscommon.C @@ -115,20 +115,24 @@ void initIStepMode( ) } else { + TRACDCOMP( INITSERVICE::g_trac_initsvc, + "initIStepMode entry: ISTEP_MODE attribute = %x", + l_pTopLevel->getAttr( ) ); // got a pointer to Targeting, complete setting the flag - // $$ save l_readData = mmio_scratch_read( MMIO_SCRATCH_IPLSTEP_CONFIG ); l_readData = g_SPLess_IStepMode_Reg; // Get the Thread 5 scratch reg uint64_t t5ScratchVal = mmio_scratch_read( MMIO_SCRATCH_ISTEP_MODE ); - TRACFCOMP( INITSERVICE::g_trac_initsvc, + TRACDCOMP( INITSERVICE::g_trac_initsvc, INFO_MRK"Thread 5 scratch reg val: 0x%08x", t5ScratchVal ); // Only need 1 bit. t5ScratchVal = t5ScratchVal & 0x1; #ifdef SPLESS_DEBUG - printk( "IStepMode Reg = 0x%p, 0x%lx\n", &g_SPLess_IStepMode_Reg, l_readData ); + printk( "IStepMode Reg = 0x%p, 0x%lx\n", + &g_SPLess_IStepMode_Reg, + l_readData ); printk( "Status Reg = 0x%p\n", &g_SPLess_Status_Reg ); printk( "Command Reg = 0x%p\n", &g_SPLess_Command_Reg ); #endif @@ -138,23 +142,13 @@ void initIStepMode( ) // check for IStep Mode signature(s) if ( ( l_readData == ISTEP_MODE_SPLESS_SIGNATURE ) - || ( l_readData == ISTEP_MODE_FSP_SIGNATURE ) || - ( 0x1 == t5ScratchVal ) ) + || ( 0x1 == t5ScratchVal ) ) { l_pTopLevel->setAttr (true ); TRACDCOMP( INITSERVICE::g_trac_initsvc, - "ISTEP_MODE attribute set to TRUE." ); - } - else - { - // If not either of the above, set to run-all - l_readData = RUN_ALL_MODE_SIGNATURE; - // $$ save mmio_scratch_write( MMIO_SCRATCH_IPLSTEP_CONFIG, l_readData ); - l_pTopLevel->setAttr ( false ); - - TRACDCOMP( INITSERVICE::g_trac_initsvc, - "ISTEP_MODE attribute set to FALSE." ); + "Signature or scratch reg set, ISTEP_MODE attr set = TRUE.", + l_readData ); } } -- cgit v1.2.1