Lines Matching refs:dev

31 __FBSDID("$FreeBSD: releng/11.0/sys/dev/ath/if_ath_pci.c 298939 2016-05-02 19:56:48Z pfg $");
61 #include <dev/ath/if_athvar.h>
63 #include <dev/pci/pcivar.h>
64 #include <dev/pci/pcireg.h>
139 ath_pci_probe_device(device_t dev, const struct pci_device_id *dev_table, int nentries)
145 vendor_id = pci_get_vendor(dev);
146 device_id = pci_get_device(dev);
147 sub_vendor_id = pci_get_subvendor(dev);
148 sub_device_id = pci_get_subdevice(dev);
182 ath_pci_setup(device_t dev)
192 cz = pci_read_config(dev, PCIR_CACHELNSZ, 1);
194 pci_write_config(dev, PCIR_CACHELNSZ,
199 pci_write_config(dev, PCIR_LATTIMER, 0xa8, 1);
206 pmcsr = pci_read_config(dev, PCIR_CFG_PMCSR, 2);
208 pci_write_config(dev, PCIR_CFG_PMCSR, pmcsr, 2);
210 pci_write_config(dev, PCIR_CFG_PMCSR, pmcsr, 2);
218 pci_write_config(dev, PCIR_RETRY_TIMEOUT, 0, 1);
222 ath_pci_probe(device_t dev)
226 devname = ath_hal_probe(pci_get_vendor(dev), pci_get_device(dev));
228 device_set_desc(dev, devname);
235 ath_pci_attach(device_t dev)
237 struct ath_pci_softc *psc = device_get_softc(dev);
247 sc->sc_dev = dev;
250 pd = ath_pci_probe_device(dev, ath_pci_id_table, nitems(ath_pci_id_table));
257 pci_enable_busmaster(dev);
262 ath_pci_setup(dev);
268 psc->sc_sr = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
271 device_printf(dev, "cannot map register space\n");
292 psc->sc_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
295 device_printf(dev, "could not map interrupt\n");
298 if (bus_setup_intr(dev, psc->sc_irq,
301 device_printf(dev, "could not establish interrupt\n");
308 if (bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */
320 device_printf(dev, "cannot allocate DMA tag\n");
328 if (resource_string_value(device_get_name(dev), device_get_unit(dev),
331 device_printf(dev, "%s: looking up firmware @ '%s'\n",
336 device_printf(dev, "%s: couldn't find firmware\n",
341 device_printf(dev, "%s: EEPROM firmware @ %p\n",
346 device_printf(dev, "%s: can't malloc eepromdata\n",
355 error = ath_attach(pci_get_device(dev), sc);
364 bus_teardown_intr(dev, psc->sc_irq, psc->sc_ih);
366 bus_release_resource(dev, SYS_RES_IRQ, 0, psc->sc_irq);
368 bus_release_resource(dev, SYS_RES_MEMORY, BS_BAR, psc->sc_sr);
381 ath_pci_detach(device_t dev)
383 struct ath_pci_softc *psc = device_get_softc(dev);
387 sc->sc_invalid = !bus_child_present(dev);
392 (void) pci_read_config(dev, PCIR_COMMAND, 4);
396 bus_generic_detach(dev);
397 bus_teardown_intr(dev, psc->sc_irq, psc->sc_ih);
398 bus_release_resource(dev, SYS_RES_IRQ, 0, psc->sc_irq);
401 bus_release_resource(dev, SYS_RES_MEMORY, BS_BAR, psc->sc_sr);
416 ath_pci_shutdown(device_t dev)
418 struct ath_pci_softc *psc = device_get_softc(dev);
425 ath_pci_suspend(device_t dev)
427 struct ath_pci_softc *psc = device_get_softc(dev);
435 ath_pci_resume(device_t dev)
437 struct ath_pci_softc *psc = device_get_softc(dev);
442 ath_pci_setup(dev);