@@ -880,6 +880,29 @@ oldworld()
return 0
}
+eth_ofpath()
+{
+ read_attr devspec /sys/class/net/$DEVICE/device
+}
+
+hfi_ofpath()
+{
+ local hfnum=${DEVICE##hf}
+ local hfpath
+
+ if [[ $hfnum = "0" || $hfnum = "2" ]]; then
+ hfpath=$(find /proc/device-tree -name hfi-ethernet* | sort | head -n 1)
+ elif [[ $hfnum = "1" || $hfnum = "3" ]]; then
+ hfpath=$(find /proc/device-tree -name hfi-ethernet* | sort | tail -n 1)
+ else
+ echo 1>&2 "$PRG: Unsupported device: $DEVICE"
+ return 1
+ fi
+
+ hfpath=${hfpath##/proc/device-tree}
+ echo "$hfpath"
+}
+
## find OpenFirmware device path for IBM CHRP hardware (scsi only)
chrp()
{
@@ -893,6 +916,12 @@ chrp()
## find the actual OF path.
scsi_ofpath || return 1
;;
+ eth*)
+ eth_ofpath || return 1
+ ;;
+ hfi*)
+ hfi_ofpath || return 1
+ ;;
*)
echo 1>&2 "$PRG: Device: /dev/$DEVNODE is not supported"
return 1
@@ -1084,15 +1113,6 @@ else
exit 1
fi
-## check that FILE is a block device and exists.
-if [ ! -e "$device" ] ; then
- echo 1>&2 "$PRG: $device: No such file or directory"
- exit 1
-elif [ ! -b "$device" ] ; then
- echo 1>&2 "$PRG: $device is not a block device"
- exit 1
-fi
-
## check that we are running on a GNU/Linux system, OSX/BSD does not
## have the same /proc stuff
if [ `uname -s` != Linux ] ; then
Adds support for HFI and ethernet devices to ofpath for IBM Power Systems. Signed-off-by: Brian King <brking@linux.vnet.ibm.com> --- ybin/ofpath | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-)