Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Apr 2023 11:52:08 GMT
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 117beba8a80e - main - arm64: Clean up smmu fdt xref handling
Message-ID:  <202304241152.33OBq8ew003146@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=117beba8a80e8dc17ba22b43687586964175dda0

commit 117beba8a80e8dc17ba22b43687586964175dda0
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2023-04-24 11:47:31 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2023-04-24 11:47:31 +0000

    arm64: Clean up smmu fdt xref handling
    
    Use the xref from OF_xref_from_node for the smmu xref. We already have
    a valid xref ID, there is no need to convert this to a memory address.
    
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D39181
---
 sys/arm64/iommu/smmu.c     | 10 +---------
 sys/arm64/iommu/smmu_fdt.c |  4 ++--
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/sys/arm64/iommu/smmu.c b/sys/arm64/iommu/smmu.c
index 35c529ef5de6..923b77e2d5b2 100644
--- a/sys/arm64/iommu/smmu.c
+++ b/sys/arm64/iommu/smmu.c
@@ -1829,22 +1829,14 @@ static int
 smmu_pci_get_sid_fdt(device_t child, u_int *xref0, u_int *sid0)
 {
 	struct pci_id_ofw_iommu pi;
-	uint64_t base, size;
-	phandle_t node;
-	u_int xref;
 	int err;
 
 	err = pci_get_id(child, PCI_ID_OFW_IOMMU, (uintptr_t *)&pi);
 	if (err == 0) {
-		/* Our xref is memory base address. */
-		node = OF_node_from_xref(pi.xref);
-		fdt_regsize(node, &base, &size);
-		xref = base;
-
 		if (sid0)
 			*sid0 = pi.id;
 		if (xref0)
-			*xref0 = xref;
+			*xref0 = pi.xref;
 	}
 
 	return (err);
diff --git a/sys/arm64/iommu/smmu_fdt.c b/sys/arm64/iommu/smmu_fdt.c
index b33f30e9166a..a68ceb3d1569 100644
--- a/sys/arm64/iommu/smmu_fdt.c
+++ b/sys/arm64/iommu/smmu_fdt.c
@@ -168,7 +168,7 @@ smmu_fdt_attach(device_t dev)
 	LIST_INIT(&unit->domain_list);
 
 	/* Use memory start address as an xref. */
-	sc->xref = bus_get_resource_start(dev, SYS_RES_MEMORY, 0);
+	sc->xref = OF_xref_from_node(node);
 
 	err = iommu_register(iommu);
 	if (err) {
@@ -176,7 +176,7 @@ smmu_fdt_attach(device_t dev)
 		return (ENXIO);
 	}
 
-	OF_device_register_xref(OF_xref_from_node(node), dev);
+	OF_device_register_xref(sc->xref, dev);
 
 	return (0);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202304241152.33OBq8ew003146>