The branch main has been updated by andrew:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=49ee1a7ef0b164ce70408651621a0195c7c6930f

commit 49ee1a7ef0b164ce70408651621a0195c7c6930f
Author:     Andrew Turner <and...@freebsd.org>
AuthorDate: 2023-04-24 11:47:44 +0000
Commit:     Andrew Turner <and...@freebsd.org>
CommitDate: 2023-04-24 11:47:44 +0000

    Create a common function to get the SMMU sid
    
    Now the PCI drivers have a common interface to read the IOMMU xref
    and SID create a common function to read it. This fixes an issue where
    we will call into an ACPI specific function when booting with FDT when
    both are enabled.
    
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D39183
---
 sys/arm64/iommu/smmu.c | 41 +++--------------------------------------
 1 file changed, 3 insertions(+), 38 deletions(-)

diff --git a/sys/arm64/iommu/smmu.c b/sys/arm64/iommu/smmu.c
index 923b77e2d5b2..9a9d7a4f6c2f 100644
--- a/sys/arm64/iommu/smmu.c
+++ b/sys/arm64/iommu/smmu.c
@@ -1799,34 +1799,8 @@ smmu_set_buswide(device_t dev, struct smmu_domain 
*domain,
        return (0);
 }
 
-#ifdef DEV_ACPI
 static int
-smmu_pci_get_sid_acpi(device_t child, u_int *xref0, u_int *sid0)
-{
-       uint16_t rid;
-       u_int xref;
-       int seg;
-       int err;
-       int sid;
-
-       seg = pci_get_domain(child);
-       rid = pci_get_rid(child);
-
-       err = acpi_iort_map_pci_smmuv3(seg, rid, &xref, &sid);
-       if (err == 0) {
-               if (sid0)
-                       *sid0 = sid;
-               if (xref0)
-                       *xref0 = xref;
-       }
-
-       return (err);
-}
-#endif
-
-#ifdef FDT
-static int
-smmu_pci_get_sid_fdt(device_t child, u_int *xref0, u_int *sid0)
+smmu_pci_get_sid(device_t child, u_int *xref0, u_int *sid0)
 {
        struct pci_id_ofw_iommu pi;
        int err;
@@ -1841,7 +1815,6 @@ smmu_pci_get_sid_fdt(device_t child, u_int *xref0, u_int 
*sid0)
 
        return (err);
 }
-#endif
 
 static struct iommu_ctx *
 smmu_ctx_alloc(device_t dev, struct iommu_domain *iodom, device_t child,
@@ -1885,11 +1858,7 @@ smmu_ctx_init(device_t dev, struct iommu_ctx *ioctx)
 
        pci_class = devclass_find("pci");
        if (device_get_devclass(device_get_parent(ctx->dev)) == pci_class) {
-#ifdef DEV_ACPI
-               err = smmu_pci_get_sid_acpi(ctx->dev, NULL, &sid);
-#else
-               err = smmu_pci_get_sid_fdt(ctx->dev, NULL, &sid);
-#endif
+               err = smmu_pci_get_sid(ctx->dev, NULL, &sid);
                if (err)
                        return (err);
 
@@ -2000,11 +1969,7 @@ smmu_find(device_t dev, device_t child)
 
        sc = device_get_softc(dev);
 
-#ifdef DEV_ACPI
-       err = smmu_pci_get_sid_acpi(child, &xref, NULL);
-#else
-       err = smmu_pci_get_sid_fdt(child, &xref, NULL);
-#endif
+       err = smmu_pci_get_sid(child, &xref, NULL);
        if (err)
                return (ENOENT);
 

Reply via email to