Commit 9cc84291 authored by Uma Krishnan's avatar Uma Krishnan Committed by Martin K. Petersen

scsi: cxlflash: Read host AFU configuration

The host AFU configuration is read on the initialization path to identify the
features and configuration of the AFU. This data is cached for use in later
configuration steps.
Signed-off-by: default avatarUma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: default avatarMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Reviewed-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
Reviewed-by: default avatarFrederic Barrat <fbarrat@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 2e222779
...@@ -78,6 +78,37 @@ static int ocxlflash_config_fn(struct pci_dev *pdev, struct ocxl_hw_afu *afu) ...@@ -78,6 +78,37 @@ static int ocxlflash_config_fn(struct pci_dev *pdev, struct ocxl_hw_afu *afu)
return rc; return rc;
} }
/**
* ocxlflash_config_afu() - configure the host AFU
* @pdev: PCI device associated with the host.
* @afu: AFU associated with the host.
*
* Must be called _after_ host function configuration.
*
* Return: 0 on success, -errno on failure
*/
static int ocxlflash_config_afu(struct pci_dev *pdev, struct ocxl_hw_afu *afu)
{
struct ocxl_afu_config *acfg = &afu->acfg;
struct ocxl_fn_config *fcfg = &afu->fcfg;
struct device *dev = &pdev->dev;
int rc = 0;
/* This HW AFU function does not have any AFUs defined */
if (!afu->is_present)
goto out;
/* Read AFU config at index 0 */
rc = ocxl_config_read_afu(pdev, fcfg, acfg, 0);
if (unlikely(rc)) {
dev_err(dev, "%s: ocxl_config_read_afu failed rc=%d\n",
__func__, rc);
goto out;
}
out:
return rc;
}
/** /**
* ocxlflash_create_afu() - create the AFU for OCXL * ocxlflash_create_afu() - create the AFU for OCXL
* @pdev: PCI device associated with the host. * @pdev: PCI device associated with the host.
...@@ -105,6 +136,13 @@ static void *ocxlflash_create_afu(struct pci_dev *pdev) ...@@ -105,6 +136,13 @@ static void *ocxlflash_create_afu(struct pci_dev *pdev)
__func__, rc); __func__, rc);
goto err1; goto err1;
} }
rc = ocxlflash_config_afu(pdev, afu);
if (unlikely(rc)) {
dev_err(dev, "%s: AFU configuration failed rc=%d\n",
__func__, rc);
goto err1;
}
out: out:
return afu; return afu;
err1: err1:
......
...@@ -18,6 +18,7 @@ struct ocxl_hw_afu { ...@@ -18,6 +18,7 @@ struct ocxl_hw_afu {
struct device *dev; /* Generic device */ struct device *dev; /* Generic device */
struct ocxl_fn_config fcfg; /* DVSEC config of the function */ struct ocxl_fn_config fcfg; /* DVSEC config of the function */
struct ocxl_afu_config acfg; /* AFU configuration data */
int fn_actag_base; /* Function acTag base */ int fn_actag_base; /* Function acTag base */
int fn_actag_enabled; /* Function acTag number enabled */ int fn_actag_enabled; /* Function acTag number enabled */
......
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