MCPcopy Create free account
hub / github.com/F-Stack/f-stack / argemdio_attach

Function argemdio_attach

freebsd/mips/atheros/if_arge.c:2749–2788  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2747}
2748
2749static int
2750argemdio_attach(device_t dev)
2751{
2752 struct arge_softc *sc;
2753 int error = 0;
2754#ifdef ARGE_DEBUG
2755 struct sysctl_ctx_list *ctx;
2756 struct sysctl_oid *tree;
2757#endif
2758 sc = device_get_softc(dev);
2759 sc->arge_dev = dev;
2760 sc->arge_mac_unit = device_get_unit(dev);
2761 sc->arge_rid = 0;
2762 sc->arge_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
2763 &sc->arge_rid, RF_ACTIVE | RF_SHAREABLE);
2764 if (sc->arge_res == NULL) {
2765 device_printf(dev, "couldn't map memory\n");
2766 error = ENXIO;
2767 goto fail;
2768 }
2769
2770#ifdef ARGE_DEBUG
2771 ctx = device_get_sysctl_ctx(dev);
2772 tree = device_get_sysctl_tree(dev);
2773 SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
2774 "debug", CTLFLAG_RW, &sc->arge_debug, 0,
2775 "argemdio interface debugging flags");
2776#endif
2777
2778 /* Reset MAC - required for AR71xx MDIO to successfully occur */
2779 arge_reset_mac(sc);
2780 /* Reset MII bus */
2781 arge_reset_miibus(sc);
2782
2783 bus_generic_probe(dev);
2784 bus_enumerate_hinted_children(dev);
2785 error = bus_generic_attach(dev);
2786fail:
2787 return (error);
2788}
2789
2790static int
2791argemdio_detach(device_t dev)

Callers

nothing calls this directly

Calls 11

device_get_softcFunction · 0.85
device_get_unitFunction · 0.85
bus_alloc_resource_anyFunction · 0.85
device_printfFunction · 0.85
device_get_sysctl_ctxFunction · 0.85
device_get_sysctl_treeFunction · 0.85
arge_reset_macFunction · 0.85
arge_reset_miibusFunction · 0.85
bus_generic_probeFunction · 0.85
bus_generic_attachFunction · 0.85

Tested by

no test coverage detected