Fix for not all device trees having k2-sata@N/compatible (from gentoo)
authorPaul Nasrat <pnasrat@redhat.com>
Tue, 11 Jul 2006 20:18:09 +0000 (16:18 -0400)
committerPaul Nasrat <pauln@enki.eridu>
Tue, 11 Jul 2006 20:18:09 +0000 (16:18 -0400)
ybin/ofpath

index 3724eb19a2b041200db003bccb721d7bc57f979c..9cddc916b6e0a21a1885ab28d0292a623b9c75b1 100755 (executable)
@@ -298,10 +298,18 @@ scsi_ofpath()
            echo "${DEVICE_PATH##*device-tree}/@$DEVICE_ID:$PARTITION"
            ;;
        ata_k2|sata_svw)
            echo "${DEVICE_PATH##*device-tree}/@$DEVICE_ID:$PARTITION"
            ;;
        ata_k2|sata_svw)
+            #Not all G5 device trees have a compatible "k2-sata" node 
+            #per channel use parent
            HOST_LIST="$(for i in `find /proc/device-tree -name compatible ` ; do
            HOST_LIST="$(for i in `find /proc/device-tree -name compatible ` ; do
-                       lgrep "$i" "k2-sata" ; done | sort)"
+                       lgrep "$i" "k2-s-ata" ; done | sort)"
            DEVICE_PATH="$(printhost $SCSI_HOSTNUMBER $HOST_LIST)"
            DEVICE_PATH="$(printhost $SCSI_HOSTNUMBER $HOST_LIST)"
-           echo "${DEVICE_PATH##*device-tree}/disk@0:$PARTITION"
+           K2_DEVICE_ID=0
+           while [ "$DEVICE_PATH" = "" ] ; do
+               SCSI_HOSTNUMBER=`expr $SCSI_HOSTNUMBER - 1`
+               let "K2_DEVICE_ID += 1"
+               DEVICE_PATH="$(printhost $SCSI_HOSTNUMBER $HOST_LIST)"
+           done
+           echo "${DEVICE_PATH##*device-tree}/k2-sata@$K2_DEVICE_ID/disk@0:$PARTITION"
            ;;
         sbp2)
             HOST_LIST="$(for i in `find /proc/device-tree -name name` ; do
            ;;
         sbp2)
             HOST_LIST="$(for i in `find /proc/device-tree -name name` ; do