X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ybin%2Fofpath;fp=ybin%2Fofpath;h=1a601bbc4a6532576a698726dcfcfb593991c122;hb=ad973226cb9266ce5cf6946833387c0549c4f3f2;hp=1bb33babff635a3731a5157860fb83330c9b3212;hpb=b96b73386a75d4f06b0a094527e1bda1f6aa6589;p=yaboot.git diff --git a/ybin/ofpath b/ybin/ofpath index 1bb33ba..1a601bb 100755 --- a/ybin/ofpath +++ b/ybin/ofpath @@ -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