diff --git sys/dev/dpaa2/dpaa2_mc_acpi.c sys/dev/dpaa2/dpaa2_mc_acpi.c index 34076c1ce8e2..1ad913aabd7d 100644 --- sys/dev/dpaa2/dpaa2_mc_acpi.c +++ sys/dev/dpaa2/dpaa2_mc_acpi.c @@ -87,7 +87,6 @@ dpaa2_mac_dev_attach(device_t dev) { struct dpaa2_mac_dev_softc *sc; ACPI_HANDLE h; - ACPI_OBJECT *hobj, *pobj; ssize_t s; sc = device_get_softc(dev); @@ -114,40 +113,9 @@ dpaa2_mac_dev_attach(device_t dev) sizeof(sc->phy_conn_type), DEVICE_PROP_ANY); s = device_get_property(dev, "phy-mode", sc->phy_mode, sizeof(sc->phy_mode), DEVICE_PROP_ANY); + s = device_get_property(dev, "phy-handle", &sc->phy_channel, + sizeof(sc->phy_channel), DEVICE_PROP_HANDLE); - hobj = NULL; - s = device_get_property(dev, "phy-handle", &hobj, sizeof(hobj), - DEVICE_PROP_ANY); - if (s > 0) { - if (hobj->Type != ACPI_TYPE_PACKAGE) { - device_printf(dev, "Cannot get 'phy-handle' " - "package obj, not ACPI_TYPE_PACKAGE\n"); - goto out; - } - if (hobj->Package.Count != 1) { - device_printf(dev, "Cannot get 'phy-handle' " - "package obj, count %d\n", hobj->Package.Count); - goto out; - } - pobj = &hobj->Package.Elements[0]; - if (pobj == NULL) { - device_printf(dev, "Cannot get 'phy-handle' " - "package pobj is NULL\n"); - goto out; - } - if (pobj->Type != ACPI_TYPE_LOCAL_REFERENCE) { - device_printf(dev, "Cannot get 'phy-handle' package " - "pobj, no ACPI_TYPE_LOCAL_REFERENCE\n"); - goto out; - } - sc->phy_channel = acpi_GetReference(NULL, pobj); - if (sc->phy_channel == NULL) { - device_printf(dev, "Cannot get 'phy-handle' reference " - "handle ph is NULL\n"); - goto out; - } - } -out: if (bootverbose) device_printf(dev, "UID %#04x reg %#04jx managed '%s' " "phy-connection-type '%s' phy-mode '%s' phy-handle '%s'\n", diff --git sys/dev/dpaa2/dpaa2_mc_fdt.c sys/dev/dpaa2/dpaa2_mc_fdt.c index 5d5ad1f40fab..b1382d0d8ecc 100644 --- sys/dev/dpaa2/dpaa2_mc_fdt.c +++ sys/dev/dpaa2/dpaa2_mc_fdt.c @@ -138,13 +138,13 @@ dpaa2_mac_fdt_attach(device_t dev) s = device_get_property(dev, "phy-connection-type", sc->phy_conn_type, sizeof(sc->phy_conn_type), DEVICE_PROP_ANY); s = device_get_property(dev, "pcs-handle", &sc->pcs_handle, - sizeof(sc->pcs_handle), DEVICE_PROP_UINT32); + sizeof(sc->pcs_handle), DEVICE_PROP_HANDLE); /* 'sfp' and 'phy-handle' are optional but we need one or the other. */ s = device_get_property(dev, "sfp", &sc->sfp, sizeof(sc->sfp), - DEVICE_PROP_UINT32); + DEVICE_PROP_HANDLE); s = device_get_property(dev, "phy-handle", &sc->phy_handle, - sizeof(sc->phy_handle), DEVICE_PROP_UINT32); + sizeof(sc->phy_handle), DEVICE_PROP_HANDLE); if (bootverbose) device_printf(dev, "node %#x '%s': reg %#x sfp %#x pcs-handle " @@ -187,12 +187,12 @@ dpaa2_mac_fdt_get_phy_dev(device_t dev) if (sc->sfp != 0) { device_t xdev; - xdev = OF_device_from_xref(sc->sfp); + xdev = OF_device_from_xref(OF_xref_from_node(sc->sfp)); if (xdev != NULL) return (xdev); } #endif - return (OF_device_from_xref(sc->phy_handle)); + return (OF_device_from_xref(OF_xref_from_node(sc->phy_handle))); } static device_method_t dpaa2_mac_fdt_methods[] = {