Skip to content
Permalink
Browse files
cxl/pci: Store component register base in cxlds
The component register base address is enumerated and stored in the
cxl_device_state structure for use by the endpoint driver.

Component register base addresses are obtained through PCI mechanisms.
As such it makes most sense for the cxl_pci driver to obtain that
address. In order to reuse the port driver for enumerating decoder
resources for an endpoint, it is desirable to be able to add the
endpoint as a port. The endpoint does know of the cxlds and can pull the
component register base from there and pass it along to port creation.

Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
  • Loading branch information
bwidawsk authored and intel-lab-lkp committed Nov 20, 2021
1 parent 34eb8a7 commit 3f74c99d751a24a4c12ba76c23b68c2832f805e1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
@@ -134,6 +134,7 @@ struct cxl_endpoint_dvsec_info {
* @next_volatile_bytes: volatile capacity change pending device reset
* @next_persistent_bytes: persistent capacity change pending device reset
* @info: Cached DVSEC information about the device.
* @component_reg_phys: register base of component registers
* @mbox_send: @dev specific transport for transmitting mailbox commands
*
* See section 8.2.9.5.2 Capacity Configuration and Label Storage for
@@ -165,6 +166,7 @@ struct cxl_dev_state {
u64 next_persistent_bytes;

struct cxl_endpoint_dvsec_info *info;
resource_size_t component_reg_phys;

int (*mbox_send)(struct cxl_dev_state *cxlds, struct cxl_mbox_cmd *cmd);
int (*wait_media_ready)(struct cxl_dev_state *cxlds);
@@ -663,6 +663,17 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (rc)
return rc;

/*
* If the component registers can't be found, the cxl_pci driver may
* still be useful for management functions so don't return an error.
*/
cxlds->component_reg_phys = CXL_RESOURCE_NONE;
rc = cxl_setup_regs(pdev, CXL_REGLOC_RBI_COMPONENT, &map);
if (rc)
dev_warn(&cxlmd->dev, "No component registers (%d)\n", rc);
else
cxlds->component_reg_phys = cxl_reg_block(pdev, &map);

rc = cxl_pci_setup_mailbox(cxlds);
if (rc)
return rc;

0 comments on commit 3f74c99

Please sign in to comment.