Skip to content

Commit f44c7b7

Browse files
Robert Richterdjbw
authored andcommitted
cxl/acpi: Move add_host_bridge_uport() after cxl_get_chbs()
Just moving code to reorder functions to later share cxl_get_chbs() with add_host_bridge_uport(). This makes changes in the next patch visible. No other changes at all. 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-9-terry.bowman@amd.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent d076bb8 commit f44c7b7

1 file changed

Lines changed: 45 additions & 45 deletions

File tree

drivers/cxl/acpi.c

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -327,51 +327,6 @@ __mock struct acpi_device *to_cxl_host_bridge(struct device *host,
327327
return NULL;
328328
}
329329

330-
/*
331-
* A host bridge is a dport to a CFMWS decode and it is a uport to the
332-
* dport (PCIe Root Ports) in the host bridge.
333-
*/
334-
static int add_host_bridge_uport(struct device *match, void *arg)
335-
{
336-
struct cxl_port *root_port = arg;
337-
struct device *host = root_port->dev.parent;
338-
struct acpi_device *hb = to_cxl_host_bridge(host, match);
339-
struct acpi_pci_root *pci_root;
340-
struct cxl_dport *dport;
341-
struct cxl_port *port;
342-
struct device *bridge;
343-
int rc;
344-
345-
if (!hb)
346-
return 0;
347-
348-
pci_root = acpi_pci_find_root(hb->handle);
349-
bridge = pci_root->bus->bridge;
350-
dport = cxl_find_dport_by_dev(root_port, bridge);
351-
if (!dport) {
352-
dev_dbg(host, "host bridge expected and not found\n");
353-
return 0;
354-
}
355-
356-
if (dport->rch) {
357-
dev_info(bridge, "host supports CXL (restricted)\n");
358-
return 0;
359-
}
360-
361-
rc = devm_cxl_register_pci_bus(host, bridge, pci_root->bus);
362-
if (rc)
363-
return rc;
364-
365-
port = devm_cxl_add_port(host, bridge, dport->component_reg_phys,
366-
dport);
367-
if (IS_ERR(port))
368-
return PTR_ERR(port);
369-
370-
dev_info(bridge, "host supports CXL\n");
371-
372-
return 0;
373-
}
374-
375330
/* Note, @dev is used by mock_acpi_table_parse_cedt() */
376331
struct cxl_chbs_context {
377332
struct device *dev;
@@ -467,6 +422,51 @@ static int add_host_bridge_dport(struct device *match, void *arg)
467422
return 0;
468423
}
469424

425+
/*
426+
* A host bridge is a dport to a CFMWS decode and it is a uport to the
427+
* dport (PCIe Root Ports) in the host bridge.
428+
*/
429+
static int add_host_bridge_uport(struct device *match, void *arg)
430+
{
431+
struct cxl_port *root_port = arg;
432+
struct device *host = root_port->dev.parent;
433+
struct acpi_device *hb = to_cxl_host_bridge(host, match);
434+
struct acpi_pci_root *pci_root;
435+
struct cxl_dport *dport;
436+
struct cxl_port *port;
437+
struct device *bridge;
438+
int rc;
439+
440+
if (!hb)
441+
return 0;
442+
443+
pci_root = acpi_pci_find_root(hb->handle);
444+
bridge = pci_root->bus->bridge;
445+
dport = cxl_find_dport_by_dev(root_port, bridge);
446+
if (!dport) {
447+
dev_dbg(host, "host bridge expected and not found\n");
448+
return 0;
449+
}
450+
451+
if (dport->rch) {
452+
dev_info(bridge, "host supports CXL (restricted)\n");
453+
return 0;
454+
}
455+
456+
rc = devm_cxl_register_pci_bus(host, bridge, pci_root->bus);
457+
if (rc)
458+
return rc;
459+
460+
port = devm_cxl_add_port(host, bridge, dport->component_reg_phys,
461+
dport);
462+
if (IS_ERR(port))
463+
return PTR_ERR(port);
464+
465+
dev_info(bridge, "host supports CXL\n");
466+
467+
return 0;
468+
}
469+
470470
static int add_root_nvdimm_bridge(struct device *match, void *data)
471471
{
472472
struct cxl_decoder *cxld;

0 commit comments

Comments
 (0)