Commit 5d2ffbe4 authored by Robert Richter's avatar Robert Richter Committed by Dan Williams

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: default avatarRobert Richter <rrichter@amd.com>
Signed-off-by: default avatarTerry Bowman <terry.bowman@amd.com>
Reviewed-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20230622205523.85375-16-terry.bowman@amd.comSigned-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 19ab69a6
...@@ -711,6 +711,13 @@ static inline int cxl_port_setup_regs(struct cxl_port *port, ...@@ -711,6 +711,13 @@ static inline int cxl_port_setup_regs(struct cxl_port *port,
component_reg_phys); component_reg_phys);
} }
static inline int cxl_dport_setup_regs(struct cxl_dport *dport,
resource_size_t component_reg_phys)
{
return cxl_setup_comp_regs(dport->dport_dev, &dport->comp_map,
component_reg_phys);
}
static struct cxl_port *__devm_cxl_add_port(struct device *host, static struct cxl_port *__devm_cxl_add_port(struct device *host,
struct device *uport_dev, struct device *uport_dev,
resource_size_t component_reg_phys, resource_size_t component_reg_phys,
...@@ -989,6 +996,10 @@ __devm_cxl_add_dport(struct cxl_port *port, struct device *dport_dev, ...@@ -989,6 +996,10 @@ __devm_cxl_add_dport(struct cxl_port *port, struct device *dport_dev,
dport->port_id = port_id; dport->port_id = port_id;
dport->port = port; dport->port = port;
rc = cxl_dport_setup_regs(dport, component_reg_phys);
if (rc)
return ERR_PTR(rc);
cond_cxl_root_lock(port); cond_cxl_root_lock(port);
rc = add_dport(port, dport); rc = add_dport(port, dport);
cond_cxl_root_unlock(port); cond_cxl_root_unlock(port);
......
...@@ -595,6 +595,7 @@ struct cxl_rcrb_info { ...@@ -595,6 +595,7 @@ struct cxl_rcrb_info {
/** /**
* struct cxl_dport - CXL downstream port * struct cxl_dport - CXL downstream port
* @dport_dev: PCI bridge or firmware device representing the downstream link * @dport_dev: PCI bridge or firmware device representing the downstream link
* @comp_map: component register capability mappings
* @port_id: unique hardware identifier for dport in decoder target list * @port_id: unique hardware identifier for dport in decoder target list
* @rcrb: Data about the Root Complex Register Block layout * @rcrb: Data about the Root Complex Register Block layout
* @rch: Indicate whether this dport was enumerated in RCH or VH mode * @rch: Indicate whether this dport was enumerated in RCH or VH mode
...@@ -602,6 +603,7 @@ struct cxl_rcrb_info { ...@@ -602,6 +603,7 @@ struct cxl_rcrb_info {
*/ */
struct cxl_dport { struct cxl_dport {
struct device *dport_dev; struct device *dport_dev;
struct cxl_register_map comp_map;
int port_id; int port_id;
struct cxl_rcrb_info rcrb; struct cxl_rcrb_info rcrb;
bool rch; bool rch;
......
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