#!/usr/bin/perl # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # $Source: src/build/debug/eSEL.pl $ # # OpenPOWER HostBoot Project # # Contributors Listed Below - COPYRIGHT 2017,2019 # [+] International Business Machines Corp. # # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. See the License for the specific language governing # permissions and limitations under the License. # # IBM_PROLOG_END_TAG use strict; use Cwd; use POSIX; use POSIX qw(strftime); use Switch; use Getopt::Long qw(:config no_ignore_case); use File::Basename; use Data::Dumper; use File::Copy; use Fcntl qw(:seek); use constant ESEL_HEADER_LENGTH => 16; use constant PNOR_ERROR_LENGTH => 4096; use constant WORD_5_OFFSET => 100; use constant ACK_MASK => 0x00200000; use constant EMPTY_ERRLOG_IN_PNOR => "ffffffff"; # options and usage my $target = ''; # Target BMC name / IP (convert to IP) my $userid = 'ADMIN'; # BMC user id to use for the ipmitool cmd my $passwd = 'admin'; # BMC password to use for the ipmitool cmd my $dirname = dirname(__FILE__); my $errl_path = $dirname; my $fspt_path = $dirname; my $img_path = $dirname; my $output_path = cwd(); my $debug = 0; my $usage = 0; my $option = ""; my $esel_file = ""; my $bad_option = 0; my $removeEcc = 0; my $filterAcked = 0; my $keepTempFiles = 0; my @filesToDelete = (); my $ecc_executable = ""; my $esel_record_count = 0; my @esel_timestamps = (); my $timestamp = ""; my $txt_file_name = ""; my $timestamp_found = 0; my $useOpalParser = 0; my %options_table = ( get_ami_data => 0, decode_ami_data => 0, get_and_decode_ami => 0, decode_obmc_data => 0, decode_hbel_data => 0 ); sub printUsage { print "All directory paths passed as arguments to the tool MUST be Fully qualified path names.\n"; print "Usage: eSEL.pl [-h] -t [-U ] [-P ]\n"; print " [-o ] # default: $output_path\n"; print " [-e ] # default: $errl_path(*) \n"; print " [-f ] # default $fspt_path(*)\n"; print " [-i ] # default $img_path(*)\n"; print " [-l ]\n"; print " [-c] # remove ECC before processing the HBEL partition\n"; print " [-r] # filter out ACKed logs from HBEL\n"; print " [-k] # keep the temp files created by the script\n"; print " [--ecc ] # path to the ECC executable\n"; print " [--op] # use opal-elog-parse instead of errl\n"; print " [-p