Skip to content

Commit 5d2ffbe

Browse files
Robert Richterdjbw
authored andcommitted
cxl/port: Store the downstream port's Component Register mappings in struct cxl_dport
Same as for ports, also store the downstream port's Component Register mappings, use struct cxl_dport for that. Signed-off-by: Robert Richter <rrichter@amd.com> Signed-off-by: Terry Bowman <terry.bowman@amd.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20230622205523.85375-16-terry.bowman@amd.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 19ab69a commit 5d2ffbe

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

drivers/cxl/core/port.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,13 @@ static inline int cxl_port_setup_regs(struct cxl_port *port,
711711
component_reg_phys);
712712
}
713713

714+
static inline int cxl_dport_setup_regs(struct cxl_dport *dport,
715+
resource_size_t component_reg_phys)
716+
{
717+
return cxl_setup_comp_regs(dport->dport_dev, &dport->comp_map,
718+
component_reg_phys);
719+
}
720+
714721
static struct cxl_port *__devm_cxl_add_port(struct device *host,
715722
struct device *uport_dev,
716723
resource_size_t component_reg_phys,
@@ -989,6 +996,10 @@ __devm_cxl_add_dport(struct cxl_port *port, struct device *dport_dev,
989996
dport->port_id = port_id;
990997
dport->port = port;
991998

999+
rc = cxl_dport_setup_regs(dport, component_reg_phys);
1000+
if (rc)
1001+
return ERR_PTR(rc);
1002+
9921003
cond_cxl_root_lock(port);
9931004
rc = add_dport(port, dport);
9941005
cond_cxl_root_unlock(port);

drivers/cxl/cxl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,13 +595,15 @@ struct cxl_rcrb_info {
595595
/**
596596
* struct cxl_dport - CXL downstream port
597597
* @dport_dev: PCI bridge or firmware device representing the downstream link
598+
* @comp_map: component register capability mappings
598599
* @port_id: unique hardware identifier for dport in decoder target list
599600
* @rcrb: Data about the Root Complex Register Block layout
600601
* @rch: Indicate whether this dport was enumerated in RCH or VH mode
601602
* @port: reference to cxl_port that contains this downstream port
602603
*/
603604
struct cxl_dport {
604605
struct device *dport_dev;
606+
struct cxl_register_map comp_map;
605607
int port_id;
606608
struct cxl_rcrb_info rcrb;
607609
bool rch;

0 commit comments

Comments
 (0)