Added some upstream patches
This commit is contained in:
parent
69e331f559
commit
61d6aaedeb
17
powerpc-utils-cpu_dlpar_check.patch
Normal file
17
powerpc-utils-cpu_dlpar_check.patch
Normal file
@ -0,0 +1,17 @@
|
||||
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);
|
||||
|
205
powerpc-utils-cpudscr.patch
Normal file
205
powerpc-utils-cpudscr.patch
Normal file
@ -0,0 +1,205 @@
|
||||
---
|
||||
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;
|
424
powerpc-utils-lsdevinfo.patch
Normal file
424
powerpc-utils-lsdevinfo.patch
Normal file
@ -0,0 +1,424 @@
|
||||
|
||||
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
|
245
powerpc-utils-lsvio.patch
Normal file
245
powerpc-utils-lsvio.patch
Normal file
@ -0,0 +1,245 @@
|
||||
|
||||
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
|
26
powerpc-utils-multieth.patch
Normal file
26
powerpc-utils-multieth.patch
Normal file
@ -0,0 +1,26 @@
|
||||
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
|
||||
}
|
||||
|
157
powerpc-utils-threads.patch
Normal file
157
powerpc-utils-threads.patch
Normal file
@ -0,0 +1,157 @@
|
||||
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) {
|
||||
|
30
powerpc-utils-udevadm.patch
Normal file
30
powerpc-utils-udevadm.patch
Normal file
@ -0,0 +1,30 @@
|
||||
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
|
150
powerpc-utils-warnings.patch
Normal file
150
powerpc-utils-warnings.patch
Normal file
@ -0,0 +1,150 @@
|
||||
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);
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: powerpc-utils
|
||||
Version: 1.2.2
|
||||
Release: 4%{?dist}
|
||||
Release: 10%{?dist}
|
||||
Summary: Utilities for PowerPC platforms
|
||||
|
||||
Group: System Environment/Base
|
||||
@ -21,6 +21,31 @@ 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
|
||||
|
||||
|
||||
# This is done before release of F12
|
||||
Obsoletes: powerpc-utils-papr < 1.1.6-3
|
||||
Provides: powerpc-utils-papr = 1.1.6-3
|
||||
@ -37,6 +62,15 @@ Utilities for PowerPC platforms.
|
||||
%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
|
||||
|
||||
|
||||
%build
|
||||
./bootstrap.sh
|
||||
@ -90,6 +124,11 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_sbindir}/sys_ident
|
||||
%{_sbindir}/drmgr
|
||||
%{_sbindir}/lsslot
|
||||
%{_sbindir}/ls-vdev
|
||||
%{_sbindir}/ls-veth
|
||||
%{_sbindir}/ls-vscsi
|
||||
|
||||
|
||||
%{_bindir}/amsstat
|
||||
%{_mandir}/man8/update_flash.8*
|
||||
%{_mandir}/man8/activate_firmware.8*
|
||||
@ -114,6 +153,10 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%preun
|
||||
|
||||
%changelog
|
||||
* Wed Jun 09 2010 Roman Rakus <rrakus@redhat.com> - 1.2.2-10
|
||||
- Added some upstream patches
|
||||
- also bump release
|
||||
|
||||
* Wed Jun 02 2010 Roman Rakus <rrakus@redhat.com> - 1.2.2-4
|
||||
- correct the parameter checking when attempting to set the run mode
|
||||
- also bump release
|
||||
|
Loading…
Reference in New Issue
Block a user