Blame SOURCES/0039-sas-handle-port-expanders-at-all.patch

5e6fc3
From 3e687d8072f3ed53ae727ec2cb99ae56dbcdf02b Mon Sep 17 00:00:00 2001
5e6fc3
From: Peter Jones <pjones@redhat.com>
5e6fc3
Date: Mon, 1 Oct 2018 14:35:01 -0400
5e6fc3
Subject: [PATCH 39/39] sas: handle port expanders at all.
5e6fc3
5e6fc3
Signed-off-by: Peter Jones <pjones@redhat.com>
5e6fc3
---
5e6fc3
 src/linux-ata.c  |   3 +-
5e6fc3
 src/linux-sas.c  | 168 ++++++++++++++++++++++++++++++++++++++++++-----
5e6fc3
 src/linux-scsi.c | 105 +++++++++++++++++++++++++----
5e6fc3
 src/linux.h      |   6 +-
5e6fc3
 4 files changed, 250 insertions(+), 32 deletions(-)
5e6fc3
5e6fc3
diff --git a/src/linux-ata.c b/src/linux-ata.c
5e6fc3
index 32cb99361e5..43e5f4c5d23 100644
5e6fc3
--- a/src/linux-ata.c
5e6fc3
+++ b/src/linux-ata.c
5e6fc3
@@ -114,7 +114,8 @@ parse_ata(struct device *dev, const char *current, const char *root UNUSED)
5e6fc3
 
5e6fc3
         pos = parse_scsi_link(host + 1, &scsi_host,
5e6fc3
                               &scsi_bus, &scsi_device,
5e6fc3
-                              &scsi_target, &scsi_lun);
5e6fc3
+                              &scsi_target, &scsi_lun,
5e6fc3
+                              NULL, NULL, NULL);
5e6fc3
         if (pos < 0)
5e6fc3
                 return -1;
5e6fc3
 
5e6fc3
diff --git a/src/linux-sas.c b/src/linux-sas.c
5e6fc3
index 4d77d39a24d..bb04fe83064 100644
5e6fc3
--- a/src/linux-sas.c
5e6fc3
+++ b/src/linux-sas.c
5e6fc3
@@ -28,6 +28,91 @@
5e6fc3
 
5e6fc3
 #include "efiboot.h"
5e6fc3
 
5e6fc3
+static int
5e6fc3
+get_port_expander_sas_address(uint64_t *sas_address, uint32_t scsi_host,
5e6fc3
+                              uint32_t local_port_id,
5e6fc3
+                              uint32_t remote_port_id, uint32_t remote_scsi_target)
5e6fc3
+{
5e6fc3
+        uint8_t *filebuf = NULL;
5e6fc3
+        int rc;
5e6fc3
+
5e6fc3
+        /*
5e6fc3
+         * We find sas_address via this insanity:
5e6fc3
+         * /sys/class/scsi_host/host2 -> ../../devices/pci0000:74/0000:74:02.0/host2/scsi_host/host2
5e6fc3
+         * /sys/devices/pci0000:74/0000:74:02.0/host2/scsi_host/host2/device -> ../../../host2
5e6fc3
+         * /sys/devices/pci0000:74/0000:74:02.0/host2/device -> ../../../host2
5e6fc3
+         * /sys/devices/host2/port-2:0/expander-2:0/sas_device/expander-2:0/sas_address
5e6fc3
+         *
5e6fc3
+         * But since host2 is always host2, we can skip most of that and just
5e6fc3
+         * go for:
5e6fc3
+         * /sys/devices/pci0000:74/0000:74:02.0/host2/port-2:0/expander-2:0/port-2:0:2/end_device-2:0:2/sas_device/end_device-2:0:2/sas_address
5e6fc3
+        */
5e6fc3
+
5e6fc3
+#if 0 /* previously thought this was right, but it's the expander's address, not the target's address */
5e6fc3
+        /*
5e6fc3
+         * /sys/class/scsi_host/host2/device/port-2:0/expander-2:0/sas_device/expander-2:0/sas_address
5e6fc3
+         * ... I think.  I would have expected that to be port-2:0:0 and I
5e6fc3
+         * don't understand why it isn't. (I do now; this is the expander not
5e6fc3
+         * the port.)
5e6fc3
+         */
5e6fc3
+
5e6fc3
+        debug("looking for /sys/class/scsi_host/host%d/device/port-%d:%d/expander-%d:%d/sas_device/expander-%d:%d/sas_address",
5e6fc3
+              scsi_host, scsi_host, port_id, scsi_host, remote_scsi_target, scsi_host, remote_scsi_target);
5e6fc3
+        rc = read_sysfs_file(&filebuf,
5e6fc3
+                             "class/scsi_host/host%d/device/port-%d:%d/expander-%d:%d/sas_device/expander-%d:%d/sas_address",
5e6fc3
+                             scsi_host, scsi_host, port_id, scsi_host, remote_scsi_target, scsi_host, remote_scsi_target);
5e6fc3
+        if (rc < 0 || filebuf == NULL) {
5e6fc3
+                debug("didn't find it.");
5e6fc3
+                return -1;
5e6fc3
+        }
5e6fc3
+#else
5e6fc3
+        debug("looking for /sys/class/scsi_host/host%d/device/port-%d:%d/expander-%d:%d/port-%d:%d:%d/end_device-%d:%d:%d/sas_device/end_device-%d:%d:%d/sas_address",
5e6fc3
+              scsi_host,
5e6fc3
+              scsi_host, local_port_id,
5e6fc3
+              scsi_host, remote_scsi_target,
5e6fc3
+              scsi_host, remote_scsi_target, remote_port_id,
5e6fc3
+              scsi_host, remote_scsi_target, remote_port_id,
5e6fc3
+              scsi_host, remote_scsi_target, remote_port_id);
5e6fc3
+        rc = read_sysfs_file(&filebuf,
5e6fc3
+                             "class/scsi_host/host%d/device/port-%d:%d/expander-%d:%d/port-%d:%d:%d/end_device-%d:%d:%d/sas_device/end_device-%d:%d:%d/sas_address",
5e6fc3
+                             scsi_host,
5e6fc3
+                             scsi_host, local_port_id,
5e6fc3
+                             scsi_host, remote_scsi_target,
5e6fc3
+                             scsi_host, remote_scsi_target, remote_port_id,
5e6fc3
+                             scsi_host, remote_scsi_target, remote_port_id,
5e6fc3
+                             scsi_host, remote_scsi_target, remote_port_id);
5e6fc3
+        if (rc < 0 || filebuf == NULL) {
5e6fc3
+                debug("didn't find it.");
5e6fc3
+                return -1;
5e6fc3
+        }
5e6fc3
+#endif
5e6fc3
+
5e6fc3
+        rc = sscanf((char *)filebuf, "%"PRIx64, sas_address);
5e6fc3
+        if (rc != 1)
5e6fc3
+                return -1;
5e6fc3
+
5e6fc3
+        return 0;
5e6fc3
+}
5e6fc3
+
5e6fc3
+static int
5e6fc3
+get_local_sas_address(uint64_t *sas_address, struct device *dev)
5e6fc3
+{
5e6fc3
+        int rc;
5e6fc3
+        char *filebuf = NULL;
5e6fc3
+
5e6fc3
+        rc = read_sysfs_file(&filebuf,
5e6fc3
+                             "class/block/%s/device/sas_address",
5e6fc3
+                             dev->disk_name);
5e6fc3
+        if (rc < 0 || filebuf == NULL)
5e6fc3
+                return -1;
5e6fc3
+
5e6fc3
+        rc = sscanf((char *)filebuf, "%"PRIx64, sas_address);
5e6fc3
+        if (rc != 1)
5e6fc3
+                return -1;
5e6fc3
+
5e6fc3
+        return 0;
5e6fc3
+}
5e6fc3
+
5e6fc3
 /*
5e6fc3
  * support for SAS devices
5e6fc3
  *
5e6fc3
@@ -43,6 +128,24 @@
5e6fc3
  * /sys/class/block/sdc/device/sas_address
5e6fc3
  *
5e6fc3
  * I'm not sure at the moment if they're the same or not.
5e6fc3
+ *
5e6fc3
+ * There are also other devices that look like:
5e6fc3
+ *
5e6fc3
+ * 8:0 -> ../../devices/pci0000:74/0000:74:02.0/host2/port-2:0/expander-2:0/port-2:0:2/end_device-2:0:2/target2:0:0/2:0:0:0/block/sda
5e6fc3
+ * 8:1 -> ../../devices/pci0000:74/0000:74:02.0/host2/port-2:0/expander-2:0/port-2:0:2/end_device-2:0:2/target2:0:0/2:0:0:0/block/sda/sda1
5e6fc3
+ *
5e6fc3
+ * /sys/dev/block/8:0/device -> ../../../2:0:0:0
5e6fc3
+ *
5e6fc3
+ * This exists:
5e6fc3
+ *
5e6fc3
+ * /sys/class/scsi_host/host2 -> ../../devices/pci0000:74/0000:74:02.0/host2/scsi_host/host2
5e6fc3
+ * /sys/devices/pci0000:74/0000:74:02.0/host2/scsi_host/host2/device -> ../../../host2
5e6fc3
+ * /sys/devices/pci0000:74/0000:74:02.0/host2/device -> ../../../host2
5e6fc3
+ * /sys/devices/pci0000:74/0000:74:02.0/host2/port-2:0/expander-2:0/sas_device/expander-2:0/sas_address
5e6fc3
+ *
5e6fc3
+ * but the device doesn't actually have a sas_host_address, because it's on a
5e6fc3
+ * port expander, and sas_address doesn't directly exist under /sys/class/
5e6fc3
+ * anywhere.
5e6fc3
  */
5e6fc3
 static ssize_t
5e6fc3
 parse_sas(struct device *dev, const char *current, const char *root UNUSED)
5e6fc3
@@ -50,16 +153,19 @@ parse_sas(struct device *dev, const char *current, const char *root UNUSED)
5e6fc3
         struct stat statbuf = { 0, };
5e6fc3
         int rc;
5e6fc3
         uint32_t scsi_host, scsi_bus, scsi_device, scsi_target;
5e6fc3
+        uint32_t local_port_id = 0, remote_port_id = 0;
5e6fc3
+        uint32_t remote_scsi_target = 0;
5e6fc3
         uint64_t scsi_lun;
5e6fc3
         ssize_t pos;
5e6fc3
-        uint8_t *filebuf = NULL;
5e6fc3
-        uint64_t sas_address;
5e6fc3
+        uint64_t sas_address = 0;
5e6fc3
 
5e6fc3
         debug("entry");
5e6fc3
 
5e6fc3
         pos = parse_scsi_link(current, &scsi_host,
5e6fc3
                               &scsi_bus, &scsi_device,
5e6fc3
-                              &scsi_target, &scsi_lun);
5e6fc3
+                              &scsi_target, &scsi_lun,
5e6fc3
+                              &local_port_id, &remote_port_id,
5e6fc3
+                              &remote_scsi_target);
5e6fc3
         /*
5e6fc3
          * If we can't parse the scsi data, it isn't a sas device, so return 0
5e6fc3
          * not error.
5e6fc3
@@ -71,6 +177,7 @@ parse_sas(struct device *dev, const char *current, const char *root UNUSED)
5e6fc3
          * Make sure it has the actual /SAS/ bits before we continue
5e6fc3
          * validating all this junk.
5e6fc3
          */
5e6fc3
+        debug("looking for /sys/class/scsi_host/host%d/host_sas_address", scsi_host);
5e6fc3
         rc = sysfs_stat(&statbuf,
5e6fc3
                         "class/scsi_host/host%d/host_sas_address",
5e6fc3
                         scsi_host);
5e6fc3
@@ -79,21 +186,48 @@ parse_sas(struct device *dev, const char *current, const char *root UNUSED)
5e6fc3
          * 0 not error. Later errors mean it is an ata device, but we can't
5e6fc3
          * parse it right, so they return -1.
5e6fc3
          */
5e6fc3
-        if (rc < 0)
5e6fc3
-                return 0;
5e6fc3
+        if (rc < 0) {
5e6fc3
+                debug("didn't find it.");
5e6fc3
+                /*
5e6fc3
+                 * If it's on a port expander, it won't have the
5e6fc3
+                 * host_sas_address, so we need to check if it's a sas_host
5e6fc3
+                 * instead.
5e6fc3
+                 * It may work to just check this to begin with, but I don't
5e6fc3
+                 * have such a device in front of me right now.
5e6fc3
+                 */
5e6fc3
+                debug("looking for /sys/class/sas_host/host%d", scsi_host);
5e6fc3
+                rc = sysfs_stat(&statbuf,
5e6fc3
+                                "class/sas_host/host%d", scsi_host);
5e6fc3
+                if (rc < 0) {
5e6fc3
+                        debug("didn't find it.");
5e6fc3
+                        return 0;
5e6fc3
+                }
5e6fc3
+                debug("found it.");
5e6fc3
 
5e6fc3
-        /*
5e6fc3
-         * we also need to get the actual sas_address from someplace...
5e6fc3
-         */
5e6fc3
-        rc = read_sysfs_file(&filebuf,
5e6fc3
-                             "class/block/%s/device/sas_address",
5e6fc3
-                             dev->disk_name);
5e6fc3
-        if (rc < 0 || filebuf == NULL)
5e6fc3
-                return -1;
5e6fc3
-
5e6fc3
-        rc = sscanf((char *)filebuf, "%"PRIx64, &sas_address);
5e6fc3
-        if (rc != 1)
5e6fc3
-                return -1;
5e6fc3
+                /*
5e6fc3
+                 * So it *is* a sas_host, and we have to fish the sas_address
5e6fc3
+                 * from the remote port
5e6fc3
+                 */
5e6fc3
+                rc = get_port_expander_sas_address(&sas_address, scsi_host,
5e6fc3
+                                                   local_port_id,
5e6fc3
+                                                   remote_port_id,
5e6fc3
+                                                   remote_scsi_target);
5e6fc3
+                if (rc < 0) {
5e6fc3
+                        debug("Couldn't find port expander sas address");
5e6fc3
+                        return 0;
5e6fc3
+                }
5e6fc3
+        } else {
5e6fc3
+                /*
5e6fc3
+                 * we also need to get the actual sas_address from someplace...
5e6fc3
+                 */
5e6fc3
+                debug("found it.");
5e6fc3
+                rc = get_local_sas_address(&sas_address, dev);
5e6fc3
+                if (rc < 0) {
5e6fc3
+                        debug("Couldn't find sas address");
5e6fc3
+                        return 0;
5e6fc3
+                }
5e6fc3
+        }
5e6fc3
+        debug("sas address is 0x%"PRIx64, sas_address);
5e6fc3
 
5e6fc3
         dev->sas_info.sas_address = sas_address;
5e6fc3
 
5e6fc3
diff --git a/src/linux-scsi.c b/src/linux-scsi.c
5e6fc3
index 2e4f710badf..a5e81cf9cb6 100644
5e6fc3
--- a/src/linux-scsi.c
5e6fc3
+++ b/src/linux-scsi.c
5e6fc3
@@ -38,7 +38,9 @@
5e6fc3
 ssize_t HIDDEN
5e6fc3
 parse_scsi_link(const char *current, uint32_t *scsi_host,
5e6fc3
                 uint32_t *scsi_bus, uint32_t *scsi_device,
5e6fc3
-                uint32_t *scsi_target, uint64_t *scsi_lun)
5e6fc3
+                uint32_t *scsi_target, uint64_t *scsi_lun,
5e6fc3
+                uint32_t *local_port_id, uint32_t *remote_port_id,
5e6fc3
+                uint32_t *remote_target_id)
5e6fc3
 {
5e6fc3
         int rc;
5e6fc3
         int sz = 0;
5e6fc3
@@ -70,11 +72,32 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
5e6fc3
          * /sys/block/sdc/device looks like:
5e6fc3
          * device-> ../../../4:2:0:0
5e6fc3
          *
5e6fc3
+         * OR
5e6fc3
+         *
5e6fc3
+         * 8:0 -> ../../devices/pci0000:74/0000:74:02.0/host2/port-2:0/expander-2:0/port-2:0:2/end_device-2:0:2/target2:0:0/2:0:0:0/block/sda
5e6fc3
+         * 8:1 -> ../../devices/pci0000:74/0000:74:02.0/host2/port-2:0/expander-2:0/port-2:0:2/end_device-2:0:2/target2:0:0/2:0:0:0/block/sda/sda1
5e6fc3
+         *
5e6fc3
+         * /sys/block/sda/device looks like:
5e6fc3
+         * device -> ../../../2:0:0:0 *
5e6fc3
+         *
5e6fc3
+         * sas_address exists, but it's hard to find:
5e6fc3
+         * /sys/devices/pci0000:74/0000:74:02.0/host2/port-2:0/expander-2:0/sas_device/expander-2:0/sas_address
5e6fc3
+         * but sas_host_address is nowhere to be found, and sas_address
5e6fc3
+         * doesn't directly exist under /sys/class/ anywhere.  So you actually
5e6fc3
+         * have to go to
5e6fc3
+         * /sys/devices/pci0000:74/0000:74:02.0/host2/port-2:0/expander-2:0/sas_device/expander-2:0/sas_address
5e6fc3
+         * and chop that off to
5e6fc3
+         * /sys/devices/pci0000:74/0000:74:02.0/host2/port-2:0/expander-2:0/
5e6fc3
+         * and then add a bunch of port and end device crap to it to get:
5e6fc3
+         * /sys/devices/pci0000:74/0000:74:02.0/host2/port-2:0/expander-2:0/port-2:0:2/end_device-2:0:2/sas_device/end_device-2:0:2/sas_address
5e6fc3
+
5e6fc3
          */
5e6fc3
 
5e6fc3
         /*
5e6fc3
          * So we start when current is:
5e6fc3
          * host4/port-4:0/end_device-4:0/target4:0:0/4:0:0:0/block/sdc/sdc1
5e6fc3
+         * or
5e6fc3
+         * host2/port-2:0/expander-2:0/port-2:0:2/end_device-2:0:2/target2:0:0/2:0:0:0/block/sda/sda1
5e6fc3
          */
5e6fc3
         uint32_t tosser0, tosser1, tosser2;
5e6fc3
 
5e6fc3
@@ -91,6 +114,14 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
5e6fc3
         sz += pos0;
5e6fc3
         pos0 = 0;
5e6fc3
 
5e6fc3
+        /*
5e6fc3
+         * We might have this next:
5e6fc3
+         * port-2:0/expander-2:0/port-2:0:2/end_device-2:0:2/target2:0:0/2:0:0:0/block/sda/sda1
5e6fc3
+         * or:
5e6fc3
+         * port-2:0/end_device-2:0:2/target2:0:0/2:0:0:0/block/sda/sda1
5e6fc3
+         * or maybe (not sure):
5e6fc3
+         * port-2:0:2/end_device-2:0:2/target2:0:0/2:0:0:0/block/sda/sda1
5e6fc3
+         */
5e6fc3
         debug("searching for port-4:0 or port-4:0:0");
5e6fc3
         rc = sscanf(current+sz, "port-%d:%d%n:%d%n", &tosser0,
5e6fc3
                     &tosser1, &pos0, &tosser2, &pos1);
5e6fc3
@@ -100,6 +131,52 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
5e6fc3
         if (rc == 2 || rc == 3) {
5e6fc3
                 sz += pos0;
5e6fc3
                 pos0 = 0;
5e6fc3
+                if (local_port_id && rc == 2)
5e6fc3
+                        *local_port_id = tosser1;
5e6fc3
+                if (remote_port_id && rc == 3)
5e6fc3
+                        *remote_port_id = tosser2;
5e6fc3
+
5e6fc3
+                if (current[sz] == '/')
5e6fc3
+                        sz += 1;
5e6fc3
+
5e6fc3
+                /*
5e6fc3
+                 * We might have this next:
5e6fc3
+                 * expander-2:0/port-2:0:2/end_device-2:0:2/target2:0:0/2:0:0:0/block/sda/sda1
5e6fc3
+                 *                       ^ port id
5e6fc3
+                 *                     ^ scsi target id
5e6fc3
+                 *                   ^ host number
5e6fc3
+                 *          ^ host number
5e6fc3
+                 * We don't actually care about either number in expander-.../,
5e6fc3
+                 * because they're replicated in all the other places.  We just need
5e6fc3
+                 * to get past it.
5e6fc3
+                 */
5e6fc3
+                debug("searching for expander-4:0/");
5e6fc3
+                rc = sscanf(current+sz, "expander-%d:%d/%n", &tosser0, &tosser1, &pos0);
5e6fc3
+                debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
5e6fc3
+                arrow(LOG_DEBUG, spaces, 9, pos0, rc, 2);
5e6fc3
+                if (rc == 2) {
5e6fc3
+                        if (!remote_target_id) {
5e6fc3
+                                efi_error("Device is PHY is a remote target, but remote_target_id is NULL");
5e6fc3
+                                return -1;
5e6fc3
+                        }
5e6fc3
+                        *remote_target_id = tosser1;
5e6fc3
+                        sz += pos0;
5e6fc3
+                        pos0 = 0;
5e6fc3
+
5e6fc3
+                        /*
5e6fc3
+                         * if we have that, we should have a 3-part port next
5e6fc3
+                         */
5e6fc3
+                        debug("searching for port-2:0:2/");
5e6fc3
+                        rc = sscanf(current+sz, "port-%d:%d:%d/%n", &tosser0, &tosser1, &tosser2, &pos0);
5e6fc3
+                        debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
5e6fc3
+                        arrow(LOG_DEBUG, spaces, 9, pos0, rc, 3);
5e6fc3
+                        if (rc != 3) {
5e6fc3
+                                efi_error("Couldn't parse port expander port string");
5e6fc3
+                                return -1;
5e6fc3
+                        }
5e6fc3
+                        sz += pos0;
5e6fc3
+                }
5e6fc3
+                pos0 = 0;
5e6fc3
 
5e6fc3
                 /* next:
5e6fc3
                  *    /end_device-4:0
5e6fc3
@@ -107,22 +184,24 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
5e6fc3
                  * awesomely these are the exact same fields that go into port-blah,
5e6fc3
                  * but we don't care for now about any of them anyway.
5e6fc3
                  */
5e6fc3
-                debug("searching for /end_device-4:0/ or /end_device-4:0:0/");
5e6fc3
-                rc = sscanf(current + sz, "/end_device-%d:%d%n", &tosser0, &tosser1, &pos0);
5e6fc3
+                debug("searching for end_device-4:0/ or end_device-4:0:0/");
5e6fc3
+                rc = sscanf(current + sz, "end_device-%d:%d%n", &tosser0, &tosser1, &pos0);
5e6fc3
                 debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
5e6fc3
-                arrow(LOG_DEBUG, spaces, 9, pos0, rc, 2);
5e6fc3
                 if (rc != 2)
5e6fc3
                         return -1;
5e6fc3
-                sz += pos0;
5e6fc3
-                pos0 = 0;
5e6fc3
 
5e6fc3
-                rc = sscanf(current + sz, ":%d%n", &tosser0, &pos0);
5e6fc3
-                debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
5e6fc3
-                arrow(LOG_DEBUG, spaces, 9, pos0, rc, 2);
5e6fc3
+                pos1 = 0;
5e6fc3
+                rc = sscanf(current + sz + pos0, ":%d%n", &tosser2, &pos1);
5e6fc3
+                arrow(LOG_DEBUG, spaces, 9, pos0, rc + 2, 2);
5e6fc3
+                arrow(LOG_DEBUG, spaces, 9, pos0 + pos1, rc + 2, 3);
5e6fc3
                 if (rc != 0 && rc != 1)
5e6fc3
                         return -1;
5e6fc3
-                sz += pos0;
5e6fc3
-                pos0 = 0;
5e6fc3
+                if (remote_port_id && rc == 1)
5e6fc3
+                        *remote_port_id = tosser2;
5e6fc3
+                if (local_port_id && rc == 0)
5e6fc3
+                        *local_port_id = tosser1;
5e6fc3
+                sz += pos0 + pos1;
5e6fc3
+                pos0 = pos1 = 0;
5e6fc3
 
5e6fc3
                 if (current[sz] == '/')
5e6fc3
                         sz += 1;
5e6fc3
@@ -156,6 +235,7 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
5e6fc3
                 return -1;
5e6fc3
         sz += pos0;
5e6fc3
 
5e6fc3
+        debug("returning %d", sz);
5e6fc3
         return sz;
5e6fc3
 }
5e6fc3
 
5e6fc3
@@ -191,7 +271,8 @@ parse_scsi(struct device *dev, const char *current, const char *root UNUSED)
5e6fc3
 
5e6fc3
         sz = parse_scsi_link(current, &scsi_host,
5e6fc3
                               &scsi_bus, &scsi_device,
5e6fc3
-                              &scsi_target, &scsi_lun);
5e6fc3
+                              &scsi_target, &scsi_lun,
5e6fc3
+                              NULL, NULL, NULL);
5e6fc3
         if (sz < 0)
5e6fc3
                 return 0;
5e6fc3
 
5e6fc3
diff --git a/src/linux.h b/src/linux.h
5e6fc3
index 7c7ea91e771..43a9b7899f5 100644
5e6fc3
--- a/src/linux.h
5e6fc3
+++ b/src/linux.h
5e6fc3
@@ -267,8 +267,10 @@ struct dev_probe {
5e6fc3
 };
5e6fc3
 
5e6fc3
 extern ssize_t parse_scsi_link(const char *current, uint32_t *host,
5e6fc3
-                                      uint32_t *bus, uint32_t *device,
5e6fc3
-                                      uint32_t *target, uint64_t *lun);
5e6fc3
+                               uint32_t *bus, uint32_t *device,
5e6fc3
+                               uint32_t *target, uint64_t *lun,
5e6fc3
+                               uint32_t *local_port_id, uint32_t *remote_port_id,
5e6fc3
+                               uint32_t *remote_target_id);
5e6fc3
 
5e6fc3
 /* device support implementations */
5e6fc3
 extern struct dev_probe pmem_parser;
5e6fc3
-- 
5e6fc3
2.17.1
5e6fc3