Skip to content

Commit

Permalink
level 4.3.2560
Browse files Browse the repository at this point in the history
  • Loading branch information
vageline committed Sep 20, 2017
1 parent 1d490c0 commit 32847ad
Show file tree
Hide file tree
Showing 17 changed files with 92 additions and 82 deletions.
4 changes: 2 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Section: utils
XS-Autobuild: yes
Priority: optional
Standards-Version: 4.0.1
Build-Depends: debhelper (>=10), dh-systemd, doxygen, linux-libc-dev, libudev-dev, lsb-release, libcxl-dev, help2man
Build-Depends: debhelper (>=10), dh-systemd, doxygen, linux-libc-dev, libudev-dev, libcxl-dev, help2man
Homepage: https://github.com/open-power
Vcs-Browser: https://github.com/open-power/capiflash.git
Vcs-Git: https://github.com/open-power/capiflash.git
Expand All @@ -19,4 +19,4 @@ Description: IBM Capiflash IO Data Engine
This provides IO and utility support for IBM Capiflash adapters,
and includes a NoSQL Software Interface. The latest
adapter firmware updates are provided separately
in cxlflashimage.
in cxlflashimage.
2 changes: 0 additions & 2 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ else
endif
endif

export OSRELEASE=$(shell /usr/bin/lsb_release -sr)

export PWD=$(shell pwd)
export SURELOCKROOT=$(shell pwd)

Expand Down
5 changes: 3 additions & 2 deletions src/build/install/resources/capi_flash
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,6 @@ if ($ARGV[0])
}
if ($prthelp) {usage();}

#check sudo permissions
(`id -u` == 0) || die "Run with sudo permissions\n";

#-------------------------------------------------------------------------------
# Make stdout autoflush
Expand Down Expand Up @@ -630,6 +628,9 @@ else
#-------------------------------------------------------------------------------
$list && exit;

#check permissions
(! (`groups $ENV{'USER'}` =~ / cxl/ || `id -u $ENV{'USER'}` == 0)) && die "You do not have enough permissions\n";

#-------------------------------------------------------------------------------
# VM - validate target
#-------------------------------------------------------------------------------
Expand Down
8 changes: 2 additions & 6 deletions src/build/install/resources/cflash_capacity
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,8 @@ if ($prthelp) {usage();}
select(STDOUT);
$| = 1;

#check sudo permissions
if (`id -u` != 0)
{
print "Run with sudo permissions\n";
exit -2;
}
#check permissions
(! (`groups $ENV{'USER'}` =~ / cxl/ || `id -u $ENV{'USER'}` == 0)) && die "You do not have enough permissions\n";

#-------------------------------------------------------------------------------
# list Devices
Expand Down
14 changes: 6 additions & 8 deletions src/build/install/resources/cflash_inject
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ sub usage()
exit 0;
}

#check permissions
(! (`groups $ENV{'USER'}` =~ / cxl/ || `id -u $ENV{'USER'}` == 0)) && die "You do not have enough permissions\n";

#-------------------------------------------------------------------------------
# Parse Options
#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -131,11 +134,6 @@ if ($ARGV[0])
}
if ($prthelp || (!$dev && ($afu==-1 || $port==-1))) {usage();}

#check sudo permissions
if (`id -u` != 0) {print "Run with sudo permissions\n"; exit 0;}

`chmod +x /usr/lib*/cxlflash/ext/flashgt_nvme_override`;

#-------------------------------------------------------------------------------
# Make stdout autoflush
#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -200,19 +198,19 @@ elsif ($clear)
{
$opcode="0xff";
$parms="$afustr --opcode $opcode --param 0x02 --port $port --entry $entry --offset 4 --mask 0xFFFF00FF --data 0";
$cmd="/usr/lib*/cxlflash/ext/flashgt_nvme_override $parms";
$cmd="/usr/bin/flashgt_nvme_override $parms";
}
elsif ($wear>=0)
{
$data=sprintf("0x%.2x00", $wear);
$parms="$afustr --opcode $opcode --param 0x02 --port $port --entry $entry --offset 4 --mask 0xFFFF00FF --data $data";
$cmd="/usr/lib*/cxlflash/ext/flashgt_nvme_override $parms";
$cmd="/usr/bin/flashgt_nvme_override $parms";
}
elsif ($temp>=0)
{
$data=sprintf("0x0%.3x00", $temp+273);
$parms="$afustr --opcode $opcode --param 0x02 --port $port --entry $entry --offset 0 --mask 0xFF0000FF --data $data";
$cmd="/usr/lib*/cxlflash/ext/flashgt_nvme_override $parms";
$cmd="/usr/bin/flashgt_nvme_override $parms";
}

system($cmd);
Expand Down
4 changes: 2 additions & 2 deletions src/build/install/resources/cflash_mfg_init
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ if ($ARGV[0])
}
if ($prthelp) {usage();}

#check sudo permissions
(`id -u` == 0) || die "Run with sudo permissions\n";
#check permissions
(! (`groups $ENV{'USER'}` =~ / cxl/ || `id -u $ENV{'USER'}` == 0)) && die "You do not have enough permissions\n";


if (defined $serial) {(length($serial)==8) || die "serial is not 8 chars\n";}
Expand Down
4 changes: 2 additions & 2 deletions src/build/install/resources/cflash_perf
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ if ($ARGV[0])
if ($prthelp) {usage();}
$sleep = $sleep > 60 ? 60 : $sleep;

#check sudo permissions
(`id -u` == 0) || die "Run with sudo permissions";
#check permissions
(! (`groups $ENV{'USER'}` =~ / cxl/ || `id -u $ENV{'USER'}` == 0)) && die "You do not have enough permissions\n";

#-------------------------------------------------------------------------------
# BMC -list CAPI Devices
Expand Down
4 changes: 2 additions & 2 deletions src/build/install/resources/cflash_perfcheck
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ if ($ARGV[0])
}
if ($prthelp) {usage();}

#check sudo permissions
(`id -u` == 0) || die "Run with sudo permissions\n";
#check permissions
(! (`groups $ENV{'USER'}` =~ / cxl/ || `id -u $ENV{'USER'}` == 0)) && die "You do not have enough permissions\n";

$ENV{'PATH'}="$ENV{'PATH'}:/usr/bin";

Expand Down
8 changes: 2 additions & 6 deletions src/build/install/resources/cflash_perst
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,8 @@ if ($ARGV[0])
}
if ($prthelp) {usage();}

#check sudo permissions
if (`id -u` != 0)
{
print "Run with sudo permissions to perst\n";
exit -2;
}
#check permissions
(! (`groups $ENV{'USER'}` =~ / cxl/ || `id -u $ENV{'USER'}` == 0)) && die "You do not have enough permissions\n";

#check cxlflash is not loaded
system("lsmod | grep cxlflash >/dev/null");
Expand Down
8 changes: 2 additions & 6 deletions src/build/install/resources/cflash_reset
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,8 @@ if ( `cat /etc/redhat-release 2>/dev/null` =~ "Red Hat" ) {$redhat=1;}

if (! $force) {print "sorry, not supported yet\n"; exit 0;}

#check sudo permissions
if (`id -u` != 0)
{
print "Run with sudo permissions\n";
exit -2;
}
#check permissions
(! (`groups $ENV{'USER'}` =~ / cxl/ || `id -u $ENV{'USER'}` == 0)) && die "You do not have enough permissions\n";

#-------------------------------------------------------------------------------
# Make stdout autoflush
Expand Down
4 changes: 2 additions & 2 deletions src/build/install/resources/cflash_stick
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ if ($ARGV[0])
}
if ($prthelp) {usage();}

#check sudo permissions
if (`id -u` != 0) {print "Run with sudo permissions\n"; exit 0;}
#check permissions
(! (`groups $ENV{'USER'}` =~ / cxl/ || `id -u $ENV{'USER'}` == 0)) && die "You do not have enough permissions\n";

#-------------------------------------------------------------------------------
# Make stdout autoflush
Expand Down
4 changes: 2 additions & 2 deletions src/build/install/resources/cflash_temp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ if ($prthelp) {usage();}
if ( `cat /etc/os-release 2>/dev/null` =~ "Red Hat" ) {$redhat=1;}
if ( `cat /etc/os-release 2>/dev/null` =~ "Ubuntu" ) {$ubuntu=1;}

#check sudo permissions
(`id -u` == 0) || die "Run with sudo permissions";
#check permissions
(! (`groups $ENV{'USER'}` =~ / cxl/ || `id -u $ENV{'USER'}` == 0)) && die "You do not have enough permissions\n";

#ensure sg_write_buffer is available
if ( $redhat ) {$cmd="rpm -qa | grep -v udev|grep -v libs | grep sg3_utils >/dev/null "; }
Expand Down
40 changes: 27 additions & 13 deletions src/build/install/resources/cflash_version
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
if [[ $1 =~ help || $1 =~ -h ]]; then echo "Usage: $(basename $0)"; exit 0; fi
if [[ $1 =~ version ]]; then echo "v1.0"; exit 0; fi

# check permissions
if [[ $(id -u) != 0 ]]; then echo "use sudo"; exit 1; fi

export PATH=$PATH:/usr/bin

#determine distro
Expand Down Expand Up @@ -132,14 +129,22 @@ then
n2=$(echo $EXISTS_GRUB_VER|awk -F. '{print $2}')
n3=$(echo $EXISTS_GRUB_VER|awk -F. '{print $3}'|awk -F- '{print $1}')
n4=$(echo $EXISTS_GRUB_VER|awk -F- '{print $2}'|awk -F. '{print $1}')
if [[ ($n1 -lt 4) ||
($n1 -eq 4 && $n2 -lt 4) ||
($n1 -eq 4 && $n2 -eq 4 && $n3 -eq 0 && $n4 -lt 36) ]]
if [[ ! -z ${EXISTS_GRUB_VER} &&
(($n1 -lt 4) ||
($n1 -eq 4 && $n2 -lt 4) ||
($n1 -eq 4 && $n2 -eq 4 && $n3 -eq 0 && $n4 -lt 36)) ]]
then
err_rc=6
echo "ERROR: Grub: grub.cfg($EXISTS_GRUB_VER) => Required($K_VER_GRUB) or newer"
fi

#check permissions
if [[ ! ($(groups ${USER}) =~ cxl || $(id -u ${USER}) -eq 0) ]]
then
echo "You do not have enough permissions to check the firmware levels"
exit $err_rc
fi

if [[ -e /usr/bin/capi_flash ]]
then
IFS=$'\n'
Expand Down Expand Up @@ -229,24 +234,33 @@ then
echo "ERROR: cxlflash-test: Installed($EXISTS_CF_TEST_VER) != Required($CF_VER)"
fi

EXISTS_K_VER=$(rpm -q kernel)
if [[ ! $EXISTS_K_VER =~ $K_VER ]]
EXISTS_K_VER=$(rpm -qa|grep $(uname -a|awk '{print $3}')|awk -Fkernel- '{print $2}')
n1=$(echo $EXISTS_K_VER|awk -F. '{print $1}')
n2=$(echo $EXISTS_K_VER|awk -F. '{print $2}')
if [[ ($n1 -lt 3) || ($n1 -eq 3 && $n2 -lt 10) ]]
then
err_rc=5
echo "WARNING: Kernel: Booted($(uname -a|awk '{print $3}')) != Required($K_VER)"
err_rc=5
echo "ERROR: Kernel: Booted($EXISTS_K_VER) => Required($K_VER) or newer"
else
echo "INFO: Kernel: $K_VER"
echo "INFO: Kernel: $EXISTS_K_VER"
fi

EXISTS_GRUB_VER=$(grep initrd /boot/grub2/grub.cfg | head -1 | awk -Finitramfs- '{print $2}')
EXISTS_GRUB_VER=$(grep initrd /boot/grub2/grub.cfg 2>/dev/null| head -1 | awk -Finitramfs- '{print $2}')
n1=$(echo $EXISTS_GRUB_VER|awk -F. '{print $1}')
n2=$(echo $EXISTS_GRUB_VER|awk -F. '{print $2}')
if [[ ($n1 -lt 3) || ($n1 -eq 3 && $n2 -lt 10) ]]
if [[ ! -z ${EXISTS_GRUB_VER} && (($n1 -lt 3) || ($n1 -eq 3 && $n2 -lt 10)) ]]
then
err_rc=6
echo "WARNING: Grub: grub.cfg($EXISTS_GRUB_VER) != Required($K_VER_GRUB)"
fi

#check permissions
if [[ ! ($(groups ${USER}) =~ cxl || $(id -u ${USER}) -eq 0) ]]
then
echo "You do not have enough permissions to check the firmware levels"
exit $err_rc
fi

if [[ -e /usr/bin/capi_flash ]]
then
IFS=$'\n'
Expand Down
4 changes: 2 additions & 2 deletions src/build/install/resources/cflash_wear
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ if ($prthelp) {usage();}
if ( `cat /etc/os-release 2>/dev/null` =~ "Red Hat" ) {$redhat=1;}
if ( `cat /etc/os-release 2>/dev/null` =~ "Ubuntu" ) {$ubuntu=1;}

#check sudo permissions
(`id -u` == 0) || die "Run with sudo permissions";
#check permissions
(! (`groups $ENV{'USER'}` =~ / cxl/ || `id -u $ENV{'USER'}` == 0)) && die "You do not have enough permissions\n";

#ensure sg_write_buffer is available
if ( $redhat ) {$cmd="rpm -qa | grep -v udev | grep -v libs | grep sg3_utils >/dev/null "; }
Expand Down
20 changes: 12 additions & 8 deletions src/build/install/resources/cflashutils
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ ctrlblockdevmap()
fi
echo "INFO: sgdev:$dev mode:$tgmode action:${scsiaction} sddev:$blockdev" >> $LOGFILE;
#if there's something to do, call either bind or unbind appropriately
if [[ "$scsiaction" != "noop" && $blockdev ]]; then
if [[ "$scsiaction" != "noop" && $blockdev && $(id -u ${USER}) -eq 0 ]]; then
out=$(echo -n "$scsitopo" > /sys/bus/scsi/drivers/sd/$scsiaction 2>&1)
echo "INFO: action:${scsiaction} sgdev:$dev sddev:$blockdev scsitopo:$scsitopo rc:$?" >> $LOGFILE;
fi
Expand Down Expand Up @@ -305,16 +305,20 @@ getluntablestate()
#@returns rc to 0 on success, OR sets return code to non-zero value on error
dotableupdate()
{
#check sudo permissions
SUDO=$(id -u)
if [[ $SUDO != 0 ]]; then echo "run with sudo permissions to refresh"; return; fi
#check permissions
if [[ ! ($(groups ${USER}) =~ cxl || $(id -u ${USER}) -eq 0) ]]; then echo "You do not have enough permissions"; return; fi

#attempt to rescan for cxl scsi devices
local host;
for host in $(ls /sys/module/cxlflash/drivers/pci:cxlflash/*:*:*.*/ 2>/dev/null| grep host)
do
echo "- - -" > /sys/class/scsi_host/$host/scan
done
if [[ $(id -u ${USER}) -eq 0 ]]
then
for host in $(ls /sys/module/cxlflash/drivers/pci:cxlflash/*:*:*.*/ 2>/dev/null| grep host)
do
echo "- - -" > /sys/class/scsi_host/$host/scan
done
else
echo "unable to scan for new luns, not enough permissions"
fi

#list of all known SG devices - local to prevent this from causing side effects / problems in udev handler
local _SGDEVS=`ls /sys/module/cxlflash/drivers/pci:cxlflash/*:*:*.*/host*/target*:*:*/*:*:*:*/scsi_generic 2>/dev/null| grep sg`
Expand Down
39 changes: 23 additions & 16 deletions src/build/install/resources/cxlffdc
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,22 @@ if [[ $1 =~ version ]]; then echo "v1.0"; exit 0; fi

export PATH=$PATH:/usr/bin

DATADIR=/var/log/cflash/cxlffdc
PREVDIR=/var/log/cflash/prev
MISCDIR=/var/log/cflash/misc
TARBALL=/var/log/cflash/cxlffdc."$(date|awk '{print $4"_"$2"_"$3"_"$6}'|sed 's/:/_/'g)".tgz
DIR=cxlffdc."$(date|awk '{print $4"_"$2"_"$3"_"$6}'|sed 's/:/_/'g)"

#check permissions
if [[ $(id -u ${USER}) -eq 0 ]]
then
DATAPATH=/var/log/cflash
perms=1
else
echo "****************************************"
echo "*** run with sudo for better results ***"
echo "****************************************"
DATAPATH=/tmp
fi

DATADIR=${DATAPATH}/${DIR}
MISCDIR=${DATAPATH}/misc
BINDIR=/usr/bin
pgz=$(ls /usr/lib/cxlflash/ext/p*gz 2>/dev/null)
ptd=/usr/lib/cxlflash/ext/ptd
Expand Down Expand Up @@ -89,15 +101,10 @@ fi
##################
# main
##################
if [[ $EUID -ne 0 ]]; then
echo "This script must be run with sudo" 1>&2
exit 1
fi

ret=$(pwd)
if [[ -e $DATADIR ]]; then rm -rf $DATADIR; fi
if [[ -e $PREVDIR ]]; then rm -rf $PREVDIR; fi
mkdir $DATADIR
if [[ -e $DATADIR ]]; then rm -rf $DATADIR 2>/dev/null; fi
mkdir -p $DATADIR
cd $DATADIR

cardnums=`ls -d /sys/class/cxl/card* | awk -F"/sys/class/cxl/card" '{ print $2 }'`
Expand All @@ -108,10 +115,10 @@ do
then
printf "\n INFO: psl trace on VM Not Supported! \n\n"
else
if [[ -f ${BINDIR}/psl_dump_data ]]
if [[ -f ${BINDIR}/psl_trace_dump && $perms -eq 1 ]]
then
echo "Dumping PSL data for card$i"
${BINDIR}/psl_dump_data card$i $i >/dev/null
${BINDIR}/psl_trace_dump ${DATADIR}/card$i $i >/dev/null
fi
fi
done
Expand Down Expand Up @@ -231,10 +238,10 @@ do
done

cd ..
tar -cvzf $TARBALL cxlffdc
mv $DATADIR $PREVDIR
tar -czf $DIR.tgz $DIR
rm -Rf $DIR

echo "INFO: FFDC Collected below."
ls -l $TARBALL
ls -l $DATADIR.tgz

cd $ret
2 changes: 1 addition & 1 deletion src/build/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.3.2557
4.3.2560

0 comments on commit 32847ad

Please sign in to comment.