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
This commit is contained in:
parent
8bc94f256e
commit
117beba8a8
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user