Commit 0d419130 authored by Matthew R. Ochs's avatar Matthew R. Ochs Committed by Martin K. Petersen

scsi: cxlflash: Allow cards without WWPN VPD to configure

Currently, all adapters that cxlflash supports must have WWPN VPD
keywords to complete configuration. This was required as cards with
external FC ports needed to be programmed with WWPNs.

Newer supported cards do not have an external FC interface and therefore
do not require WWPN. To support backwards compatibility, these devices
have included 'dummy' WWPN VPD with WWPN values of zero. This however
places a dependency that all future cards have WWPN VPD, which may not
always be the case.

Allow for cards to not have WWPN, designating which cards are expected
to have it in order to configure properly.
Signed-off-by: default avatarMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: default avatarUma Krishnan <ukrishn@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 285e6670
...@@ -1634,7 +1634,10 @@ static int read_vpd(struct cxlflash_cfg *cfg, u64 wwpn[]) ...@@ -1634,7 +1634,10 @@ static int read_vpd(struct cxlflash_cfg *cfg, u64 wwpn[])
ssize_t vpd_size; ssize_t vpd_size;
char vpd_data[CXLFLASH_VPD_LEN]; char vpd_data[CXLFLASH_VPD_LEN];
char tmp_buf[WWPN_BUF_LEN] = { 0 }; char tmp_buf[WWPN_BUF_LEN] = { 0 };
char *wwpn_vpd_tags[MAX_FC_PORTS] = { "V5", "V6", "V7", "V8" }; const struct dev_dependent_vals *ddv = (struct dev_dependent_vals *)
cfg->dev_id->driver_data;
const bool wwpn_vpd_required = ddv->flags & CXLFLASH_WWPN_VPD_REQUIRED;
const char *wwpn_vpd_tags[MAX_FC_PORTS] = { "V5", "V6", "V7", "V8" };
/* Get the VPD data from the device */ /* Get the VPD data from the device */
vpd_size = cxl_read_adapter_vpd(pdev, vpd_data, sizeof(vpd_data)); vpd_size = cxl_read_adapter_vpd(pdev, vpd_data, sizeof(vpd_data));
...@@ -1671,17 +1674,24 @@ static int read_vpd(struct cxlflash_cfg *cfg, u64 wwpn[]) ...@@ -1671,17 +1674,24 @@ static int read_vpd(struct cxlflash_cfg *cfg, u64 wwpn[])
* value. Note that we must copy to a temporary buffer * value. Note that we must copy to a temporary buffer
* because the conversion service requires that the ASCII * because the conversion service requires that the ASCII
* string be terminated. * string be terminated.
*
* Allow for WWPN not being found for all devices, setting
* the returned WWPN to zero when not found. Notify with a
* log error for cards that should have had WWPN keywords
* in the VPD - cards requiring WWPN will not have their
* ports programmed and operate in an undefined state.
*/ */
for (k = 0; k < cfg->num_fc_ports; k++) { for (k = 0; k < cfg->num_fc_ports; k++) {
j = ro_size; j = ro_size;
i = ro_start + PCI_VPD_LRDT_TAG_SIZE; i = ro_start + PCI_VPD_LRDT_TAG_SIZE;
i = pci_vpd_find_info_keyword(vpd_data, i, j, wwpn_vpd_tags[k]); i = pci_vpd_find_info_keyword(vpd_data, i, j, wwpn_vpd_tags[k]);
if (unlikely(i < 0)) { if (i < 0) {
dev_err(dev, "%s: Port %d WWPN not found in VPD\n", if (wwpn_vpd_required)
__func__, k); dev_err(dev, "%s: Port %d WWPN not found\n",
rc = -ENODEV; __func__, k);
goto out; wwpn[k] = 0ULL;
continue;
} }
j = pci_vpd_info_field_size(&vpd_data[i]); j = pci_vpd_info_field_size(&vpd_data[i]);
...@@ -3145,7 +3155,7 @@ static struct scsi_host_template driver_template = { ...@@ -3145,7 +3155,7 @@ static struct scsi_host_template driver_template = {
* Device dependent values * Device dependent values
*/ */
static struct dev_dependent_vals dev_corsa_vals = { CXLFLASH_MAX_SECTORS, static struct dev_dependent_vals dev_corsa_vals = { CXLFLASH_MAX_SECTORS,
0ULL }; CXLFLASH_WWPN_VPD_REQUIRED };
static struct dev_dependent_vals dev_flash_gt_vals = { CXLFLASH_MAX_SECTORS, static struct dev_dependent_vals dev_flash_gt_vals = { CXLFLASH_MAX_SECTORS,
CXLFLASH_NOTIFY_SHUTDOWN }; CXLFLASH_NOTIFY_SHUTDOWN };
static struct dev_dependent_vals dev_briard_vals = { CXLFLASH_MAX_SECTORS, static struct dev_dependent_vals dev_briard_vals = { CXLFLASH_MAX_SECTORS,
......
...@@ -95,7 +95,8 @@ enum undo_level { ...@@ -95,7 +95,8 @@ enum undo_level {
struct dev_dependent_vals { struct dev_dependent_vals {
u64 max_sectors; u64 max_sectors;
u64 flags; u64 flags;
#define CXLFLASH_NOTIFY_SHUTDOWN 0x0000000000000001ULL #define CXLFLASH_NOTIFY_SHUTDOWN 0x0000000000000001ULL
#define CXLFLASH_WWPN_VPD_REQUIRED 0x0000000000000002ULL
}; };
struct asyc_intr_info { struct asyc_intr_info {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment