Lines Matching defs:dev

33 __FBSDID("$FreeBSD: releng/12.0/sys/dev/ae/if_ae.c 339735 2018-10-25 17:00:39Z brooks $");
67 #include <dev/mii/mii.h>
68 #include <dev/mii/miivar.h>
69 #include <dev/pci/pcireg.h>
70 #include <dev/pci/pcivar.h>
105 static int ae_probe(device_t dev);
106 static int ae_attach(device_t dev);
113 static int ae_detach(device_t dev);
114 static int ae_miibus_readreg(device_t dev, int phy, int reg);
115 static int ae_miibus_writereg(device_t dev, int phy, int reg, int val);
116 static void ae_miibus_statchg(device_t dev);
124 static int ae_shutdown(device_t dev);
125 static int ae_suspend(device_t dev);
128 static int ae_resume(device_t dev);
206 ae_miibus_readreg(sc->dev, 0, reg)
208 ae_miibus_writereg(sc->dev, 0, reg, val)
218 ae_probe(device_t dev)
223 vendorid = pci_get_vendor(dev);
224 deviceid = pci_get_device(dev);
232 device_set_desc(dev, ae_devs[i].name);
240 ae_attach(device_t dev)
249 sc = device_get_softc(dev); /* Automatically allocated and zeroed
252 sc->dev = dev;
257 mtx_init(&sc->mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF);
262 pci_enable_busmaster(dev); /* Enable bus mastering. */
269 error = bus_alloc_resources(dev, sc->spec_mem, sc->mem);
271 device_printf(dev, "could not allocate memory resources.\n");
279 pcirev = pci_get_revid(dev);
283 device_printf(dev, "pci device revision: %#04x\n", pcirev);
284 device_printf(dev, "chip id: %#02x\n", chiprev);
286 nmsi = pci_msi_count(dev);
288 device_printf(dev, "MSI count: %d.\n", nmsi);
294 error = pci_alloc_msi(dev, &nmsi);
296 device_printf(dev, "Using MSI messages.\n");
298 error = bus_alloc_resources(dev, sc->spec_irq, sc->irq);
300 device_printf(dev, "MSI allocation failed.\n");
302 pci_release_msi(dev);
310 error = bus_alloc_resources(dev, sc->spec_irq, sc->irq);
312 device_printf(dev, "could not allocate IRQ resources.\n");
335 device_printf(dev, "could not allocate ifnet structure.\n");
341 if_initname(ifp, device_get_name(dev), device_get_unit(dev));
351 if (pci_find_cap(dev, PCIY_PMG, &pmc) == 0) {
360 error = mii_attach(dev, &sc->miibus, ifp, ae_mediachange,
364 device_printf(dev, "attaching PHYs failed\n");
378 device_printf(dev, "could not create taskqueue.\n");
384 device_get_nameunit(sc->dev));
389 error = bus_setup_intr(dev, sc->irq[0], INTR_TYPE_NET | INTR_MPSAFE,
392 device_printf(dev, "could not set up interrupt handler.\n");
401 ae_detach(dev);
419 ctx = device_get_sysctl_ctx(sc->dev);
420 root = device_get_sysctl_tree(sc->dev);
516 device_printf(sc->dev, "reset timeout.\n");
529 device_printf(sc->dev, "could not enter idle state.\n");
698 device_printf(sc->dev, "Initialization failed.\n");
752 device_printf(sc->dev, "Initialization complete.\n");
759 ae_detach(device_t dev)
764 sc = device_get_softc(dev);
767 if (device_is_attached(dev)) {
783 device_delete_child(dev, sc->miibus);
786 bus_generic_detach(sc->dev);
789 bus_teardown_intr(dev, sc->irq[0], sc->intrhand);
797 bus_release_resources(dev, sc->spec_irq, sc->irq);
799 bus_release_resources(dev, sc->spec_mem, sc->mem);
801 pci_release_msi(dev);
808 ae_miibus_readreg(device_t dev, int phy, int reg)
814 sc = device_get_softc(dev);
836 device_printf(sc->dev, "phy read timeout: %d.\n", reg);
843 ae_miibus_writereg(device_t dev, int phy, int reg, int val)
849 sc = device_get_softc(dev);
872 device_printf(sc->dev, "phy write timeout: %d.\n", reg);
878 ae_miibus_statchg(device_t dev)
882 sc = device_get_softc(dev);
940 error = pci_find_cap(sc->dev, PCIY_VPD, vpdc);
965 device_printf(sc->dev, "timeout reading VPD register %d.\n",
1029 device_printf(sc->dev,
1049 device_printf(sc->dev,
1070 device_printf(sc->dev,
1114 error = bus_dma_tag_create(bus_get_dma_tag(sc->dev),
1120 device_printf(sc->dev, "could not creare parent DMA tag.\n");
1133 device_printf(sc->dev, "could not creare TxD DMA tag.\n");
1146 device_printf(sc->dev, "could not creare TxS DMA tag.\n");
1159 device_printf(sc->dev, "could not creare TxS DMA tag.\n");
1170 device_printf(sc->dev,
1177 device_printf(sc->dev,
1190 device_printf(sc->dev,
1197 device_printf(sc->dev,
1210 device_printf(sc->dev,
1218 device_printf(sc->dev,
1272 ae_shutdown(device_t dev)
1277 sc = device_get_softc(dev);
1280 error = ae_suspend(dev);
1388 if (pci_find_cap(sc->dev, PCIY_PMG, &pmc) == 0) {
1389 pmstat = pci_read_config(sc->dev, pmc + PCIR_POWER_STATUS, 2);
1393 pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2);
1398 ae_suspend(device_t dev)
1402 sc = device_get_softc(dev);
1413 ae_resume(device_t dev)
1417 sc = device_get_softc(dev);
1674 device_printf(sc->dev, "timed out while stopping Rx MAC.\n");
1710 device_printf(sc->dev, "timed out while stopping Tx MAC.\n");
1849 device_printf(sc->dev, "Size mismatch: TxS:%d TxD:%d\n",
2204 device_printf(sc->dev, "could not enter idle state in stop.\n");