summaryrefslogtreecommitdiffstats
path: root/src/build/vpo/hb-dump
blob: af8de2927fd6a46ea2c2dbecffe56a6cc103ea04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/perl
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/build/vpo/hb-dump $
#
# 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

#
# Purpose:  This perl script works on VBU and will dump the entire L3 cache
#
# Author: CamVan Nguyen
# Last Updated: 09/07/2011
#

#------------------------------------------------------------------------------
# Specify perl modules to use
#------------------------------------------------------------------------------
use strict;
use warnings;
use File::Basename;

#------------------------------------------------------------------------------
# Forward Declaration
#------------------------------------------------------------------------------
sub printUsage;


#==============================================================================
# MAIN
#==============================================================================

#------------------------------------------------------------------------------
# Parse optional input arguments
#------------------------------------------------------------------------------
my $numArgs = $#ARGV + 1;
#print "num args = $numArgs\n";
#print "argument list = @ARGV\n";

my $toolDir = dirname (__FILE__);
#print "$toolDir\n";

for (my $i=0; $i<$numArgs; $i++)
{
    if (($ARGV[$i] eq "--help") || ($ARGV[$i] eq "-h"))
    {
        #Print command line help
        printUsage();
        exit (0);
    }
    elsif ($ARGV[$i] eq "--out-path")
    {
        if (($i + 1) >= $numArgs)
        {
            die "No value given for --out-path parameter.\n";
        }
        $i++;
    }
    elsif ($ARGV[$i] !~ m/^-[cknsp]\d+/)
    {
        print "Invalid argument entered:  $ARGV[$i]\n";
        printUsage();
        exit(1);
    }
}


#------------------------------------------------------------------------------
# Dump L3
#------------------------------------------------------------------------------
my $command = "$toolDir/hb-virtdebug.pl @ARGV";
system($command);


#==============================================================================
# SUBROUTINES
#==============================================================================

#------------------------------------------------------------------------------
# Print command line help
#------------------------------------------------------------------------------
sub printUsage()
{
    print ("\nUsage: hb-dump [--help] |\n");
    print ("               [--out-path <path to save output data>]\n");
    print ("               [-k#] [-n#] [-s#] [-p#] [-c#]\n\n");
    print ("  This program dumps the entire L3 to a file.\n");
    print ("  Use the hb-dump-debug program to expand and view data in the file.\n\n");
    print ("  User should copy hb-virtdebug.pl to the current directory or set\n");
    print ("  the env variable HB_IMGDIR to the path of the file.\n\n");
    print ("  --help            Prints usage information.\n");
    print ("  --out-path        Directory where the output data will be saved.\n");
    print ("                    Default path is the current directory.\n");
    print ("  -k#               Specify which cage to act on (default = 0).\n");
    print ("  -n#               Specify which node to act on (default = 0).\n");
    print ("  -s#               Specify which slot to act on (default = 0).\n");
    print ("  -p#               Specify which chip position to act on (default = 0).\n");
    print ("  -c#               Specify which core/chipUnit to act on (default = 3).\n");
}

OpenPOWER on IntegriCloud