Lines Matching defs:dev

33 __FBSDID("$FreeBSD: releng/12.0/sys/dev/fxp/if_fxp.c 338948 2018-09-26 17:12:14Z imp $");
78 #include <dev/pci/pcivar.h>
79 #include <dev/pci/pcireg.h> /* for PCIM_CMD_xxx */
81 #include <dev/mii/mii.h>
82 #include <dev/mii/miivar.h>
84 #include <dev/fxp/if_fxpreg.h>
85 #include <dev/fxp/if_fxpvar.h>
86 #include <dev/fxp/rcvbundl.h>
217 static int fxp_probe(device_t dev);
218 static int fxp_attach(device_t dev);
219 static int fxp_detach(device_t dev);
220 static int fxp_shutdown(device_t dev);
221 static int fxp_suspend(device_t dev);
222 static int fxp_resume(device_t dev);
224 static const struct fxp_ident *fxp_find_ident(device_t dev);
266 static int fxp_miibus_readreg(device_t dev, int phy, int reg);
267 static int fxp_miibus_writereg(device_t dev, int phy, int reg,
269 static void fxp_miibus_statchg(device_t dev);
344 device_printf(sc->dev, "SCB timeout: 0x%x 0x%x 0x%x 0x%x\n",
376 device_printf(sc->dev, "DMA timeout\n");
380 fxp_find_ident(device_t dev)
387 vendor = pci_get_vendor(dev);
388 device = pci_get_device(dev);
389 revid = pci_get_revid(dev);
403 fxp_probe(device_t dev)
407 ident = fxp_find_ident(dev);
409 device_set_desc(dev, ident->name);
429 fxp_attach(device_t dev)
442 sc = device_get_softc(dev);
443 sc->dev = dev;
444 mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
452 device_printf(dev, "can not if_alloc()\n");
460 pci_enable_busmaster(dev);
468 resource_int_value(device_get_name(dev), device_get_unit(dev),
475 error = bus_alloc_resources(dev, sc->fxp_spec, sc->fxp_res);
481 error = bus_alloc_resources(dev, sc->fxp_spec, sc->fxp_res);
484 device_printf(dev, "could not allocate resources\n");
490 device_printf(dev, "using %s space register mapping\n",
513 sc->ident = fxp_find_ident(dev);
522 sc->revision = pci_get_revid(dev);
532 pci_find_cap(sc->dev, PCIY_PMG, &pmc) == 0)
553 device_printf(dev, "Enabling Rx lock-up workaround\n");
585 device_printf(dev,
590 device_printf(dev, "New EEPROM ID: 0x%x\n", data);
597 device_printf(dev,
618 val = pci_read_config(dev, PCIR_COMMAND, 2);
620 pci_read_config(dev, PCIR_CACHELNSZ, 1) != 0)
667 error = bus_dma_tag_create(bus_get_dma_tag(dev), 2, 0,
673 device_printf(dev, "could not create TX DMA tag\n");
677 error = bus_dma_tag_create(bus_get_dma_tag(dev), 2, 0,
682 device_printf(dev, "could not create RX DMA tag\n");
686 error = bus_dma_tag_create(bus_get_dma_tag(dev), 4, 0,
691 device_printf(dev, "could not create stats DMA tag\n");
698 device_printf(dev, "could not allocate stats DMA memory\n");
705 device_printf(dev, "could not load the stats DMA buffer\n");
709 error = bus_dma_tag_create(bus_get_dma_tag(dev), 4, 0,
714 device_printf(dev, "could not create TxCB DMA tag\n");
721 device_printf(dev, "could not allocate TxCB DMA memory\n");
729 device_printf(dev, "could not load TxCB DMA buffer\n");
733 error = bus_dma_tag_create(bus_get_dma_tag(dev), 4, 0,
738 device_printf(dev,
746 device_printf(dev,
754 device_printf(dev,
769 device_printf(dev, "can't create DMA map for TX\n");
775 device_printf(dev, "can't create spare DMA map\n");
787 device_printf(dev, "can't create DMA map for RX\n");
807 device_printf(dev, "PCI IDs: %04x %04x %04x %04x %04x\n",
808 pci_get_vendor(dev), pci_get_device(dev),
809 pci_get_subvendor(dev), pci_get_subdevice(dev),
810 pci_get_revid(dev));
811 device_printf(dev, "Dynamic Standby mode is %s\n",
835 error = mii_attach(dev, &sc->miibus, ifp,
840 device_printf(dev, "attaching PHYs failed\n");
845 if_initname(ifp, device_get_name(dev), device_get_unit(dev));
846 if_setdev(ifp, dev);
908 error = bus_setup_intr(dev, sc->fxp_res[1], INTR_TYPE_NET | INTR_MPSAFE,
911 device_printf(dev, "could not setup irq\n");
950 device_delete_child(sc->dev, sc->miibus);
951 bus_generic_detach(sc->dev);
966 bus_release_resources(sc->dev, sc->fxp_spec, sc->fxp_res);
1010 fxp_detach(device_t dev)
1012 struct fxp_softc *sc = device_get_softc(dev);
1037 bus_teardown_intr(sc->dev, sc->fxp_res[1], sc->ih);
1051 fxp_shutdown(device_t dev)
1059 return (fxp_suspend(dev));
1068 fxp_suspend(device_t dev)
1070 struct fxp_softc *sc = device_get_softc(dev);
1078 if (pci_find_cap(sc->dev, PCIY_PMG, &pmc) == 0) {
1079 pmstat = pci_read_config(sc->dev, pmc + PCIR_POWER_STATUS, 2);
1089 pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2);
1104 fxp_resume(device_t dev)
1106 struct fxp_softc *sc = device_get_softc(dev);
1113 if (pci_find_cap(sc->dev, PCIY_PMG, &pmc) == 0) {
1115 pmstat = pci_read_config(sc->dev, pmc + PCIR_POWER_STATUS, 2);
1118 pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2);
1324 device_printf(sc->dev,
2260 device_printf(sc->dev, "device timeout\n");
2775 fxp_miibus_readreg(device_t dev, int phy, int reg)
2777 struct fxp_softc *sc = device_get_softc(dev);
2789 device_printf(dev, "fxp_miibus_readreg: timed out\n");
2795 fxp_miibus_writereg(device_t dev, int phy, int reg, int value)
2797 struct fxp_softc *sc = device_get_softc(dev);
2809 device_printf(dev, "fxp_miibus_writereg: timed out\n");
2814 fxp_miibus_statchg(device_t dev)
2820 sc = device_get_softc(dev);
3046 device_printf(sc->dev, "command queue timeout\n");
3133 device_printf(sc->dev,
3152 ctx = device_get_sysctl_ctx(sc->dev);
3153 child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev));
3171 (void) resource_int_value(device_get_name(sc->dev),
3172 device_get_unit(sc->dev), "int_delay", &sc->tunable_int_delay);
3173 (void) resource_int_value(device_get_name(sc->dev),
3174 device_get_unit(sc->dev), "bundle_max", &sc->tunable_bundle_max);