diff -Nru powerpc-ibm-utils-1.2.26/debian/changelog powerpc-ibm-utils-1.2.26/debian/changelog --- powerpc-ibm-utils-1.2.26/debian/changelog 2015-10-20 10:59:34.000000000 -0200 +++ powerpc-ibm-utils-1.2.26/debian/changelog 2016-03-01 20:32:03.000000000 -0300 @@ -1,3 +1,13 @@ +powerpc-ibm-utils (1.2.26-2ubuntu1nvme2) UNRELEASED; urgency=medium + + * Add support for NVMe logical/OpenFirmware device paths (LP: #) + - ofpathname-nvme-l2of.patch: NVMe: convert logical device path to + OpenFirmware device path. + - ofpathname-nvme-of2l.patch: NVMe: convert OpenFirmware device path + to logical device path. + + -- Mauricio Faria de Oliveira Tue, 01 Mar 2016 20:31:04 -0300 + powerpc-ibm-utils (1.2.26-2ubuntu1) wily; urgency=medium * mpath_mappings.patch: Map /dev/mapper/mpath* to the right dm-* devices diff -Nru powerpc-ibm-utils-1.2.26/debian/patches/ofpathname-nvme-l2of.patch powerpc-ibm-utils-1.2.26/debian/patches/ofpathname-nvme-l2of.patch --- powerpc-ibm-utils-1.2.26/debian/patches/ofpathname-nvme-l2of.patch 1969-12-31 21:00:00.000000000 -0300 +++ powerpc-ibm-utils-1.2.26/debian/patches/ofpathname-nvme-l2of.patch 2016-03-01 20:37:50.000000000 -0300 @@ -0,0 +1,107 @@ +From 9feee312c1fe8a54463823e6f2bae564fc1df289 Mon Sep 17 00:00:00 2001 +From: Mauricio Faria de Oliveira +Date: Tue, 1 Mar 2016 18:39:14 -0300 +Subject: [PATCH 1/2] ofpathname: Convert logical device path to OF device path + for NVMe devices + +Add support to convert logical device path to Open firmware device path for NVMe devices. + +Signed-off-by: Mauricio Faria de Oliveira +--- + scripts/ofpathname | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 74 insertions(+) + +diff --git a/scripts/ofpathname b/scripts/ofpathname +index ac30c89..da41d8f 100755 +--- a/scripts/ofpathname ++++ b/scripts/ofpathname +@@ -477,6 +477,7 @@ logical_to_ofpathname() + logical_to_ofpathname + exit + ;; ++ nvme*) l2of_nvme ;; + *) # check if the device is a network interface + is_net=$(is_net_interface $DEVICE) + if [[ $is_net = "yes" ]]; then +@@ -616,6 +617,78 @@ l2of_hfi() + } + + # ++# l2of_nvme ++# Conversion routine for logical => OF path of nvme devices ++# ++l2of_nvme() ++{ ++ # OF path: /namespace@: ++ ++ # disk: nvmeX, nvmeXnY; not nvmeXnYpZ ++ local devdisk="${DEVICE%p[0-9]*}" ++ ++ # namespace id: Y in nvmeXnY, nvmeXnYpZ ++ local devnsid="${devdisk#nvme[0-9]*n}" ++ if [[ $devnsid = $devdisk ]]; then ++ devnsid='' # no namespace id ++ fi ++ ++ # partition number: Z in nvmeXnYpZ ++ local devpart="${DEVICE##*p}" ++ if [[ $devpart = $DEVICE ]]; then ++ devpart='' # no partition number ++ fi ++ ++ # Get the device-tree device specification (devspec). ++ local dir ++ local found=0 ++ ++ for dir in `$FIND /sys/devices -name "$DEVICE"`; do ++ cd $dir ++ ++ goto_dir $PWD "device/devspec" ++ ++ devspec=`$CAT $PWD/device/devspec` ++ if [[ -n $devspec ]]; then ++ found=1 ++ break ++ fi ++ done ++ ++ if [[ $found -eq 0 ]]; then ++ err $ERR_NO_SYSFS_DEVINFO ++ fi ++ ++ if [[ -z $devspec ]]; then ++ err $ERR_NO_OFPATH ++ fi ++ ++ # OF path: /namespace@: ++ OF_PATH="$devspec" ++ ++ # No namespace id (nY) specified. ++ if [[ -z $devnsid ]]; then ++ return ++ fi ++ ++ # Device type is usually 'namespace'. ++ # Get it from device-tree just in case. ++ devtype=`$CAT /proc/device-tree${devspec}/namespace/name` ++ if [[ -z $devtype ]]; then ++ err $ERR_NO_OFPATH ++ fi ++ ++ OF_PATH="$OF_PATH/$devtype@$devnsid" ++ ++ # No partition (pZ) specified. ++ if [[ -z $devpart ]]; then ++ return ++ fi ++ ++ OF_PATH="${OF_PATH}:${devpart}" ++} ++ ++# + # int_to_scsilun + # Conversion routine for SCSI HBTL LUN => SCSI LUN name + # +-- +1.8.3.1 + diff -Nru powerpc-ibm-utils-1.2.26/debian/patches/ofpathname-nvme-of2l.patch powerpc-ibm-utils-1.2.26/debian/patches/ofpathname-nvme-of2l.patch --- powerpc-ibm-utils-1.2.26/debian/patches/ofpathname-nvme-of2l.patch 1969-12-31 21:00:00.000000000 -0300 +++ powerpc-ibm-utils-1.2.26/debian/patches/ofpathname-nvme-of2l.patch 2016-03-01 20:29:25.000000000 -0300 @@ -0,0 +1,104 @@ +From f95003b1560783f143f455141e670ddfa8ebec13 Mon Sep 17 00:00:00 2001 +From: Mauricio Faria de Oliveira +Date: Tue, 1 Mar 2016 18:42:47 -0300 +Subject: [PATCH 2/2] ofpathname: Convert OF device path to logical device path + for NVMe devices + +Add support to convert a Open Firmware device path to logical device path for NVMe devices. + +Signed-off-by: Mauricio Faria de Oliveira +--- + scripts/ofpathname | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 63 insertions(+) + +diff --git a/scripts/ofpathname b/scripts/ofpathname +index da41d8f..6a1ad71 100755 +--- a/scripts/ofpathname ++++ b/scripts/ofpathname +@@ -999,6 +999,10 @@ ofpathname_to_logical() + fi + fi + ++ if [[ $DEVTYPE = "namespace" ]]; then ++ DEVTYPE="nvme" ++ fi ++ + # Remove any possible cdrom data from DEVICE + if [[ ${DEVICE##*,} = "\ppc\bootinfo.txt" || + ${DEVICE##*,} = \ppc\bootinfo.txt ]]; then +@@ -1023,6 +1027,7 @@ ofpathname_to_logical() + hfi-ethernet* ) of2l_hfi ;; + disk* ) of2l_ide ;; + usb ) of2l_usb ;; ++ nvme ) of2l_nvme ;; + esac + + if [[ -z $LOGICAL_DEVNAME ]]; then +@@ -1555,6 +1560,64 @@ of2l_fc() + } + + # ++# of2l_nvme ++# Conversion routine for OF path => logical name for nvme devices ++# ++of2l_nvme() ++{ ++ # get namespace id and partition number ++ local nsid_part=${DEVICE##*@} # [:partition-number] ++ local nsid=${nsid_part%:*} # namespace id ++ local part # partition number ++ ++ # set partition number only if ':' is present ++ case "${nsid_part}" in ++ *:*) ++ part=${nsid_part#*:} ++ ;; ++ esac ++ ++ local dir ++ local link ++ ++ for dir in `$FIND /sys/block -name "nvme*n$nsid"`; do ++ cd $dir ++ ++ link=`get_link "device"` # points to nvme[0-9]+ (non-namespace) ++ if [[ -n $link ]]; then ++ cd $link ++ else ++ continue ++ fi ++ ++ link=`get_link "device"` # points to pci address dir ++ if [[ -n $link ]]; then ++ cd $link ++ else ++ continue ++ fi ++ ++ goto_dir $PWD "devspec" ++ local devspec=`$CAT ./devspec 2>/dev/null` ++ ++ if [[ $devspec = $DEVPATH ]]; then ++ LOGICAL_DEVNAME="${dir##*/}" ++ break ++ fi ++ done ++ ++ if [[ -n $LOGICAL_DEVNAME ]] \ ++ && [[ -n $part ]]; then ++ ++ if [[ -d "/sys/block/${LOGICAL_DEVNAME}/${LOGICAL_DEVNAME}p${part}" ]]; then ++ LOGICAL_DEVNAME="${LOGICAL_DEVNAME}p${part}" ++ else ++ LOGICAL_DEVNAME='' ++ fi ++ fi ++} ++ ++# + # Main + # + . $PSERIES_PLATFORM +-- +1.8.3.1 + diff -Nru powerpc-ibm-utils-1.2.26/debian/patches/series powerpc-ibm-utils-1.2.26/debian/patches/series --- powerpc-ibm-utils-1.2.26/debian/patches/series 2015-10-20 10:52:33.000000000 -0200 +++ powerpc-ibm-utils-1.2.26/debian/patches/series 2016-03-01 20:29:38.000000000 -0300 @@ -2,3 +2,5 @@ stop_kexec_nv.patch stop_kexec_vm.patch mpath_mappings.patch +ofpathname-nvme-l2of.patch +ofpathname-nvme-of2l.patch