]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
scsi: cxlflash: Support up to 4 ports
authorMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Fri, 7 Jul 2017 16:05:28 +0000 (13:05 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fri, 14 Jul 2017 14:33:02 +0000 (11:33 -0300)
BugLink: http://bugs.launchpad.net/bugs/1702521
Update the driver to allow for future cards with 4 ports.

Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 1cd7fabc82eb06c834956113ff287f8848811fb8)
Signed-off-by: Victor Aoqui <victora@linux.vnet.ibm.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
drivers/scsi/cxlflash/main.c
drivers/scsi/cxlflash/sislite.h

index 64ad76b6b672f91a73364a584b7ae5f4b018e888..568cd636607a3371f4701c1c9228a264eef94741 100644 (file)
@@ -1419,7 +1419,7 @@ static int read_vpd(struct cxlflash_cfg *cfg, u64 wwpn[])
        ssize_t vpd_size;
        char vpd_data[CXLFLASH_VPD_LEN];
        char tmp_buf[WWPN_BUF_LEN] = { 0 };
-       char *wwpn_vpd_tags[MAX_FC_PORTS] = { "V5", "V6" };
+       char *wwpn_vpd_tags[MAX_FC_PORTS] = { "V5", "V6", "V7", "V8" };
 
        /* Get the VPD data from the device */
        vpd_size = cxl_read_adapter_vpd(pdev, vpd_data, sizeof(vpd_data));
@@ -2174,6 +2174,40 @@ static ssize_t port1_show(struct device *dev,
        return cxlflash_show_port_status(1, cfg, buf);
 }
 
+/**
+ * port2_show() - queries and presents the current status of port 2
+ * @dev:       Generic device associated with the host owning the port.
+ * @attr:      Device attribute representing the port.
+ * @buf:       Buffer of length PAGE_SIZE to report back port status in ASCII.
+ *
+ * Return: The size of the ASCII string returned in @buf.
+ */
+static ssize_t port2_show(struct device *dev,
+                         struct device_attribute *attr,
+                         char *buf)
+{
+       struct cxlflash_cfg *cfg = shost_priv(class_to_shost(dev));
+
+       return cxlflash_show_port_status(2, cfg, buf);
+}
+
+/**
+ * port3_show() - queries and presents the current status of port 3
+ * @dev:       Generic device associated with the host owning the port.
+ * @attr:      Device attribute representing the port.
+ * @buf:       Buffer of length PAGE_SIZE to report back port status in ASCII.
+ *
+ * Return: The size of the ASCII string returned in @buf.
+ */
+static ssize_t port3_show(struct device *dev,
+                         struct device_attribute *attr,
+                         char *buf)
+{
+       struct cxlflash_cfg *cfg = shost_priv(class_to_shost(dev));
+
+       return cxlflash_show_port_status(3, cfg, buf);
+}
+
 /**
  * lun_mode_show() - presents the current LUN mode of the host
  * @dev:       Generic device associated with the host.
@@ -2326,6 +2360,40 @@ static ssize_t port1_lun_table_show(struct device *dev,
        return cxlflash_show_port_lun_table(1, cfg, buf);
 }
 
+/**
+ * port2_lun_table_show() - presents the current LUN table of port 2
+ * @dev:       Generic device associated with the host owning the port.
+ * @attr:      Device attribute representing the port.
+ * @buf:       Buffer of length PAGE_SIZE to report back port status in ASCII.
+ *
+ * Return: The size of the ASCII string returned in @buf.
+ */
+static ssize_t port2_lun_table_show(struct device *dev,
+                                   struct device_attribute *attr,
+                                   char *buf)
+{
+       struct cxlflash_cfg *cfg = shost_priv(class_to_shost(dev));
+
+       return cxlflash_show_port_lun_table(2, cfg, buf);
+}
+
+/**
+ * port3_lun_table_show() - presents the current LUN table of port 3
+ * @dev:       Generic device associated with the host owning the port.
+ * @attr:      Device attribute representing the port.
+ * @buf:       Buffer of length PAGE_SIZE to report back port status in ASCII.
+ *
+ * Return: The size of the ASCII string returned in @buf.
+ */
+static ssize_t port3_lun_table_show(struct device *dev,
+                                   struct device_attribute *attr,
+                                   char *buf)
+{
+       struct cxlflash_cfg *cfg = shost_priv(class_to_shost(dev));
+
+       return cxlflash_show_port_lun_table(3, cfg, buf);
+}
+
 /**
  * irqpoll_weight_show() - presents the current IRQ poll weight for the host
  * @dev:       Generic device associated with the host.
@@ -2417,19 +2485,27 @@ static ssize_t mode_show(struct device *dev,
  */
 static DEVICE_ATTR_RO(port0);
 static DEVICE_ATTR_RO(port1);
+static DEVICE_ATTR_RO(port2);
+static DEVICE_ATTR_RO(port3);
 static DEVICE_ATTR_RW(lun_mode);
 static DEVICE_ATTR_RO(ioctl_version);
 static DEVICE_ATTR_RO(port0_lun_table);
 static DEVICE_ATTR_RO(port1_lun_table);
+static DEVICE_ATTR_RO(port2_lun_table);
+static DEVICE_ATTR_RO(port3_lun_table);
 static DEVICE_ATTR_RW(irqpoll_weight);
 
 static struct device_attribute *cxlflash_host_attrs[] = {
        &dev_attr_port0,
        &dev_attr_port1,
+       &dev_attr_port2,
+       &dev_attr_port3,
        &dev_attr_lun_mode,
        &dev_attr_ioctl_version,
        &dev_attr_port0_lun_table,
        &dev_attr_port1_lun_table,
+       &dev_attr_port2_lun_table,
+       &dev_attr_port3_lun_table,
        &dev_attr_irqpoll_weight,
        NULL
 };
index 42d9c9ee3bce4ba6c3323ed7850022806c60bb0b..0e52bbb6aeebfacc4155af6cad1e38b2dc54507e 100644 (file)
@@ -394,7 +394,7 @@ struct sisl_global_regs {
 };
 
 #define CXLFLASH_NUM_FC_PORTS_PER_BANK 2       /* fixed # of ports per bank */
-#define CXLFLASH_MAX_FC_BANKS          1       /* max # of banks supported */
+#define CXLFLASH_MAX_FC_BANKS          2       /* max # of banks supported */
 #define CXLFLASH_MAX_FC_PORTS  (CXLFLASH_NUM_FC_PORTS_PER_BANK *       \
                                 CXLFLASH_MAX_FC_BANKS)
 #define CXLFLASH_MAX_CONTEXT   512     /* number of contexts per AFU */
@@ -414,9 +414,9 @@ struct sisl_global_map {
 
        char page1[SIZE_4K];    /* page 1 */
 
-       struct fc_port_bank bank[CXLFLASH_MAX_FC_BANKS]; /* pages 2 - 5 */
+       struct fc_port_bank bank[CXLFLASH_MAX_FC_BANKS]; /* pages 2 - 9 */
 
-       /* pages 6 - 15 are reserved */
+       /* pages 10 - 15 are reserved */
 
 };