updated to latest upstream 1.2.6

This commit is contained in:
Jiri Skala 2011-01-24 14:36:55 +01:00
parent 8f4cc5a9c5
commit 280eaaf30c
15 changed files with 10 additions and 1566 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
powerpc-utils-1.2.2.tar.gz
/powerpc-utils-1.2.6.tar.gz

View File

@ -1,164 +0,0 @@
commit 2568514fc910e3bb075b9b94d9d486243ddb5d29
Author: Nathan Fontenot <nfont@austin.ibm.com>
Date: Wed May 19 13:36:22 2010 -0500
The amsstat appears to make some assumptions, namely that AMS is
enabled and all of the files it pulls data from exist. This patch
updates the script to verify that AMS is available and enabled before
trying to gather information. If either are not, it prints an error
message and exits.
This also updates the file checking to redirect error messages from
the pushd command and print an appropriate error message if the file
is not present.
Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
diff --git a/scripts/amsstat b/scripts/amsstat
index 11be072..628a797 100755
--- a/scripts/amsstat
+++ b/scripts/amsstat
@@ -22,6 +22,7 @@ sleep_interval=$1
indent=-4
devstat_data_spacing=-30
lparcfg_data_spacing=-30
+lparcfg_file=/proc/ppc64/lparcfg
function print_meminfo_stats {
echo "System Memory Statistics:"
@@ -38,7 +39,7 @@ function print_meminfo_stats {
done
# Include Desired Memory value from /proc/ppc64/lparcfg
- stat=`grep "^DesMem" /proc/ppc64/lparcfg`
+ stat=`grep "^DesMem" $lparcfg_file`
if [ ! -z "${stat}" ]; then
this_stat=`echo $stat | awk -F= '{print $1}'`
this_value=`echo $stat | awk -F= '{print $2}'`
@@ -48,7 +49,7 @@ function print_meminfo_stats {
function print_entitlement_data {
echo "Entitlement Information:"
- for stat in `cat /proc/ppc64/lparcfg`; do
+ for stat in `cat $lparcfg_file`; do
if echo $stat | grep "^entitled_memory\|^mapped_entitled_memory\|^entitled_memory_weight\|entitled_memory_pool_size\|^backing_memory\|^cmo_enabled\|^cmo_faults\|^cmo_fault_time_usec\|cmo_primary_psp\|^cmo_secondary_psp" >/dev/null; then
this_stat=`echo $stat | awk -F= '{print $1}'`
this_value=`echo $stat | awk -F= '{print $2}'`
@@ -59,12 +60,15 @@ function print_entitlement_data {
function print_cmm_stats {
# CMM kernel parameters
+ echo "CMM Statistics:"
+
local path=/sys/module/cmm/parameters
- pushd $path >/dev/null
+ pushd $path >/dev/null 2>&1
if [ $? -ne 0 ] ; then
- exit 1
+ printf "%${indent}s Could not get CMM Statistics.\n" " "
+ return
fi
- echo "CMM Statistics:"
+
for stat in `find . -mindepth 1 -maxdepth 1 -print`; do
printf "%${indent}s %${devstat_data_spacing}s %${devstat_data_spacing}s\n" " " "${stat#\.\/}:" "`cat $stat`"
done
@@ -72,9 +76,9 @@ function print_cmm_stats {
# CMM statistics
local path=/sys/devices/system/cmm/cmm0
- pushd $path >/dev/null
+ pushd $path >/dev/null 2>&1
if [ $? -ne 0 ] ; then
- exit 1
+ return
fi
for stat in `find . -mindepth 1 -maxdepth 1 -print`; do
printf "%${indent}s %${devstat_data_spacing}s %${devstat_data_spacing}s\n" " " "${stat#\.\/}:" "`cat $stat`"
@@ -83,33 +87,50 @@ function print_cmm_stats {
}
function print_vio_bus_stats {
+ echo "VIO Bus Statistics:"
+ local found=0
local path=/sys/bus/vio
- pushd $path >/dev/null
+ pushd $path >/dev/null 2>&1
if [ $? -ne 0 ] ; then
- exit 1
+ printf "%${indent}s Could not get VIO Bus Statistics.\n" " "
+ return
fi
- echo "VIO Bus Statistics:"
+
for stat in `find . -mindepth 1 -maxdepth 1 -name "cmo*" -print`; do
+ found=1
printf "%${indent}s %${devstat_data_spacing}s %${devstat_data_spacing}s\n" " " "${stat#\.\/}:" "`cat $stat`"
done
popd >/dev/null
+
+ if [ "$found" -eq "0" ]; then
+ printf "%${indent}s No AMS Busses found.\n" " "
+ fi
}
function print_vio_dev_stats {
+ echo "VIO Device Statistics:"
+
+ local found=0
local path=/sys/bus/vio/devices
- pushd $path >/dev/null
+ pushd $path >/dev/null 2>&1
if [ $? -ne 0 ] ; then
- exit 1
+ printf "%${indent}s Could not get VIO Device Statistics.\n" " "
+ return
fi
- echo "VIO Device Statistics:"
+
for dir in `find . -mindepth 1 -print`; do
- pushd $dir >/dev/null
+ pushd $dir >/dev/null 2>&1
if [ $? -ne 0 ] ; then
break
fi
# Skip printing devices that are not using entitlement
+ if [ ! -e "cmo_entitled" ]; then
+ popd >/dev/null
+ continue
+ fi
+
value=`cat cmo_entitled`
if [ ${value} -eq "0" ]; then
popd >/dev/null
@@ -119,13 +140,28 @@ function print_vio_dev_stats {
NAME=$(cat devspec)
echo " ${NAME##/*/}:"
for stat in `find . -mindepth 1 -maxdepth 1 -name "cmo*" -print`; do
+ found=1
printf "%${indent}s %${devstat_data_spacing}s %${devstat_data_spacing}s\n" " " "${stat#\.\/}:" "`cat $stat`"
done
popd >/dev/null
done
popd >/dev/null
+
+ if [ "$found" -eq "0" ]; then
+ printf "%${indent}s No AMS devices found.\n" " "
+ fi
}
+# Verify CMO is present and enabled
+enabled=`cat $lparcfg_file | grep "^cmo_enabled" | awk -F= '{print $2}'`
+if [ -z $enabled ]; then
+ echo "This system is not capable of Active Memory Sharing."
+ exit -1
+elif [ "$enabled" -eq "0" ]; then
+ echo "Active Memory Sharing is not enabled on this system."
+ exit -1
+fi
+
if [ -z $sleep_interval ]; then
date
print_meminfo_stats

View File

@ -1,13 +0,0 @@
Index: powerpc-utils-1.2.2/src/ppc64_cpu.c
===================================================================
--- powerpc-utils-1.2.2.orig/src/ppc64_cpu.c 2009-10-22 14:00:13.000000000 -0500
+++ powerpc-utils-1.2.2/src/ppc64_cpu.c 2010-05-17 14:29:45.577267014 -0500
@@ -383,7 +383,7 @@
} else {
signed char rmode = *run_mode;
- if (rmode < 0 || rmode > 3) {
+ if (rmode < '0' || rmode > '3') {
printf("Invalid run-mode=%c\n", rmode);
return -1;
}

View File

@ -1,17 +0,0 @@
Index: powerpc-utils-1.2.2/src/drmgr/common.c
===================================================================
--- powerpc-utils-1.2.2.orig/src/drmgr/common.c 2009-10-22 14:00:13.000000000 -0500
+++ powerpc-utils-1.2.2/src/drmgr/common.c 2010-05-26 18:18:08.960443479 -0500
@@ -1025,6 +1025,12 @@
while ((de = readdir(d)) != NULL) {
if (strncmp(de->d_name, "cpu", 3))
continue;
+
+ /* Ensure this is a cpu directory, i.e. cpu0, and not a
+ * non-cpu directory, i.e. cpufreq.
+ */
+ if (!isdigit(de->d_name[3]))
+ continue;
sprintf(fname, "%s/%s/online", cpu_dir, de->d_name);

View File

@ -1,205 +0,0 @@
---
src/ppc64_cpu.c | 79 +++++++++++++++++++++++++++++++++++---------------------
1 file changed, 50 insertions(+), 29 deletions(-)
Index: powerpc-utils-1.2.2/src/ppc64_cpu.c
===================================================================
--- powerpc-utils-1.2.2.orig/src/ppc64_cpu.c 2010-05-17 15:12:14.697266424 -0500
+++ powerpc-utils-1.2.2/src/ppc64_cpu.c 2010-05-19 17:45:21.112201980 -0500
@@ -26,7 +26,7 @@
int cpus_in_system = 0;
int threads_in_system = 0;
-int get_attribute(char *path, int *value)
+int get_attribute(char *path, const char *fmt, int *value)
{
FILE *fp;
@@ -34,13 +34,13 @@
if (fp == NULL)
return -1;
- fscanf(fp, "%i", value);
+ fscanf(fp, fmt, value);
fclose(fp);
return 0;
}
-int set_attribute(char *path, int value)
+int set_attribute(const char *path, const char *fmt, int value)
{
FILE *fp;
@@ -48,7 +48,7 @@
if (fp == NULL)
return -1;
- fprintf(fp, "%d", value);
+ fprintf(fp, fmt, value);
fclose(fp);
return 0;
@@ -60,14 +60,14 @@
int rc, online;
sprintf(path, SYSFS_CPUDIR"/online", thread);
- rc = get_attribute(path, &online);
+ rc = get_attribute(path, "%d", &online);
if (rc || !online)
return 0;
return 1;
}
-int get_system_attribute(char *attribute, int *value)
+int get_system_attribute(char *attribute, const char *fmt, int *value)
{
char path[SYSFS_PATH_MAX];
int i, rc;
@@ -81,7 +81,7 @@
continue;
sprintf(path, SYSFS_CPUDIR"/%s", i, attribute);
- rc = get_attribute(path, &cpu_attribute);
+ rc = get_attribute(path, fmt, &cpu_attribute);
if (rc)
continue;
@@ -95,7 +95,7 @@
return 0;
}
-int set_system_attribute(char *attribute, int state)
+int set_system_attribute(char *attribute, const char *fmt, int state)
{
char path[SYSFS_PATH_MAX];
int i, rc;
@@ -106,7 +106,7 @@
continue;
sprintf(path, SYSFS_CPUDIR"/%s", i, attribute);
- rc = set_attribute(path, state);
+ rc = set_attribute(path, fmt, state);
if (rc)
return -1;
}
@@ -114,6 +114,37 @@
return 0;
}
+int set_dscr(int state)
+{
+ return set_system_attribute("dscr", "%x", state);
+}
+
+int get_dscr(int *value)
+{
+ return get_system_attribute("dscr", "%x", value);
+}
+
+int set_smt_snooze_delay(int delay)
+{
+ return set_system_attribute("smt_snooze_delay", "%d", delay);
+}
+
+int get_smt_snooze_delay(int *delay)
+{
+ return get_system_attribute("smt_snooze_delay", "%d", delay);
+}
+
+int online_thread(const char *path)
+{
+ return set_attribute(path, "%d", 1);
+}
+
+int offline_thread(const char *path)
+{
+ return set_attribute(path, "%d", 0);
+}
+
+
int get_cpu_info(void)
{
DIR *d;
@@ -178,7 +209,7 @@
if (stat(online_file, &sb))
return -1;
- rc = get_attribute(online_file, &thread_state);
+ rc = get_attribute(online_file, "%d", &thread_state);
if (rc)
return -1;
@@ -217,7 +248,7 @@
for (i = 0; i < online_threads; i++) {
snprintf(path, SYSFS_PATH_MAX, SYSFS_CPUDIR"/%s", thread + i,
"online");
- rc = set_attribute(path, 1);
+ rc = online_thread(path);
if (rc)
return rc;
}
@@ -225,7 +256,7 @@
for (; i < threads_per_cpu; i++) {
snprintf(path, SYSFS_PATH_MAX, SYSFS_CPUDIR"/%s", thread + i,
"online");
- rc = set_attribute(path, 0);
+ rc = offline_thread(path);
if (rc)
break;
}
@@ -238,7 +269,7 @@
int i, rc;
int ssd, update_ssd = 1;
- rc = get_system_attribute("smt_snooze_delay", &ssd);
+ rc = get_smt_snooze_delay(&ssd);
if (rc)
update_ssd = 0;
@@ -249,7 +280,7 @@
}
if (update_ssd)
- set_system_attribute("smt_snooze_delay", ssd);
+ set_smt_snooze_delay(ssd);
return rc;
}
@@ -321,7 +352,7 @@
if (!state) {
int dscr;
- rc = get_system_attribute("dscr", &dscr);
+ rc = get_dscr(&dscr);
if (rc) {
printf("Could not retrieve DSCR\n");
} else {
@@ -331,7 +362,7 @@
printf("dscr is %d\n", dscr);
}
} else
- rc = set_system_attribute("dscr", strtol(state, NULL, 0));
+ rc = set_dscr(strtol(state, NULL, 0));
return rc;
}
@@ -347,7 +378,7 @@
if (!state) {
int ssd;
- rc = get_system_attribute("smt_snooze_delay", &ssd);
+ rc = get_smt_snooze_delay(&ssd);
if (rc) {
printf("Could not retrieve smt_snooze_delay\n");
} else {
@@ -364,7 +395,7 @@
else
delay = strtol(state, NULL, 0);
- rc = set_system_attribute("smt_snooze_delay", delay);
+ rc = set_smt_snooze_delay(delay);
}
return rc;

View File

@ -1,424 +0,0 @@
Fixes up lsdevinfo to return the data needed by the HMC to fully support
end to end virtual device view enablement. Adds support for the -R parameter,
which is required. Also adds support for the uniquetype field.
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---
scripts/lsdevinfo | 258 ++++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 232 insertions(+), 26 deletions(-)
Index: powerpc-utils-1.2.2/scripts/lsdevinfo
===================================================================
--- powerpc-utils-1.2.2.orig/scripts/lsdevinfo 2009-10-22 14:00:13.000000000 -0500
+++ powerpc-utils-1.2.2/scripts/lsdevinfo 2010-05-17 15:37:15.957878294 -0500
@@ -20,6 +20,7 @@
LS="/bin/ls"
GREP="/bin/grep"
SED="/bin/sed"
+TR="/usr/bin/tr"
# Usage statemnet
usage()
@@ -31,6 +32,7 @@
echo " -q criteria Specifies a criteria to select which devices are"
echo " to be displayed."
echo " -F format Specifies the set of attributes to be displayed."
+ echo " -R Recursively display children of selected devices"
echo " -c Display output as a comma separated list for"
echo " each device."
echo " -V, --version Display version information and exit"
@@ -102,16 +104,21 @@
# default: CR separated list
comma_sep=0
+# default: non recursive
+recursive=0
+
# default: display all devices
criteria=""
# default: display all attributes
format=""
-while getopts "cq:F:Vh" flag ; do
+while getopts "cRq:F:Vh" flag ; do
case "$flag" in
c) comma_sep=1;;
+ R) recursive=1;;
+
q) criteria=$OPTARG;;
F) format=$OPTARG;;
@@ -141,13 +148,13 @@
separator="\n"
begin="\t"
dev_end="\n\n"
- path_begin="\n\npath:\n\tparent=\"vio\""
+ path_begin="\n\npath:\n\tparent="
path_end=""
else
dev_begin=""
separator=","
dev_end="\n"
- path_begin=",path=(parent=\"vio\","
+ path_begin=",path=(parent="
path_end=")"
fi
@@ -156,9 +163,17 @@
for dev in $($LS -d /proc/device-tree/vdevice/l-lan* 2> /dev/null); do
# use ofpathname to get the device name (i.e. eth0)
name=$($OFPATHNAME -l $(echo $dev | $SED -e "s/\/proc\/device-tree//"))
+ connection=$(echo $dev | $SED -e "s/\/proc\/device-tree\/vdevice\/l-lan@//")
+ parent="vio"
# get the physical location
physloc=$($CAT $dev/ibm,loc-code)
+ uniquetype="adapter/vdevice/IBM,l-lan"
+ class="adapter"
+ subclass="vdevice"
+ type="IBM,l-lan"
+ prefix="eth"
+ driver="ibmveth"
show=1
# if there is a criteria in the command line, check if this device matches
@@ -166,6 +181,12 @@
show=0
check_criteria "name"
check_criteria "physloc"
+ check_criteria "uniquetype"
+ check_criteria "class"
+ check_criteria "subclass"
+ check_criteria "type"
+ check_criteria "prefix"
+ check_criteria "driver"
fi
# print the info only if the device matches the criteria
@@ -173,12 +194,20 @@
# the name attribute is always printed
echo -ne $dev_begin$begin"name="\"$name\"
+ print_attr "uniquetype"
+ print_attr "class"
+ print_attr "subclass"
+ print_attr "type"
+ print_attr "prefix"
+ print_attr "driver"
+
# if there is no format in the command line or it contains "path", then
# print the path. Doesn't use print_attr because all of the fields in
# the path attribute should be printed.
if [[ $format == "" || $format =~ "path" ]]; then
- echo -ne $path_begin
- echo -ne $separator$begin"physloc="$physloc
+ echo -ne $path_begin\"$parent\"
+ echo -ne $separator$begin"physloc="\"$physloc\"
+ echo -ne $separator$begin"connection="\"$connection\"
echo -ne $path_end
fi
# done with this device
@@ -191,18 +220,92 @@
for dev in $($LS -d /proc/device-tree/vdevice/v-scsi* 2> /dev/null) ; do
# pull the physical location
physloc=$(cat $dev/ibm,loc-code)
+ hostphysloc=$physloc
+ connection=$(echo $dev | $SED -e "s/\/proc\/device-tree\/vdevice\/v-scsi@//")
# find the slot so it can be used in sysfs
slot=$(echo $dev | $SED -e "s/\/proc\/device-tree\/vdevice\/v-scsi@//")
# there is only one host per device, assign it to the path's name
for host in $($LS -d /sys/devices/vio/$slot/host*) ; do
- parent=$(echo $host/scsi_host* | $SED -e "s/.*://")
+ parent=$(echo $host | $SED -e "s/.*\///")
+ name=$parent
+
+ uniquetype="adapter/vdevice/IBM,v-scsi"
+ class="adapter"
+ subclass="vdevice"
+ type="IBM,v-scsi"
+ prefix="host"
+ driver="ibmvscsic"
+
+ host=$($LS -d /sys/devices/vio/$slot/host*/)
+ if [[ -d $host/scsi_host ]]; then
+ scsihost=$($LS -d $host/scsi_host/host*/)
+ else
+ scsihost=$($LS -d $host/scsi_host*/)
+ fi
+
+ if [[ $(cat $scsihost/state) == "running" ]] ; then
+ status=1
+ else
+ status=0
+ fi
+
+ show=1
+ # if there is a criteria in the command line, check if this
+ # device matches
+ if [[ $criteria != "" ]] ; then
+ show=0
+ check_criteria "name"
+ check_criteria "physloc"
+ check_criteria "status"
+ check_criteria "uniquetype"
+ check_criteria "class"
+ check_criteria "subclass"
+ check_criteria "type"
+ check_criteria "prefix"
+ check_criteria "driver"
+ fi
+
+ if [[ $show -ne 0 ]]; then
+ # the name attribute is always printed
+ echo -ne $dev_begin$begin"name="\"$name\"
+
+ print_attr "uniquetype"
+ print_attr "class"
+ print_attr "subclass"
+ print_attr "type"
+ print_attr "prefix"
+ print_attr "driver"
+ print_attr "status"
+
+ # print the path, see note for ibmveth above
+ if [[ $format == "" || $format =~ "path" ]]; then
+ echo -ne $path_begin"\"vio\""
+ echo -ne $separator$begin"connection="\"$connection\"
+ echo -ne $separator$begin"physloc="\"$physloc\"
+ echo -ne $path_end
+ fi
+ # done with this target
+ echo -ne $dev_end
+ fi
# loop through the targets for this host.
for t in $($LS -d $host/target*); do
- target=$(echo $($LS -d $t/$($LS $t | $GREP -v uevent)))
- name=$(echo $($LS -d $target/block*) | $SED -e "s/.*://")
+ target=$(echo $($LS -d $t/$($LS $t | $GREP -v uevent | $GREP -v power | $GREP -v subsystem)))
+ if [[ ! -d $target/block ]]; then
+ name=$(echo $($LS -d $target/block*) | $SED -e "s/.*://")
+ else
+ name=$($LS $target/block)
+ fi
+
+ conn=$($OFPATHNAME /dev/$name 2> /dev/null | $SED -e "s/.*disk@//")
+ connection=${conn:0:12}
+ uniquetype="disk/vscsi/vdisk"
+ class="disk"
+ subclass="vscsi"
+ type="vdisk"
+ physloc=$hostphysloc"-L"$conn
if [[ $(cat $target/state) == "running" ]] ; then
status=1
@@ -210,15 +313,24 @@
status=0
fi
- show=1
- # if there is a criteria in the command line, check if this
- # device matches
- if [[ $criteria != "" ]] ; then
+ # if there is a criteria in the command line, we are recursive and
+ # the parent passed criteria, show the device
+ if [[ $criteria != "" && $show -eq 1 && $recursive -eq 1 ]]; then
+ show=1
+ elif [[ $criteria != "" ]] ; then
+ # if there is a criteria in the command line, check if this
+ # device matches
show=0
check_criteria "name"
- check_criteria "physloc"
check_criteria "status"
+ check_criteria "physloc"
check_criteria "parent"
+ check_criteria "uniquetype"
+ check_criteria "class"
+ check_criteria "subclass"
+ check_criteria "type"
+ else
+ show=1
fi
# print the info only if the device matches the criteria
@@ -226,14 +338,20 @@
# the name attribute is always printed
echo -ne $dev_begin$begin"name="\"$name\"
+ print_attr "uniquetype"
+ print_attr "class"
+ print_attr "subclass"
+ print_attr "type"
print_attr "status"
# print the path, see note for ibmveth above
if [[ $format == "" || $format =~ "path" ]]; then
- echo -ne $path_begin
- echo -ne $separator$begin"name="\"$parent\"
- echo -ne $separator$begin"physloc="$physloc
- echo $path_end
+ echo -ne $path_begin\"$parent\"
+ echo -ne $separator$begin"connection="\"$connection\"
+ echo -ne $separator$begin"physloc="\"$physloc\"
+ echo -ne $separator$begin"path_id="\""0"\"
+ echo -ne $separator$begin"path_status="\"$status\"
+ echo -ne $path_end
fi
# done with this target
echo -ne $dev_end
@@ -247,13 +365,75 @@
for dev in $($LS -d /proc/device-tree/vdevice/vfc-client* 2> /dev/null) ; do
# pull the physical location
physloc=$(cat $dev/ibm,loc-code)
+ connection=$(echo $dev | $SED -e "s/\/proc\/device-tree\/vdevice\/vfc-client@//")
+ hostphysloc=$physloc
# find the slot so it can be used in sysfs
slot=$(echo $dev | $SED -e "s/\/proc\/device-tree\/vdevice\/vfc-client@//")
# there is only one host per device, assign it to the path's name
for host in $($LS -d /sys/devices/vio/$slot/host*) ; do
- parent=$(echo $host/scsi_host* | $SED -e "s/.*://")
+ parent=$(echo $host | $SED -e "s/.*\///")
+ name=$parent
+
+ uniquetype="adapter/vdevice/IBM,vfc-client"
+ class="adapter"
+ subclass="vdevice"
+ type="IBM,vfc-client"
+ prefix="host"
+ driver="ibmvfc"
+
+ host=$($LS -d /sys/devices/vio/$slot/host*/)
+ if [[ -d $host/scsi_host ]]; then
+ scsihost=$($LS -d $host/scsi_host/host*/)
+ else
+ scsihost=$($LS -d $host/scsi_host*/)
+ fi
+
+ if [[ $(cat $scsihost/state) == "running" ]] ; then
+ status=1
+ else
+ status=0
+ fi
+
+ show=1
+ # if there is a criteria in the command line, check if this
+ # device matches
+ if [[ $criteria != "" ]] ; then
+ show=0
+ check_criteria "name"
+ check_criteria "physloc"
+ check_criteria "status"
+ check_criteria "uniquetype"
+ check_criteria "class"
+ check_criteria "subclass"
+ check_criteria "type"
+ check_criteria "prefix"
+ check_criteria "driver"
+ fi
+
+ if [[ $show -ne 0 ]]; then
+ # the name attribute is always printed
+ echo -ne $dev_begin$begin"name="\"$name\"
+
+ print_attr "uniquetype"
+ print_attr "class"
+ print_attr "subclass"
+ print_attr "type"
+ print_attr "prefix"
+ print_attr "driver"
+ print_attr "status"
+
+ # print the path, see note for ibmveth above
+ if [[ $format == "" || $format =~ "path" ]]; then
+ echo -ne $path_begin"\"vio\""
+ echo -ne $separator$begin"connection="\"$connection\"
+ echo -ne $separator$begin"physloc="\"$physloc\"
+ echo -ne $path_end
+ fi
+ # done with this target
+ echo -ne $dev_end
+ fi
# As opposed to ibmvscsi, there are multiple rports in each host
for rport in $($LS -d $host/rport*); do
@@ -262,7 +442,18 @@
# the targets
for t in $($LS -d $rport/target*); do
for target in $($LS $t | $GREP "[0-9]*:[0-9]*:[0-9]*:[0-9]*"); do
- name=$(echo $($LS -d $t/$target/block*) | $SED -e "s/.*://")
+ if [[ ! -d $t/$target/block ]]; then
+ name=$(echo $($LS -d $t/$target/block*) | $SED -e "s/.*://")
+ else
+ name=$($LS $t/$target/block)
+ fi
+
+ connection=$($OFPATHNAME /dev/$name 2> /dev/null | $SED -e "s/.*disk@//")
+ physloc=$hostphysloc"-W"$(echo $connection | $TR "[:lower:]" "[:upper:]" | $SED -e "s/,/-L/")
+ uniquetype="disk/fcp/disk"
+ class="disk"
+ subclass="fcp"
+ type="disk"
if [[ $(cat $t/$target/state) == "running" ]] ; then
status=1
@@ -270,15 +461,24 @@
status=0
fi
- show=1
+ # if there is a criteria in the command line, we are recursive and
+ # the parent passed criteria, show the device
+ if [[ $criteria != "" && $show -eq 1 && $recursive -eq 1 ]]; then
+ show=1
+ elif [[ $criteria != "" ]] ; then
# if there is a criteria in the command line, check if this
- # device matches
- if [[ $criteria != "" ]] ; then
- show=0
+ # device matches
+ show=0
check_criteria "name"
check_criteria "physloc"
check_criteria "status"
check_criteria "parent"
+ check_criteria "uniquetype"
+ check_criteria "class"
+ check_criteria "subclass"
+ check_criteria "type"
+ else
+ show=1
fi
# print the info only if the device matches the criteria
@@ -286,13 +486,19 @@
# the name attribute is always printed
echo -ne $dev_begin$begin"name="\"$name\"
+ print_attr "uniquetype"
+ print_attr "class"
+ print_attr "subclass"
+ print_attr "type"
print_attr "status"
# print the path, see note for ibmveth above
if [[ $format == "" || $format =~ "path" ]]; then
- echo -ne $path_begin
- echo -ne $separator$begin"name="\"$parent\"
- echo -ne $separator$begin"physloc="$physloc
+ echo -ne $path_begin\"$parent\"
+ echo -ne $separator$begin"connection="\"$connection\"
+ echo -ne $separator$begin"physloc="\"$physloc\"
+ echo -ne $separator$begin"path_id="\""0"\"
+ echo -ne $separator$begin"path_status="\"$status\"
echo -ne $path_end
fi
# done with this device

View File

@ -1,245 +0,0 @@
Adds ls-vscsi, ls-veth, and ls-vdev scripts the HMC can call
to retrieve VIO related information from Linux.
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---
powerpc-utils.spec.in | 3 +
scripts/Makefile.am | 4 +-
scripts/Makefile.in | 4 +-
scripts/ls-vdev | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++
scripts/ls-veth | 64 ++++++++++++++++++++++++++++++++++++++++++
scripts/ls-vscsi | 62 ++++++++++++++++++++++++++++++++++++++++
6 files changed, 209 insertions(+), 4 deletions(-)
Index: powerpc-utils-1.2.2/scripts/ls-vdev
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ powerpc-utils-1.2.2/scripts/ls-vdev 2010-05-17 15:38:03.137899550 -0500
@@ -0,0 +1,76 @@
+#! /bin/bash
+
+# Copyright (c) 2010 International Business Machines
+# Common Public License Version 1.0 (see COPYRIGHT)
+#
+# Author Brian King <brking@linux.vnet.ibm.com>
+#
+# ls-vdev - This utility provides the HMC or IVM with name information for
+# virtual scsi adapters and devices
+#
+
+LSVDEV="ls-vdev"
+VERSION="0.1"
+LS="/bin/ls"
+GREP="/bin/grep"
+SED="/bin/sed"
+
+usage()
+{
+ echo "Usage: $LSVDEV"
+ echo "Provide information on Virtual SCSI adapters and devices"
+ echo ""
+ echo "Optional arguments."
+ echo " -V, --version Display version information and exit"
+ echo " -h, --help Display this help information and exit"
+ echo ""
+}
+
+show_version()
+{
+ echo "$LSVDEV: Version $VERSION"
+ echo "Written by: Brian King <brking@linux.vnet.ibm.com>"
+}
+
+
+while getopts "Vh" flag ; do
+ case "$flag" in
+ V) show_version
+ exit 0 ;;
+
+ h) usage
+ exit 0 ;;
+ \?) usage
+ exit 1 ;;
+ :) echo "Option -$OPTARG requires an argument."
+ exit 1 ;;
+ esac
+done
+
+# Look at every ibmvscsi (Virtual SCSI) device
+for dev in $($LS -d /proc/device-tree/vdevice/v-scsi* 2> /dev/null) ; do
+ # find the slot so it can be used in sysfs
+ slot=$(echo $dev | $SED -e "s/\/proc\/device-tree\/vdevice\/v-scsi@//")
+
+ # there is only one host per device, assign it to the path's name
+ for host in $($LS -d /sys/devices/vio/$slot/host*) ; do
+ parent=$(echo $host | $SED -e "s/.*\///")
+ host=$($LS -d /sys/devices/vio/$slot/host*/)
+
+ # loop through the targets for this host.
+ for t in $($LS -d $host/target*); do
+ target=$(echo $($LS -d $t/$($LS $t | $GREP -v uevent | $GREP -v power | $GREP -v subsystem)))
+ if [[ ! -d $target/block ]]; then
+ name=$(echo $($LS -d $target/block*) | $SED -e "s/.*://")
+ else
+ name=$($LS $target/block)
+ fi
+
+ echo "$parent $name"
+ done
+ done
+done
+
+exit 0
+
+# end
Index: powerpc-utils-1.2.2/scripts/ls-veth
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ powerpc-utils-1.2.2/scripts/ls-veth 2010-05-17 15:38:03.137899550 -0500
@@ -0,0 +1,64 @@
+#! /bin/bash
+
+# Copyright (c) 2010 International Business Machines
+# Common Public License Version 1.0 (see COPYRIGHT)
+#
+# Author Brian King <brking@linux.vnet.ibm.com>
+#
+# ls-veth - This utility provides the HMC or IVM with name information for
+# virtual ethernet devices
+#
+
+LSVETH="ls-veth"
+VERSION="0.1"
+OFPATHNAME="/usr/sbin/ofpathname"
+CAT="/bin/cat"
+LS="/bin/ls"
+SED="/bin/sed"
+
+usage()
+{
+ echo "Usage: $LSVETH [-h]"
+ echo "Provide information on Virtual Ethernet devices"
+ echo ""
+ echo "Optional arguments."
+ echo " -V, --version Display version information and exit"
+ echo " -h, --help Display this help information and exit"
+ echo ""
+}
+
+show_version()
+{
+ echo "$LSVETH: Version $VERSION"
+ echo "Written by: Brian King <brking@linux.vnet.ibm.com>"
+}
+
+
+while getopts "Vh" flag ; do
+ case "$flag" in
+ V) show_version
+ exit 0 ;;
+
+ h) usage
+ exit 0 ;;
+ \?) usage
+ exit 1 ;;
+ :) echo "Option -$OPTARG requires an argument."
+ exit 1 ;;
+ esac
+done
+
+# Look at every ibmveth (Virtual Ethernet) device
+for dev in $($LS -d /proc/device-tree/vdevice/l-lan* 2> /dev/null); do
+ # use ofpathname to get the device name (i.e. eth0)
+ name=$($OFPATHNAME -l $(echo $dev | $SED -e "s/\/proc\/device-tree//"))
+
+ # get the physical location
+ physloc=$($CAT $dev/ibm,loc-code)
+
+ echo "$name $physloc"
+done
+
+exit 0
+
+# end
Index: powerpc-utils-1.2.2/scripts/ls-vscsi
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ powerpc-utils-1.2.2/scripts/ls-vscsi 2010-05-17 15:38:03.137899550 -0500
@@ -0,0 +1,62 @@
+#! /bin/bash
+
+# Copyright (c) 2010 International Business Machines
+# Common Public License Version 1.0 (see COPYRIGHT)
+#
+# Author Brian King <brking@linux.vnet.ibm.com>
+#
+# ls-vscsi - This utility provides the HMC or IVM with name information for
+# virtual scsi devices
+#
+
+LSVSCSI="ls-vscsi"
+VERSION="0.1"
+CAT="/bin/cat"
+LS="/bin/ls"
+SED="/bin/sed"
+
+usage()
+{
+ echo "Usage: $LSVSCSI"
+ echo "Provide information on Virtual devices"
+}
+
+show_version()
+{
+ echo "$LSVSCSI: Version $VERSION"
+ echo "Written by: Brian King <brking@linux.vnet.ibm.com>"
+}
+
+
+while getopts "Vh" flag ; do
+ case "$flag" in
+
+ V) show_version
+ exit 0 ;;
+
+ h) usage
+ exit 0 ;;
+ \?) usage
+ exit 1 ;;
+ esac
+done
+
+
+# Look at every ibmvscsi (Virtual SCSI) device
+for dev in $($LS -d /proc/device-tree/vdevice/v-scsi* 2> /dev/null) ; do
+ # pull the physical location
+ physloc=$($CAT $dev/ibm,loc-code)
+
+ # find the slot so it can be used in sysfs
+ slot=$(echo $dev | $SED -e "s/\/proc\/device-tree\/vdevice\/v-scsi@//")
+
+ # there is only one host per device, assign it to the path's name
+ for host in $($LS -d /sys/devices/vio/$slot/host*) ; do
+ name=$(echo $host | $SED -e "s/.*\///")
+ echo "$name $physloc"
+ done
+done
+
+exit 0
+
+# end
Index: powerpc-utils-1.2.2/scripts/Makefile.am
===================================================================
--- powerpc-utils-1.2.2.orig/scripts/Makefile.am 2009-10-22 14:00:13.000000000 -0500
+++ powerpc-utils-1.2.2/scripts/Makefile.am 2010-05-17 15:39:55.017270084 -0500
@@ -1,7 +1,7 @@
bin_SCRIPTS = amsstat
sbin_SCRIPTS = update_flash hvcsadmin vscsisadmin rtas_dump snap \
- bootlist ofpathname lsdevinfo
+ bootlist ofpathname lsdevinfo ls-veth ls-vscsi ls-vdev
initdir = /etc/init.d
init_DATA = ibmvscsis.sh

View File

@ -1,39 +0,0 @@
commit 7a17ff0743cdec7ee2edb2b3aad347566136b6d5
Author: Nathan Fontenot <nfont@shady-lp2.ltc.austin.ibm.com>
Date: Wed Apr 7 20:19:01 2010 -0500
This patch adds -a -V options to the ofpathname man page.
Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
diff --git a/man/ofpathname.8 b/man/ofpathname.8
index 1f61b88..d5abc17 100644
--- a/man/ofpathname.8
+++ b/man/ofpathname.8
@@ -6,7 +6,7 @@
.SH NAME
ofpathname \- translate between Open Firmware and logical device names
.SH SYNOPSIS
-\fB/usr/sbin/ofpathname \fR[\fB-lq\fR] \fIname
+\fB/usr/sbin/ofpathname \fR[\fB-laqVh\fR] \fIname
.SH DESCRIPTION
.I Ofpathname
provides the ability to translate logical device names to their Open Firmware
@@ -17,10 +17,16 @@ Firmware device path to its logical device name using the -l option.
\fB\-l
Translate the \fIname \fRparameter to the corresponding logical device name.
.TP
+\fB\-a
+Find a matching Open Firmware device alias[es].
+.TP
\fB\--quiet \fR(\fB\-q\fR)
Do not report any failures, exit quietly.
.TP
-\fB\--help \fR(\fB\-?\fR)
+\fB\--version \fR(\fB\-V\fR)
+Displat version and exit
+.TP
+\fB\--help \fR(\fB\-h\fR)
print usage information.
.SH AUTHOR
Written by Nathan Fontenot

View File

@ -1,26 +0,0 @@
Index: powerpc-utils/scripts/ofpathname
===================================================================
--- powerpc-utils.orig/scripts/ofpathname 2010-05-05 08:57:48.000000000 -0500
+++ powerpc-utils/scripts/ofpathname 2010-05-18 08:15:43.000000000 -0500
@@ -386,14 +386,15 @@
#
l2of_ethernet()
{
- local sysfs_eth=`$FIND /sys -name $DEVICE 2> /dev/null`
- if [[ -z $sysfs_eth ]]; then
- err $ERR_NOT_CONFIG
- fi
+ for syspath in `$FIND /sys -name $DEVICE 2> /dev/null`; do
+ if [[ -e $syspath/device/devspec ]]; then
+ OF_PATH=`$CAT $syspath/device/devspec`
+ break
+ fi
+ done
- OF_PATH=`$CAT $sysfs_eth/device/devspec`
if [[ -z $OF_PATH ]]; then
- err $ERR_NO_OFPATH
+ err $ERR_NO_OFPATH
fi
}

View File

@ -1,42 +0,0 @@
This patch corrects the parameter handling of ppc64_cpu when setting the
run-mode. The PAPR specifies that the rtas_[get|set]_system_parameter calls
take a char buffer, but for the run mode it actually wants integer values in
the buffer, not strings. This updates the handling of the values to be
integers.
This patch also add an additional error message to indicate failure when a
partition is not authorized to set the run mode.
Signed-off-by:Nathan Fontenot <nfont@austin.ibm.com>
---
Index: powerpc-utils-1.2.2/src/ppc64_cpu.c
===================================================================
--- powerpc-utils-1.2.2.orig/src/ppc64_cpu.c 2010-06-10 13:22:02.000000000 -0500
+++ powerpc-utils-1.2.2/src/ppc64_cpu.c 2010-06-10 13:33:09.810455522 -0500
@@ -416,11 +416,11 @@
printf("Could not retrieve current diagnostics "
"mode\n");
} else
- printf("run-mode=%c\n", mode[2]);
+ printf("run-mode=%d\n", mode[2]);
} else {
- signed char rmode = *run_mode;
+ short rmode = atoi(run_mode);
- if (rmode < '0' || rmode > '3') {
+ if (rmode < 0 || rmode > 3) {
printf("Invalid run-mode=%c\n", rmode);
return -1;
}
@@ -433,6 +433,9 @@
if (rc == -3)
printf("Machine does not support diagnostic "
"run mode\n");
+ else if (rc == -9002)
+ printf("Machine is not authorized to set "
+ "diagnostic run mode\n");
else
printf("Could not set diagnostics mode\n");
}

View File

@ -1,157 +0,0 @@
The current logic in ppc64_cpu will loop through the maximum number
of cpu threads (set to 1024) when trying to determine or set a particular
cpu attribuite.
For example, when setting smt mode, the code would try to set cpu
thread 0..1024 either online or offline until a failure occurs. This
usually was trying to set the smt mode for a cpu thread that does not exist.
While this is mostly harmless, the side effect was that an error was returned
even though the smt setting operation completed successfully.
This patch changes the logic so that it only tries to set cpu attributes for
the cpu threads that are present on the system. This resolves the inadvertent
error return and is logically a bit nicer than trying all possible threads.
Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
---
src/ppc64_cpu.c | 50 ++++++++++++++++++++++++++++----------------------
1 file changed, 28 insertions(+), 22 deletions(-)
Index: powerpc-utils/src/ppc64_cpu.c
===================================================================
--- powerpc-utils.orig/src/ppc64_cpu.c 2009-12-01 13:31:21.000000000 -0600
+++ powerpc-utils/src/ppc64_cpu.c 2009-12-02 13:53:34.000000000 -0600
@@ -19,11 +19,12 @@
#define SYSFS_CPUDIR "/sys/devices/system/cpu/cpu%d"
#define INTSERV_PATH "/proc/device-tree/cpus/%s/ibm,ppc-interrupt-server#s"
#define SYSFS_PATH_MAX 128
-#define MAX_THREADS 1024
#define DIAGNOSTICS_RUN_MODE 42
-int threads_per_cpu;
+int threads_per_cpu = 0;
+int cpus_in_system = 0;
+int threads_in_system = 0;
int get_attribute(char *path, int *value)
{
@@ -72,7 +73,7 @@
int i, rc;
int system_attribute = -1;
- for (i = 0; i < MAX_THREADS; i++) {
+ for (i = 0; i < threads_in_system; i++) {
int cpu_attribute;
/* only check online cpus */
@@ -99,7 +100,7 @@
char path[SYSFS_PATH_MAX];
int i, rc;
- for (i = 0; i < MAX_THREADS; i++) {
+ for (i = 0; i < threads_in_system; i++) {
/* only set online cpus */
if (!cpu_online(i))
continue;
@@ -113,11 +114,11 @@
return 0;
}
-int get_threads_per_cpu(void)
+int get_cpu_info(void)
{
DIR *d;
struct dirent *de;
- int nthreads = -1;
+ int first_cpu = 1;
int rc;
d = opendir("/proc/device-tree/cpus");
@@ -126,20 +127,25 @@
while ((de = readdir(d)) != NULL) {
if (!strncmp(de->d_name, "PowerPC", 7)) {
- struct stat sbuf;
- char path[128];
+ if (first_cpu) {
+ struct stat sbuf;
+ char path[128];
+
+ sprintf(path, INTSERV_PATH, de->d_name);
+ rc = stat(path, &sbuf);
+ if (!rc)
+ threads_per_cpu = sbuf.st_size / 4;
- sprintf(path, INTSERV_PATH, de->d_name);
- rc = stat(path, &sbuf);
- if (!rc)
- nthreads = sbuf.st_size / 4;
+ first_cpu = 0;
+ }
- break;
+ cpus_in_system++;
}
}
closedir(d);
- return nthreads;
+ threads_in_system = cpus_in_system * threads_per_cpu;
+ return 0;
}
int is_smt_capable(void)
@@ -148,7 +154,7 @@
char path[SYSFS_PATH_MAX];
int i;
- for (i = 0; i < MAX_THREADS; i++) {
+ for (i = 0; i < threads_in_system; i++) {
sprintf(path, SYSFS_CPUDIR"/smt_snooze_delay", i);
if (stat(path, &sb))
continue;
@@ -187,7 +193,7 @@
int system_state = -1;
int i;
- for (i = 0; i < MAX_THREADS; i += threads_per_cpu) {
+ for (i = 0; i < threads_in_system; i += threads_per_cpu) {
int cpu_state;
cpu_state = get_one_smt_state(i);
@@ -236,7 +242,7 @@
if (rc)
update_ssd = 0;
- for (i = 0; i < MAX_THREADS; i += threads_per_cpu) {
+ for (i = 0; i < threads_in_system; i += threads_per_cpu) {
rc = set_one_smt_state(i, smt_state);
if (rc)
break;
@@ -254,7 +260,7 @@
char path[SYSFS_PATH_MAX];
int i;
- for (i = 0; i < MAX_THREADS; i++) {
+ for (i = 0; i < threads_in_system; i++) {
sprintf(path, SYSFS_CPUDIR"/dscr", i);
if (stat(path, &sb))
continue;
@@ -436,10 +442,10 @@
return 0;
}
- threads_per_cpu = get_threads_per_cpu();
- if (threads_per_cpu < 0) {
- printf("Could not determine thread count\n");
- return -1;
+ rc = get_cpu_info();
+ if (rc) {
+ printf("Could not determine system cpu/thread information.\n");
+ return rc;
}
while (1) {

View File

@ -1,30 +0,0 @@
Index: powerpc-utils/scripts/ofpathname
===================================================================
--- powerpc-utils.orig/scripts/ofpathname 2010-05-18 08:15:43.000000000 -0500
+++ powerpc-utils/scripts/ofpathname 2010-05-18 08:28:47.000000000 -0500
@@ -232,12 +232,23 @@
{
local this_dir=$PWD
local sysfs_dir
+ local udev_path
local udevinfo="/usr/bin/udevinfo"
+ local udevadm="/sbin/udevadm"
- if [[ ! -a $udevinfo ]]; then
+ if [[ -a $udevadm ]]; then
+ udev_path=`$udevadm info --query=path --name=$DEVNAME`
+ elif [[ -a $udevinfo ]]; then
+ udev_path=`$udevinfo -q path -n $DEVNAME`
+ else
+ echo "no"
+ return
+ fi
+
+ if [[ -z $udev_path ]]; then
echo "no"
else
- sysfs_dir=`get_link -f /sys/$($udevinfo -q path -n $DEVNAME)/device`
+ sysfs_dir=`get_link -f /sys/$udev_path/device`
if [[ ! -d $sysfs_dir ]]; then
echo "no"
else

View File

@ -1,150 +0,0 @@
There are several build warnings generated when building the powerpc-utils
package, most of these are just innocuous initializations of variables.
There are a couple of larger changes such as in serv_config.c where the
results of the fread call needed to be properly checked.
Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
---
src/drmgr/common_pci.c | 4 ++--
src/drmgr/drslot_chrp_cpu.c | 4 ++--
src/drmgr/drslot_chrp_mem.c | 2 +-
src/drmgr/rtas_calls.c | 2 +-
src/nvram.c | 3 ++-
src/ppc64_cpu.c | 5 +++--
src/serv_config.c | 7 +++----
7 files changed, 14 insertions(+), 13 deletions(-)
Index: powerpc-utils/src/ppc64_cpu.c
===================================================================
--- powerpc-utils.orig/src/ppc64_cpu.c 2009-12-01 10:55:06.000000000 -0600
+++ powerpc-utils/src/ppc64_cpu.c 2009-12-01 13:31:21.000000000 -0600
@@ -117,7 +117,7 @@
{
DIR *d;
struct dirent *de;
- int nthreads;
+ int nthreads = -1;
int rc;
d = opendir("/proc/device-tree/cpus");
@@ -427,7 +427,8 @@
int main(int argc, char *argv[])
{
- int rc, opt;
+ int rc = 0;
+ int opt;
int option_index;
if (argc == 1) {
Index: powerpc-utils/src/drmgr/common_pci.c
===================================================================
--- powerpc-utils.orig/src/drmgr/common_pci.c 2009-12-01 10:55:06.000000000 -0600
+++ powerpc-utils/src/drmgr/common_pci.c 2009-12-01 13:52:06.000000000 -0600
@@ -620,8 +620,8 @@
struct dr_connector *drc_list;
struct dr_connector *drc;
struct dr_node *node;
- int child_dev_type;
- int rc;
+ int child_dev_type = 0;
+ int rc = -1;
drc_list = get_drc_info(path);
if (drc_list == NULL)
Index: powerpc-utils/src/drmgr/drslot_chrp_cpu.c
===================================================================
--- powerpc-utils.orig/src/drmgr/drslot_chrp_cpu.c 2009-12-01 13:35:11.000000000 -0600
+++ powerpc-utils/src/drmgr/drslot_chrp_cpu.c 2009-12-01 13:35:42.000000000 -0600
@@ -66,7 +66,7 @@
struct dr_node *
get_available_cpu(struct options *opts, struct dr_info *dr_info)
{
- struct dr_node *cpu;
+ struct dr_node *cpu = NULL;
struct dr_node *survivor = NULL;
struct thread *t;
@@ -297,7 +297,7 @@
drslot_chrp_cpu(struct options *opts)
{
struct dr_info dr_info;
- int rc;
+ int rc = -1;
if (! cpu_dlpar_capable()) {
err_msg("CPU DLPAR capability is not enabled on this "
Index: powerpc-utils/src/drmgr/drslot_chrp_mem.c
===================================================================
--- powerpc-utils.orig/src/drmgr/drslot_chrp_mem.c 2009-12-01 10:55:06.000000000 -0600
+++ powerpc-utils/src/drmgr/drslot_chrp_mem.c 2009-12-01 13:36:42.000000000 -0600
@@ -1062,7 +1062,7 @@
int
drslot_chrp_mem(struct options *opts)
{
- int rc;
+ int rc = -1;
if (opts->p_option) {
/* This is a entitlement or weight change */
Index: powerpc-utils/src/drmgr/rtas_calls.c
===================================================================
--- powerpc-utils.orig/src/drmgr/rtas_calls.c 2009-12-01 10:55:06.000000000 -0600
+++ powerpc-utils/src/drmgr/rtas_calls.c 2009-12-01 13:39:31.000000000 -0600
@@ -267,7 +267,7 @@
struct of_node *first_node = NULL;
struct of_node *last_node = NULL; /* Last node processed */
struct of_property *property;
- struct of_property *last_property; /* Last property processed */
+ struct of_property *last_property = NULL; /* Last property processed */
int *work_int;
int rc;
Index: powerpc-utils/src/serv_config.c
===================================================================
--- powerpc-utils.orig/src/serv_config.c 2009-12-01 10:55:06.000000000 -0600
+++ powerpc-utils/src/serv_config.c 2009-12-01 13:49:42.000000000 -0600
@@ -1673,10 +1673,8 @@
return 2;
}
rc = fread(buffer, 1, BUF_SIZE, fp);
- buffer[rc-1] = '\0';
- pclose(fp);
-
- if (buffer) {
+ if (!ferror(fp)) {
+ buffer[rc] = '\0';
if (strstr(buffer, "ibm,setupcfg"))
nvram_setupcfg = 1;
if (strstr(buffer, "common"))
@@ -1684,6 +1682,7 @@
if (strstr(buffer, "of-config"))
nvram_ofconfig = 1;
}
+ pclose(fp);
if (verbose > 1) {
printf("ibm,setupcfg NVRAM partition %s.\n",
Index: powerpc-utils/src/nvram.c
===================================================================
--- powerpc-utils.orig/src/nvram.c 2009-12-01 13:50:57.000000000 -0600
+++ powerpc-utils/src/nvram.c 2009-12-01 14:03:28.000000000 -0600
@@ -42,6 +42,7 @@
#include <netinet/in.h> /* for ntohs */
#include <glob.h>
#include <getopt.h>
+#include <inttypes.h>
#include "nvram.h"
@@ -1020,7 +1021,7 @@
/* ToDo: what is the length of the data? We dump until the
next cpu data. */
len = cpu_regs[cpu+1] - cpu_regs[cpu];
- printf("CPU %d Register Data (len=%x, offset=%x)\n", cpu, len,
+ printf("CPU %d Register Data (len=%x, offset=%"PRIx64")\n", cpu, len,
cpu_regs[cpu]-p);
if (len < 4096) /* reasonable bound */
dump_raw_data((char *)cpu_regs[cpu], len);

View File

@ -1,6 +1,6 @@
Name: powerpc-utils
Version: 1.2.2
Release: 14%{?dist}
Version: 1.2.6
Release: 1%{?dist}
Summary: Utilities for PowerPC platforms
Group: System Environment/Base
@ -18,42 +18,6 @@ ExclusiveArch: ppc ppc64
# This hack is needed only for platforms with autoconf < 2.63
Patch1: powerpc-utils-autoconf.patch
# correct the parameter checking when attempting to set the run mode
Patch2: powerpc-utils-cpu_diag_mode.patch
# 599711
Patch3: powerpc-utils-lsdevinfo.patch
# 599711, new ls-{vscsi,vdev,veth} scripts
Patch4: powerpc-utils-lsvio.patch
# 599714, correct searching in sysfs
Patch5: powerpc-utils-multieth.patch
# 599714, Update ofpathname to use udevadm
Patch6: powerpc-utils-udevadm.patch
# Fix some warnings. Pre-req for patch8,9
Patch7: powerpc-utils-warnings.patch
# pre-req for Patch9.
Patch8: powerpc-utils-threads.patch
# 599716, Use hex values
Patch9: powerpc-utils-cpudscr.patch
# 599719, Correct cpu dlpar capable check
Patch10: powerpc-utils-cpu_dlpar_check.patch
# Corrects the parameter handling of ppc64_cpu when setting the run-mode
Patch11: powerpc-utils-run_mode.patch
# 602717, amsstat changes from upstream
Patch12: powerpc-utils-amsstat.patch
# 607356, ofpathname man page update
Patch13: powerpc-utils-man_ofpathname.patch
# This is done before release of F12
Obsoletes: powerpc-utils-papr < 1.1.6-3
Provides: powerpc-utils-papr = 1.1.6-3
@ -69,21 +33,7 @@ Utilities for PowerPC platforms.
%patch1 -p1 -b .aconf
%endif
%patch2 -p1 -b .cpu_diag_mode
%patch3 -p1 -b .lsdevinfo
%patch4 -p1 -b .lsvio
%patch5 -p1 -b .multieth
%patch6 -p1 -b .udevadm
%patch7 -p1 -b .warnings
%patch8 -p1 -b .threads
%patch9 -p1 -b .cpudscr
%patch10 -p1 -b .cpu_dlpar_check
%patch11 -p1 -b .run_mode
%patch12 -p1 -b .amsstat
%patch13 -p1 -b .man_ofpathname
%build
./bootstrap.sh
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
%configure
make %{?_smp_mflags}
@ -159,7 +109,7 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man8/ibmvscsis.conf.8*
%{_mandir}/man8/rtas_dump.8*
%{_mandir}/man8/sys_ident.8*
%{_mandir}/man1/amsvis.1*
%{_mandir}/man5/lparcfg.5*
%{_mandir}/man1/amsstat.1*
%doc README COPYRIGHT Changelog
@ -168,6 +118,11 @@ rm -rf $RPM_BUILD_ROOT
%preun
%changelog
* Mon Jan 24 2011 Jiri Skala <jskala@redhat.com> - 1.2.6-1
- updated to latest upstream 1.2.6
- removed amsvis man page (amsvis moved to powerpc-utils-python)
- added lparcfg man page - doc to /proc/ppc64/lparcfg
* Thu Jun 24 2010 Roman Rakus <rrakus@redhat.com> - 1.2.2-14
- Compile with -fno-strict-aliasing CFLAG
- linked nvsetenv man page to nvram man page

View File

@ -1 +1 @@
07a057c920c9e2ee03d7b8ef16e3bf1d powerpc-utils-1.2.2.tar.gz
f57c8a1bd2046b9ef738b4968a3d0ce2 powerpc-utils-1.2.6.tar.gz