Patchwork [3/5] ofpath: Add support for fibre channel devices

login
register
mail settings
Submitter Brian King
Date July 11, 2011, 2:02 p.m.
Message ID <201107111402.p6BE2PUu029455@d01av04.pok.ibm.com>
Download mbox | patch
Permalink /patch/104210/
State Superseded
Headers show

Comments

Brian King - July 11, 2011, 2:02 p.m.
Adds support for fibre channel devices to ofpath for IBM Power Systems.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---

 ybin/ofpath |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

Patch

diff -puN ybin/ofpath~ofpath_fc ybin/ofpath
--- yaboot/ybin/ofpath~ofpath_fc	2011-06-24 13:54:57.000000000 -0500
+++ yaboot-bjking1/ybin/ofpath	2011-06-24 13:55:36.000000000 -0500
@@ -464,6 +464,40 @@  scsi_ofpath2()
                 return 0
         fi
 
+        local fc=${DEVSPEC%@*}
+        fc=${fc##/*/}
+
+        if [[ -e /proc/device-tree$DEVSPEC/device_type ]]; then
+                local devtype=$(cat /proc/device-tree$DEVSPEC/device_type);
+                if [[ $devtype = "fcp" || $devtype = "scsi-fcp" ]]; then
+                        fc="fibre-channel";
+                fi
+        fi
+
+        if [[ $fc = "fibre-channel" ]]; then
+                local wwpn=$(get_fc_wwpn "$DEVICE_PATH/../../fc_remote_ports*")
+                local ofpath=$DEVSPEC
+
+                if [[ ! -e /proc/device-tree$DEVSPEC/disk ]]; then
+                        for dir in `find /proc/device-tree$DEVSPEC -type d`; do
+                                if [[ -e $dir/disk ]]; then
+                                        ofpath=${dir##/proc/device-tree}
+                                        break;
+                                fi
+                        done
+                fi
+
+                ofpath=$(printf "%s/disk@%s" $ofpath $wwpn)
+
+                if [[ $DEVICE_LUN != "0" ]]; then
+                        local fc_lun=$(get_fc_scsilun $DEVICE_LUN)
+                        ofpath=$(printf "%s,%s" $ofpath $fc_lun)
+                fi
+
+                echo "$ofpath"
+                return 0
+        fi
+
         echo 1>&2 "$PRG: Driver: $SCSI_DRIVER is not supported"
         return 1
 }