From patchwork Mon Jul 11 14:02:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian King X-Patchwork-Id: 104210 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 4D0E6B6FF5 for ; Tue, 12 Jul 2011 00:02:57 +1000 (EST) Received: from e6.ny.us.ibm.com (e6.ny.us.ibm.com [32.97.182.146]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e6.ny.us.ibm.com", Issuer "Equifax" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id B90EBB6F82 for ; Tue, 12 Jul 2011 00:02:55 +1000 (EST) Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by e6.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p6BDcdlT031896 for ; Mon, 11 Jul 2011 09:38:39 -0400 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p6BE2hNV098974 for ; Mon, 11 Jul 2011 10:02:44 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p6BE2QpG029539 for ; Mon, 11 Jul 2011 10:02:27 -0400 Received: from localhost.localdomain (sig-9-49-189-235.mts.ibm.com [9.49.189.235]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p6BE2PUu029455; Mon, 11 Jul 2011 10:02:25 -0400 Message-Id: <201107111402.p6BE2PUu029455@d01av04.pok.ibm.com> Subject: [PATCH 3/5] ofpath: Add support for fibre channel devices To: yaboot-devel@lists.ozlabs.org From: Brian King Date: Mon, 11 Jul 2011 09:02:30 -0500 X-BeenThere: yaboot-devel@lists.ozlabs.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical and development discussion regarding yaboot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: yaboot-devel-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: yaboot-devel-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Adds support for fibre channel devices to ofpath for IBM Power Systems. Signed-off-by: Brian King --- ybin/ofpath | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) 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 }