File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -613,18 +613,30 @@ static unsigned char cdat_checksum(void *buf, size_t size)
613
613
*/
614
614
void read_cdat_data (struct cxl_port * port )
615
615
{
616
- struct cxl_memdev * cxlmd = to_cxl_memdev (port -> uport_dev );
617
- struct device * host = cxlmd -> dev .parent ;
616
+ struct device * uport = port -> uport_dev ;
618
617
struct device * dev = & port -> dev ;
619
618
struct pci_doe_mb * cdat_doe ;
619
+ struct pci_dev * pdev = NULL ;
620
+ struct cxl_memdev * cxlmd ;
620
621
size_t cdat_length ;
621
622
void * cdat_table ;
622
623
int rc ;
623
624
624
- if (!dev_is_pci (host ))
625
+ if (is_cxl_memdev (uport )) {
626
+ struct device * host ;
627
+
628
+ cxlmd = to_cxl_memdev (uport );
629
+ host = cxlmd -> dev .parent ;
630
+ if (dev_is_pci (host ))
631
+ pdev = to_pci_dev (host );
632
+ } else if (dev_is_pci (uport )) {
633
+ pdev = to_pci_dev (uport );
634
+ }
635
+
636
+ if (!pdev )
625
637
return ;
626
- cdat_doe = pci_find_doe_mailbox ( to_pci_dev ( host ),
627
- PCI_DVSEC_VENDOR_ID_CXL ,
638
+
639
+ cdat_doe = pci_find_doe_mailbox ( pdev , PCI_DVSEC_VENDOR_ID_CXL ,
628
640
CXL_DOE_PROTOCOL_TABLE_ACCESS );
629
641
if (!cdat_doe ) {
630
642
dev_dbg (dev , "No CDAT mailbox\n" );
Original file line number Diff line number Diff line change @@ -62,6 +62,9 @@ static int cxl_switch_port_probe(struct cxl_port *port)
62
62
struct cxl_hdm * cxlhdm ;
63
63
int rc ;
64
64
65
+ /* Cache the data early to ensure is_visible() works */
66
+ read_cdat_data (port );
67
+
65
68
rc = devm_cxl_port_enumerate_dports (port );
66
69
if (rc < 0 )
67
70
return rc ;
You can’t perform that action at this time.
0 commit comments