Lines Matching full:sc

104 static void	ae_pcie_init(ae_softc_t *sc);
105 static void ae_phy_reset(ae_softc_t *sc);
106 static void ae_phy_init(ae_softc_t *sc);
107 static int ae_reset(ae_softc_t *sc);
109 static int ae_init_locked(ae_softc_t *sc);
116 static void ae_retrieve_address(ae_softc_t *sc);
119 static int ae_alloc_rings(ae_softc_t *sc);
120 static void ae_dma_free(ae_softc_t *sc);
123 static void ae_powersave_disable(ae_softc_t *sc);
124 static void ae_powersave_enable(ae_softc_t *sc);
126 static unsigned int ae_tx_avail_size(ae_softc_t *sc);
127 static int ae_encap(ae_softc_t *sc, struct mbuf **m_head);
131 static void ae_stop_rxmac(ae_softc_t *sc);
132 static void ae_stop_txmac(ae_softc_t *sc);
133 static void ae_mac_config(ae_softc_t *sc);
136 static void ae_tx_intr(ae_softc_t *sc);
137 static void ae_rxeof(ae_softc_t *sc, ae_rxd_t *rxd);
138 static void ae_rx_intr(ae_softc_t *sc);
139 static void ae_watchdog(ae_softc_t *sc);
141 static void ae_rxfilter(ae_softc_t *sc);
142 static void ae_rxvlan(ae_softc_t *sc);
144 static void ae_stop(ae_softc_t *sc);
145 static int ae_check_eeprom_present(ae_softc_t *sc, int *vpdc);
146 static int ae_vpd_read_word(ae_softc_t *sc, int reg, uint32_t *word);
147 static int ae_get_vpd_eaddr(ae_softc_t *sc, uint32_t *eaddr);
148 static int ae_get_reg_eaddr(ae_softc_t *sc, uint32_t *eaddr);
151 static void ae_init_tunables(ae_softc_t *sc);
188 #define AE_READ_4(sc, reg) \ argument
189 bus_read_4((sc)->mem[0], (reg))
190 #define AE_READ_2(sc, reg) \ argument
191 bus_read_2((sc)->mem[0], (reg))
192 #define AE_READ_1(sc, reg) \ argument
193 bus_read_1((sc)->mem[0], (reg))
194 #define AE_WRITE_4(sc, reg, val) \ argument
195 bus_write_4((sc)->mem[0], (reg), (val))
196 #define AE_WRITE_2(sc, reg, val) \ argument
197 bus_write_2((sc)->mem[0], (reg), (val))
198 #define AE_WRITE_1(sc, reg, val) \ argument
199 bus_write_1((sc)->mem[0], (reg), (val))
200 #define AE_PHY_READ(sc, reg) \ argument
201 ae_miibus_readreg(sc->dev, 0, reg)
202 #define AE_PHY_WRITE(sc, reg, val) \ argument
203 ae_miibus_writereg(sc->dev, 0, reg, val)
237 ae_softc_t *sc; in ae_attach() local
244 sc = device_get_softc(dev); /* Automatically allocated and zeroed in ae_attach()
246 KASSERT(sc != NULL, ("[ae, %d]: sc is NULL", __LINE__)); in ae_attach()
247 sc->dev = dev; in ae_attach()
252 mtx_init(&sc->mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); in ae_attach()
253 callout_init_mtx(&sc->tick_ch, &sc->mtx, 0); in ae_attach()
254 TASK_INIT(&sc->int_task, 0, ae_int_task, sc); in ae_attach()
255 TASK_INIT(&sc->link_task, 0, ae_link_task, sc); in ae_attach()
259 sc->spec_mem = ae_res_spec_mem; in ae_attach()
264 error = bus_alloc_resources(dev, sc->spec_mem, sc->mem); in ae_attach()
267 sc->spec_mem = NULL; in ae_attach()
275 chiprev = (AE_READ_4(sc, AE_MASTER_REG) >> AE_MASTER_REVNUM_SHIFT) & in ae_attach()
292 sc->spec_irq = ae_res_spec_msi; in ae_attach()
293 error = bus_alloc_resources(dev, sc->spec_irq, sc->irq); in ae_attach()
296 sc->spec_irq = NULL; in ae_attach()
299 sc->flags |= AE_FLAG_MSI; in ae_attach()
303 if (sc->spec_irq == NULL) { in ae_attach()
304 sc->spec_irq = ae_res_spec_irq; in ae_attach()
305 error = bus_alloc_resources(dev, sc->spec_irq, sc->irq); in ae_attach()
308 sc->spec_irq = NULL; in ae_attach()
313 ae_init_tunables(sc); in ae_attach()
315 ae_phy_reset(sc); /* Reset PHY. */ in ae_attach()
316 error = ae_reset(sc); /* Reset the controller itself. */ in ae_attach()
320 ae_pcie_init(sc); in ae_attach()
322 ae_retrieve_address(sc); /* Load MAC address. */ in ae_attach()
324 error = ae_alloc_rings(sc); /* Allocate ring buffers. */ in ae_attach()
328 ifp = sc->ifp = if_alloc(IFT_ETHER); in ae_attach()
329 if_setsoftc(ifp, sc); in ae_attach()
341 sc->flags |= AE_FLAG_PMG; in ae_attach()
348 error = mii_attach(dev, &sc->miibus, ifp, ae_mediachange, in ae_attach()
356 ether_ifattach(ifp, sc->eaddr); in ae_attach()
363 sc->tq = taskqueue_create_fast("ae_taskq", M_WAITOK, in ae_attach()
364 taskqueue_thread_enqueue, &sc->tq); in ae_attach()
365 taskqueue_start_threads(&sc->tq, 1, PI_NET, "%s taskq", in ae_attach()
366 device_get_nameunit(sc->dev)); in ae_attach()
371 error = bus_setup_intr(dev, sc->irq[0], INTR_TYPE_NET | INTR_MPSAFE, in ae_attach()
372 ae_intr, NULL, sc, &sc->intrhand); in ae_attach()
375 taskqueue_free(sc->tq); in ae_attach()
376 sc->tq = NULL; in ae_attach()
392 ae_init_tunables(ae_softc_t *sc) in ae_init_tunables() argument
398 KASSERT(sc != NULL, ("[ae, %d]: sc is NULL", __LINE__)); in ae_init_tunables()
399 ae_stats = &sc->stats; in ae_init_tunables()
401 ctx = device_get_sysctl_ctx(sc->dev); in ae_init_tunables()
402 root = device_get_sysctl_tree(sc->dev); in ae_init_tunables()
462 ae_pcie_init(ae_softc_t *sc) in ae_pcie_init() argument
465 AE_WRITE_4(sc, AE_PCIE_LTSSM_TESTMODE_REG, AE_PCIE_LTSSM_TESTMODE_DEFAULT); in ae_pcie_init()
466 AE_WRITE_4(sc, AE_PCIE_DLL_TX_CTRL_REG, AE_PCIE_DLL_TX_CTRL_DEFAULT); in ae_pcie_init()
470 ae_phy_reset(ae_softc_t *sc) in ae_phy_reset() argument
473 AE_WRITE_4(sc, AE_PHY_ENABLE_REG, AE_PHY_ENABLE); in ae_phy_reset()
478 ae_reset(ae_softc_t *sc) in ae_reset() argument
485 AE_WRITE_4(sc, AE_MASTER_REG, AE_MASTER_SOFT_RESET); in ae_reset()
486 bus_barrier(sc->mem[0], AE_MASTER_REG, 4, in ae_reset()
493 if ((AE_READ_4(sc, AE_MASTER_REG) & AE_MASTER_SOFT_RESET) == 0) in ae_reset()
498 device_printf(sc->dev, "reset timeout.\n"); in ae_reset()
506 if (AE_READ_4(sc, AE_IDLE_REG) == 0) in ae_reset()
511 device_printf(sc->dev, "could not enter idle state.\n"); in ae_reset()
520 ae_softc_t *sc; in ae_init() local
522 sc = (ae_softc_t *)arg; in ae_init()
523 AE_LOCK(sc); in ae_init()
524 ae_init_locked(sc); in ae_init()
525 AE_UNLOCK(sc); in ae_init()
529 ae_phy_init(ae_softc_t *sc) in ae_phy_init() argument
537 AE_PHY_WRITE(sc, 18, 0xc00); in ae_phy_init()
542 ae_init_locked(ae_softc_t *sc) in ae_init_locked() argument
550 AE_LOCK_ASSERT(sc); in ae_init_locked()
552 ifp = sc->ifp; in ae_init_locked()
555 mii = device_get_softc(sc->miibus); in ae_init_locked()
557 ae_stop(sc); in ae_init_locked()
558 ae_reset(sc); in ae_init_locked()
559 ae_pcie_init(sc); /* Initialize PCIE stuff. */ in ae_init_locked()
560 ae_phy_init(sc); in ae_init_locked()
561 ae_powersave_disable(sc); in ae_init_locked()
566 AE_WRITE_4(sc, AE_ISR_REG, 0xffffffff); in ae_init_locked()
573 AE_WRITE_4(sc, AE_EADDR0_REG, val); in ae_init_locked()
575 AE_WRITE_4(sc, AE_EADDR1_REG, val); in ae_init_locked()
577 bzero(sc->rxd_base_dma, AE_RXD_COUNT_DEFAULT * 1536 + AE_RXD_PADDING); in ae_init_locked()
578 bzero(sc->txd_base, AE_TXD_BUFSIZE_DEFAULT); in ae_init_locked()
579 bzero(sc->txs_base, AE_TXS_COUNT_DEFAULT * 4); in ae_init_locked()
583 addr = sc->dma_rxd_busaddr; in ae_init_locked()
584 AE_WRITE_4(sc, AE_DESC_ADDR_HI_REG, BUS_ADDR_HI(addr)); in ae_init_locked()
585 AE_WRITE_4(sc, AE_RXD_ADDR_LO_REG, BUS_ADDR_LO(addr)); in ae_init_locked()
586 addr = sc->dma_txd_busaddr; in ae_init_locked()
587 AE_WRITE_4(sc, AE_TXD_ADDR_LO_REG, BUS_ADDR_LO(addr)); in ae_init_locked()
588 addr = sc->dma_txs_busaddr; in ae_init_locked()
589 AE_WRITE_4(sc, AE_TXS_ADDR_LO_REG, BUS_ADDR_LO(addr)); in ae_init_locked()
594 AE_WRITE_2(sc, AE_RXD_COUNT_REG, AE_RXD_COUNT_DEFAULT); in ae_init_locked()
595 AE_WRITE_2(sc, AE_TXD_BUFSIZE_REG, AE_TXD_BUFSIZE_DEFAULT / 4); in ae_init_locked()
596 AE_WRITE_2(sc, AE_TXS_COUNT_REG, AE_TXS_COUNT_DEFAULT); in ae_init_locked()
609 AE_WRITE_4(sc, AE_IFG_REG, val); in ae_init_locked()
622 AE_WRITE_4(sc, AE_HDPX_REG, val); in ae_init_locked()
627 AE_WRITE_2(sc, AE_IMT_REG, AE_IMT_DEFAULT); in ae_init_locked()
628 val = AE_READ_4(sc, AE_MASTER_REG); in ae_init_locked()
630 AE_WRITE_4(sc, AE_MASTER_REG, val); in ae_init_locked()
635 AE_WRITE_2(sc, AE_ICT_REG, AE_ICT_DEFAULT); in ae_init_locked()
642 AE_WRITE_2(sc, AE_MTU_REG, val); in ae_init_locked()
647 AE_WRITE_4(sc, AE_CUT_THRESH_REG, AE_CUT_THRESH_DEFAULT); in ae_init_locked()
652 AE_WRITE_2(sc, AE_FLOW_THRESH_HI_REG, (AE_RXD_COUNT_DEFAULT / 8) * 7); in ae_init_locked()
653 AE_WRITE_2(sc, AE_FLOW_THRESH_LO_REG, (AE_RXD_COUNT_MIN / 8) > in ae_init_locked()
660 sc->txd_cur = sc->rxd_cur = 0; in ae_init_locked()
661 sc->txs_ack = sc->txd_ack = 0; in ae_init_locked()
662 sc->rxd_cur = 0; in ae_init_locked()
663 AE_WRITE_2(sc, AE_MB_TXD_IDX_REG, sc->txd_cur); in ae_init_locked()
664 AE_WRITE_2(sc, AE_MB_RXD_IDX_REG, sc->rxd_cur); in ae_init_locked()
666 sc->tx_inproc = 0; /* Number of packets the chip processes now. */ in ae_init_locked()
667 sc->flags |= AE_FLAG_TXAVAIL; /* Free Tx's available. */ in ae_init_locked()
672 AE_WRITE_1(sc, AE_DMAREAD_REG, AE_DMAREAD_EN); in ae_init_locked()
673 AE_WRITE_1(sc, AE_DMAWRITE_REG, AE_DMAWRITE_EN); in ae_init_locked()
678 val = AE_READ_4(sc, AE_ISR_REG); in ae_init_locked()
680 device_printf(sc->dev, "Initialization failed.\n"); in ae_init_locked()
687 AE_WRITE_4(sc, AE_ISR_REG, 0x3fffffff); in ae_init_locked()
688 AE_WRITE_4(sc, AE_ISR_REG, 0x0); in ae_init_locked()
693 val = AE_READ_4(sc, AE_MASTER_REG); in ae_init_locked()
694 AE_WRITE_4(sc, AE_MASTER_REG, val | AE_MASTER_MANUAL_INT); in ae_init_locked()
695 AE_WRITE_4(sc, AE_IMR_REG, AE_IMR_DEFAULT); in ae_init_locked()
700 AE_WRITE_4(sc, AE_WOL_REG, 0); in ae_init_locked()
711 AE_WRITE_4(sc, AE_MAC_REG, val); in ae_init_locked()
716 ae_rxfilter(sc); in ae_init_locked()
717 ae_rxvlan(sc); in ae_init_locked()
722 val = AE_READ_4(sc, AE_MAC_REG); in ae_init_locked()
723 AE_WRITE_4(sc, AE_MAC_REG, val | AE_MAC_TX_EN | AE_MAC_RX_EN); in ae_init_locked()
725 sc->flags &= ~AE_FLAG_LINK; in ae_init_locked()
728 callout_reset(&sc->tick_ch, hz, ae_tick, sc); in ae_init_locked()
734 device_printf(sc->dev, "Initialization complete.\n"); in ae_init_locked()
743 struct ae_softc *sc; in ae_detach() local
746 sc = device_get_softc(dev); in ae_detach()
747 KASSERT(sc != NULL, ("[ae: %d]: sc is NULL", __LINE__)); in ae_detach()
748 ifp = sc->ifp; in ae_detach()
750 AE_LOCK(sc); in ae_detach()
751 sc->flags |= AE_FLAG_DETACH; in ae_detach()
752 ae_stop(sc); in ae_detach()
753 AE_UNLOCK(sc); in ae_detach()
754 callout_drain(&sc->tick_ch); in ae_detach()
755 taskqueue_drain(sc->tq, &sc->int_task); in ae_detach()
756 taskqueue_drain(taskqueue_swi, &sc->link_task); in ae_detach()
759 if (sc->tq != NULL) { in ae_detach()
760 taskqueue_drain(sc->tq, &sc->int_task); in ae_detach()
761 taskqueue_free(sc->tq); in ae_detach()
762 sc->tq = NULL; in ae_detach()
764 bus_generic_detach(sc->dev); in ae_detach()
765 ae_dma_free(sc); in ae_detach()
766 if (sc->intrhand != NULL) { in ae_detach()
767 bus_teardown_intr(dev, sc->irq[0], sc->intrhand); in ae_detach()
768 sc->intrhand = NULL; in ae_detach()
772 sc->ifp = NULL; in ae_detach()
774 if (sc->spec_irq != NULL) in ae_detach()
775 bus_release_resources(dev, sc->spec_irq, sc->irq); in ae_detach()
776 if (sc->spec_mem != NULL) in ae_detach()
777 bus_release_resources(dev, sc->spec_mem, sc->mem); in ae_detach()
778 if ((sc->flags & AE_FLAG_MSI) != 0) in ae_detach()
780 mtx_destroy(&sc->mtx); in ae_detach()
788 ae_softc_t *sc; in ae_miibus_readreg() local
792 sc = device_get_softc(dev); in ae_miibus_readreg()
793 KASSERT(sc != NULL, ("[ae, %d]: sc is NULL", __LINE__)); in ae_miibus_readreg()
802 AE_WRITE_4(sc, AE_MDIO_REG, val); in ae_miibus_readreg()
809 val = AE_READ_4(sc, AE_MDIO_REG); in ae_miibus_readreg()
814 device_printf(sc->dev, "phy read timeout: %d.\n", reg); in ae_miibus_readreg()
823 ae_softc_t *sc; in ae_miibus_writereg() local
827 sc = device_get_softc(dev); in ae_miibus_writereg()
828 KASSERT(sc != NULL, ("[ae, %d]: sc is NULL", __LINE__)); in ae_miibus_writereg()
838 AE_WRITE_4(sc, AE_MDIO_REG, aereg); in ae_miibus_writereg()
845 aereg = AE_READ_4(sc, AE_MDIO_REG); in ae_miibus_writereg()
850 device_printf(sc->dev, "phy write timeout: %d.\n", reg); in ae_miibus_writereg()
858 ae_softc_t *sc; in ae_miibus_statchg() local
860 sc = device_get_softc(dev); in ae_miibus_statchg()
861 taskqueue_enqueue(taskqueue_swi, &sc->link_task); in ae_miibus_statchg()
867 ae_softc_t *sc; in ae_mediastatus() local
870 sc = if_getsoftc(ifp); in ae_mediastatus()
871 KASSERT(sc != NULL, ("[ae, %d]: sc is NULL", __LINE__)); in ae_mediastatus()
873 AE_LOCK(sc); in ae_mediastatus()
874 mii = device_get_softc(sc->miibus); in ae_mediastatus()
878 AE_UNLOCK(sc); in ae_mediastatus()
884 ae_softc_t *sc; in ae_mediachange() local
890 sc = if_getsoftc(ifp); in ae_mediachange()
891 KASSERT(sc != NULL, ("[ae, %d]: sc is NULL", __LINE__)); in ae_mediachange()
892 AE_LOCK(sc); in ae_mediachange()
893 mii = device_get_softc(sc->miibus); in ae_mediachange()
897 AE_UNLOCK(sc); in ae_mediachange()
903 ae_check_eeprom_present(ae_softc_t *sc, int *vpdc) in ae_check_eeprom_present() argument
913 val = AE_READ_4(sc, AE_SPICTL_REG); in ae_check_eeprom_present()
916 AE_WRITE_4(sc, AE_SPICTL_REG, val); in ae_check_eeprom_present()
918 error = pci_find_cap(sc->dev, PCIY_VPD, vpdc); in ae_check_eeprom_present()
923 ae_vpd_read_word(ae_softc_t *sc, int reg, uint32_t *word) in ae_vpd_read_word() argument
928 AE_WRITE_4(sc, AE_VPD_DATA_REG, 0); /* Clear register value. */ in ae_vpd_read_word()
934 AE_WRITE_4(sc, AE_VPD_CAP_REG, (val << AE_VPD_CAP_ADDR_SHIFT) & in ae_vpd_read_word()
938 val = AE_READ_4(sc, AE_VPD_CAP_REG); in ae_vpd_read_word()
943 device_printf(sc->dev, "timeout reading VPD register %d.\n", in ae_vpd_read_word()
947 *word = AE_READ_4(sc, AE_VPD_DATA_REG); in ae_vpd_read_word()
952 ae_get_vpd_eaddr(ae_softc_t *sc, uint32_t *eaddr) in ae_get_vpd_eaddr() argument
960 KASSERT(sc != NULL, ("[ae, %d]: sc is NULL", __LINE__)); in ae_get_vpd_eaddr()
966 error = ae_check_eeprom_present(sc, &vpdc); in ae_get_vpd_eaddr()
976 error = ae_vpd_read_word(sc, i, &word); in ae_get_vpd_eaddr()
991 error = ae_vpd_read_word(sc, i, &val); in ae_get_vpd_eaddr()
1007 device_printf(sc->dev, in ae_get_vpd_eaddr()
1015 ae_get_reg_eaddr(ae_softc_t *sc, uint32_t *eaddr) in ae_get_reg_eaddr() argument
1021 eaddr[0] = AE_READ_4(sc, AE_EADDR0_REG); in ae_get_reg_eaddr()
1022 eaddr[1] = AE_READ_4(sc, AE_EADDR1_REG); in ae_get_reg_eaddr()
1027 device_printf(sc->dev, in ae_get_reg_eaddr()
1035 ae_retrieve_address(ae_softc_t *sc) in ae_retrieve_address() argument
1043 error = ae_get_vpd_eaddr(sc, eaddr); in ae_retrieve_address()
1045 error = ae_get_reg_eaddr(sc, eaddr); in ae_retrieve_address()
1048 device_printf(sc->dev, in ae_retrieve_address()
1055 sc->eaddr[0] = 0x02; /* U/L bit set. */ in ae_retrieve_address()
1056 sc->eaddr[1] = 0x1f; in ae_retrieve_address()
1057 sc->eaddr[2] = 0xc6; in ae_retrieve_address()
1058 sc->eaddr[3] = (eaddr[0] >> 16) & 0xff; in ae_retrieve_address()
1059 sc->eaddr[4] = (eaddr[0] >> 8) & 0xff; in ae_retrieve_address()
1060 sc->eaddr[5] = (eaddr[0] >> 0) & 0xff; in ae_retrieve_address()
1062 sc->eaddr[0] = (eaddr[1] >> 8) & 0xff; in ae_retrieve_address()
1063 sc->eaddr[1] = (eaddr[1] >> 0) & 0xff; in ae_retrieve_address()
1064 sc->eaddr[2] = (eaddr[0] >> 24) & 0xff; in ae_retrieve_address()
1065 sc->eaddr[3] = (eaddr[0] >> 16) & 0xff; in ae_retrieve_address()
1066 sc->eaddr[4] = (eaddr[0] >> 8) & 0xff; in ae_retrieve_address()
1067 sc->eaddr[5] = (eaddr[0] >> 0) & 0xff; in ae_retrieve_address()
1084 ae_alloc_rings(ae_softc_t *sc) in ae_alloc_rings() argument
1092 error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), in ae_alloc_rings()
1096 &sc->dma_parent_tag); in ae_alloc_rings()
1098 device_printf(sc->dev, "could not creare parent DMA tag.\n"); in ae_alloc_rings()
1105 error = bus_dma_tag_create(sc->dma_parent_tag, in ae_alloc_rings()
1109 &sc->dma_txd_tag); in ae_alloc_rings()
1111 device_printf(sc->dev, "could not creare TxD DMA tag.\n"); in ae_alloc_rings()
1118 error = bus_dma_tag_create(sc->dma_parent_tag, in ae_alloc_rings()
1122 &sc->dma_txs_tag); in ae_alloc_rings()
1124 device_printf(sc->dev, "could not creare TxS DMA tag.\n"); in ae_alloc_rings()
1131 error = bus_dma_tag_create(sc->dma_parent_tag, in ae_alloc_rings()
1135 &sc->dma_rxd_tag); in ae_alloc_rings()
1137 device_printf(sc->dev, "could not creare TxS DMA tag.\n"); in ae_alloc_rings()
1144 error = bus_dmamem_alloc(sc->dma_txd_tag, (void **)&sc->txd_base, in ae_alloc_rings()
1146 &sc->dma_txd_map); in ae_alloc_rings()
1148 device_printf(sc->dev, in ae_alloc_rings()
1152 error = bus_dmamap_load(sc->dma_txd_tag, sc->dma_txd_map, sc->txd_base, in ae_alloc_rings()
1155 device_printf(sc->dev, in ae_alloc_rings()
1159 sc->dma_txd_busaddr = busaddr; in ae_alloc_rings()
1164 error = bus_dmamem_alloc(sc->dma_txs_tag, (void **)&sc->txs_base, in ae_alloc_rings()
1166 &sc->dma_txs_map); in ae_alloc_rings()
1168 device_printf(sc->dev, in ae_alloc_rings()
1172 error = bus_dmamap_load(sc->dma_txs_tag, sc->dma_txs_map, sc->txs_base, in ae_alloc_rings()
1175 device_printf(sc->dev, in ae_alloc_rings()
1179 sc->dma_txs_busaddr = busaddr; in ae_alloc_rings()
1184 error = bus_dmamem_alloc(sc->dma_rxd_tag, (void **)&sc->rxd_base_dma, in ae_alloc_rings()
1186 &sc->dma_rxd_map); in ae_alloc_rings()
1188 device_printf(sc->dev, in ae_alloc_rings()
1192 error = bus_dmamap_load(sc->dma_rxd_tag, sc->dma_rxd_map, in ae_alloc_rings()
1193 sc->rxd_base_dma, AE_RXD_COUNT_DEFAULT * 1536 + AE_RXD_PADDING, in ae_alloc_rings()
1196 device_printf(sc->dev, in ae_alloc_rings()
1200 sc->dma_rxd_busaddr = busaddr + AE_RXD_PADDING; in ae_alloc_rings()
1201 sc->rxd_base = (ae_rxd_t *)(sc->rxd_base_dma + AE_RXD_PADDING); in ae_alloc_rings()
1207 ae_dma_free(ae_softc_t *sc) in ae_dma_free() argument
1210 if (sc->dma_txd_tag != NULL) { in ae_dma_free()
1211 if (sc->dma_txd_busaddr != 0) in ae_dma_free()
1212 bus_dmamap_unload(sc->dma_txd_tag, sc->dma_txd_map); in ae_dma_free()
1213 if (sc->txd_base != NULL) in ae_dma_free()
1214 bus_dmamem_free(sc->dma_txd_tag, sc->txd_base, in ae_dma_free()
1215 sc->dma_txd_map); in ae_dma_free()
1216 bus_dma_tag_destroy(sc->dma_txd_tag); in ae_dma_free()
1217 sc->dma_txd_tag = NULL; in ae_dma_free()
1218 sc->txd_base = NULL; in ae_dma_free()
1219 sc->dma_txd_busaddr = 0; in ae_dma_free()
1221 if (sc->dma_txs_tag != NULL) { in ae_dma_free()
1222 if (sc->dma_txs_busaddr != 0) in ae_dma_free()
1223 bus_dmamap_unload(sc->dma_txs_tag, sc->dma_txs_map); in ae_dma_free()
1224 if (sc->txs_base != NULL) in ae_dma_free()
1225 bus_dmamem_free(sc->dma_txs_tag, sc->txs_base, in ae_dma_free()
1226 sc->dma_txs_map); in ae_dma_free()
1227 bus_dma_tag_destroy(sc->dma_txs_tag); in ae_dma_free()
1228 sc->dma_txs_tag = NULL; in ae_dma_free()
1229 sc->txs_base = NULL; in ae_dma_free()
1230 sc->dma_txs_busaddr = 0; in ae_dma_free()
1232 if (sc->dma_rxd_tag != NULL) { in ae_dma_free()
1233 if (sc->dma_rxd_busaddr != 0) in ae_dma_free()
1234 bus_dmamap_unload(sc->dma_rxd_tag, sc->dma_rxd_map); in ae_dma_free()
1235 if (sc->rxd_base_dma != NULL) in ae_dma_free()
1236 bus_dmamem_free(sc->dma_rxd_tag, sc->rxd_base_dma, in ae_dma_free()
1237 sc->dma_rxd_map); in ae_dma_free()
1238 bus_dma_tag_destroy(sc->dma_rxd_tag); in ae_dma_free()
1239 sc->dma_rxd_tag = NULL; in ae_dma_free()
1240 sc->rxd_base_dma = NULL; in ae_dma_free()
1241 sc->dma_rxd_busaddr = 0; in ae_dma_free()
1243 if (sc->dma_parent_tag != NULL) { in ae_dma_free()
1244 bus_dma_tag_destroy(sc->dma_parent_tag); in ae_dma_free()
1245 sc->dma_parent_tag = NULL; in ae_dma_free()
1252 ae_softc_t *sc; in ae_shutdown() local
1255 sc = device_get_softc(dev); in ae_shutdown()
1256 KASSERT(sc != NULL, ("[ae: %d]: sc is NULL", __LINE__)); in ae_shutdown()
1259 AE_LOCK(sc); in ae_shutdown()
1260 ae_powersave_enable(sc); in ae_shutdown()
1261 AE_UNLOCK(sc); in ae_shutdown()
1266 ae_powersave_disable(ae_softc_t *sc) in ae_powersave_disable() argument
1270 AE_LOCK_ASSERT(sc); in ae_powersave_disable()
1272 AE_PHY_WRITE(sc, AE_PHY_DBG_ADDR, 0); in ae_powersave_disable()
1273 val = AE_PHY_READ(sc, AE_PHY_DBG_DATA); in ae_powersave_disable()
1276 AE_PHY_WRITE(sc, AE_PHY_DBG_DATA, val); in ae_powersave_disable()
1282 ae_powersave_enable(ae_softc_t *sc) in ae_powersave_enable() argument
1286 AE_LOCK_ASSERT(sc); in ae_powersave_enable()
1291 AE_PHY_WRITE(sc, AE_PHY_DBG_ADDR, 0); in ae_powersave_enable()
1292 val = AE_PHY_READ(sc, AE_PHY_DBG_DATA); in ae_powersave_enable()
1293 AE_PHY_WRITE(sc, AE_PHY_DBG_ADDR, val | 0x1000); in ae_powersave_enable()
1294 AE_PHY_WRITE(sc, AE_PHY_DBG_ADDR, 2); in ae_powersave_enable()
1295 AE_PHY_WRITE(sc, AE_PHY_DBG_DATA, 0x3000); in ae_powersave_enable()
1296 AE_PHY_WRITE(sc, AE_PHY_DBG_ADDR, 3); in ae_powersave_enable()
1297 AE_PHY_WRITE(sc, AE_PHY_DBG_DATA, 0); in ae_powersave_enable()
1301 ae_pm_init(ae_softc_t *sc) in ae_pm_init() argument
1307 AE_LOCK_ASSERT(sc); in ae_pm_init()
1309 ifp = sc->ifp; in ae_pm_init()
1310 if ((sc->flags & AE_FLAG_PMG) == 0) { in ae_pm_init()
1312 AE_WRITE_4(sc, AE_WOL_REG, 0); in ae_pm_init()
1320 mii = device_get_softc(sc->miibus); in ae_pm_init()
1324 AE_WRITE_4(sc, AE_WOL_REG, AE_WOL_MAGIC | \ in ae_pm_init()
1340 AE_WRITE_4(sc, AE_MAC_REG, val); in ae_pm_init()
1343 AE_WRITE_4(sc, AE_WOL_REG, AE_WOL_LNKCHG | \ in ae_pm_init()
1345 AE_WRITE_4(sc, AE_MAC_REG, 0); in ae_pm_init()
1348 ae_powersave_enable(sc); in ae_pm_init()
1354 val = AE_READ_4(sc, AE_PCIE_PHYMISC_REG); in ae_pm_init()
1356 AE_WRITE_4(sc, AE_PCIE_PHYMISC_REG, val); in ae_pm_init()
1357 val = AE_READ_4(sc, AE_PCIE_DLL_TX_CTRL_REG); in ae_pm_init()
1359 AE_WRITE_4(sc, AE_PCIE_DLL_TX_CTRL_REG, val); in ae_pm_init()
1365 pci_enable_pme(sc->dev); in ae_pm_init()
1371 ae_softc_t *sc; in ae_suspend() local
1373 sc = device_get_softc(dev); in ae_suspend()
1375 AE_LOCK(sc); in ae_suspend()
1376 ae_stop(sc); in ae_suspend()
1377 ae_pm_init(sc); in ae_suspend()
1378 AE_UNLOCK(sc); in ae_suspend()
1386 ae_softc_t *sc; in ae_resume() local
1388 sc = device_get_softc(dev); in ae_resume()
1389 KASSERT(sc != NULL, ("[ae, %d]: sc is NULL", __LINE__)); in ae_resume()
1391 AE_LOCK(sc); in ae_resume()
1392 AE_READ_4(sc, AE_WOL_REG); /* Clear WOL status. */ in ae_resume()
1393 if ((if_getflags(sc->ifp) & IFF_UP) != 0) in ae_resume()
1394 ae_init_locked(sc); in ae_resume()
1395 AE_UNLOCK(sc); in ae_resume()
1401 ae_tx_avail_size(ae_softc_t *sc) in ae_tx_avail_size() argument
1405 if (sc->txd_cur >= sc->txd_ack) in ae_tx_avail_size()
1406 avail = AE_TXD_BUFSIZE_DEFAULT - (sc->txd_cur - sc->txd_ack); in ae_tx_avail_size()
1408 avail = sc->txd_ack - sc->txd_cur; in ae_tx_avail_size()
1414 ae_encap(ae_softc_t *sc, struct mbuf **m_head) in ae_encap() argument
1421 AE_LOCK_ASSERT(sc); in ae_encap()
1426 if ((sc->flags & AE_FLAG_TXAVAIL) == 0 || in ae_encap()
1427 len + sizeof(ae_txd_t) + 3 > ae_tx_avail_size(sc)) { in ae_encap()
1429 if_printf(sc->ifp, "No free Tx available.\n"); in ae_encap()
1434 hdr = (ae_txd_t *)(sc->txd_base + sc->txd_cur); in ae_encap()
1437 sc->txd_cur = (sc->txd_cur + sizeof(ae_txd_t)) % AE_TXD_BUFSIZE_DEFAULT; in ae_encap()
1439 to_end = AE_TXD_BUFSIZE_DEFAULT - sc->txd_cur; in ae_encap()
1441 m_copydata(m0, 0, len, (caddr_t)(sc->txd_base + sc->txd_cur)); in ae_encap()
1443 m_copydata(m0, 0, to_end, (caddr_t)(sc->txd_base + in ae_encap()
1444 sc->txd_cur)); in ae_encap()
1445 m_copydata(m0, to_end, len - to_end, (caddr_t)sc->txd_base); in ae_encap()
1461 sc->txd_cur = ((sc->txd_cur + len + 3) & ~3) % AE_TXD_BUFSIZE_DEFAULT; in ae_encap()
1462 if (sc->txd_cur == sc->txd_ack) in ae_encap()
1463 sc->flags &= ~AE_FLAG_TXAVAIL; in ae_encap()
1465 if_printf(sc->ifp, "New txd_cur = %d.\n", sc->txd_cur); in ae_encap()
1471 sc->txs_base[sc->txs_cur].flags &= ~htole16(AE_TXS_UPDATE); in ae_encap()
1472 sc->txs_cur = (sc->txs_cur + 1) % AE_TXS_COUNT_DEFAULT; in ae_encap()
1473 if (sc->txs_cur == sc->txs_ack) in ae_encap()
1474 sc->flags &= ~AE_FLAG_TXAVAIL; in ae_encap()
1479 bus_dmamap_sync(sc->dma_txd_tag, sc->dma_txd_map, BUS_DMASYNC_PREREAD | in ae_encap()
1481 bus_dmamap_sync(sc->dma_txs_tag, sc->dma_txs_map, in ae_encap()
1490 ae_softc_t *sc; in ae_start() local
1492 sc = if_getsoftc(ifp); in ae_start()
1493 AE_LOCK(sc); in ae_start()
1495 AE_UNLOCK(sc); in ae_start()
1501 ae_softc_t *sc; in ae_start_locked() local
1506 sc = if_getsoftc(ifp); in ae_start_locked()
1507 KASSERT(sc != NULL, ("[ae, %d]: sc is NULL", __LINE__)); in ae_start_locked()
1508 AE_LOCK_ASSERT(sc); in ae_start_locked()
1515 IFF_DRV_RUNNING || (sc->flags & AE_FLAG_LINK) == 0) in ae_start_locked()
1524 error = ae_encap(sc, &m0); in ae_start_locked()
1536 sc->tx_inproc++; in ae_start_locked()
1545 AE_WRITE_2(sc, AE_MB_TXD_IDX_REG, sc->txd_cur / 4); in ae_start_locked()
1546 sc->wd_timer = AE_TX_TIMEOUT; /* Load watchdog. */ in ae_start_locked()
1549 if_printf(ifp, "Tx pos now is %d.\n", sc->txd_cur); in ae_start_locked()
1557 ae_softc_t *sc; in ae_link_task() local
1562 sc = (ae_softc_t *)arg; in ae_link_task()
1563 KASSERT(sc != NULL, ("[ae, %d]: sc is NULL", __LINE__)); in ae_link_task()
1564 AE_LOCK(sc); in ae_link_task()
1566 ifp = sc->ifp; in ae_link_task()
1567 mii = device_get_softc(sc->miibus); in ae_link_task()
1570 AE_UNLOCK(sc); /* XXX: could happen? */ in ae_link_task()
1574 sc->flags &= ~AE_FLAG_LINK; in ae_link_task()
1580 sc->flags |= AE_FLAG_LINK; in ae_link_task()
1590 ae_stop_rxmac(sc); in ae_link_task()
1591 ae_stop_txmac(sc); in ae_link_task()
1593 if ((sc->flags & AE_FLAG_LINK) != 0) { in ae_link_task()
1594 ae_mac_config(sc); in ae_link_task()
1599 AE_WRITE_1(sc, AE_DMAREAD_REG, AE_DMAREAD_EN); in ae_link_task()
1600 AE_WRITE_1(sc, AE_DMAWRITE_REG, AE_DMAWRITE_EN); in ae_link_task()
1605 val = AE_READ_4(sc, AE_MAC_REG); in ae_link_task()
1607 AE_WRITE_4(sc, AE_MAC_REG, val); in ae_link_task()
1609 AE_UNLOCK(sc); in ae_link_task()
1613 ae_stop_rxmac(ae_softc_t *sc) in ae_stop_rxmac() argument
1618 AE_LOCK_ASSERT(sc); in ae_stop_rxmac()
1623 val = AE_READ_4(sc, AE_MAC_REG); in ae_stop_rxmac()
1626 AE_WRITE_4(sc, AE_MAC_REG, val); in ae_stop_rxmac()
1632 if (AE_READ_1(sc, AE_DMAWRITE_REG) == AE_DMAWRITE_EN) in ae_stop_rxmac()
1633 AE_WRITE_1(sc, AE_DMAWRITE_REG, 0); in ae_stop_rxmac()
1639 val = AE_READ_4(sc, AE_IDLE_REG); in ae_stop_rxmac()
1645 device_printf(sc->dev, "timed out while stopping Rx MAC.\n"); in ae_stop_rxmac()
1649 ae_stop_txmac(ae_softc_t *sc) in ae_stop_txmac() argument
1654 AE_LOCK_ASSERT(sc); in ae_stop_txmac()
1659 val = AE_READ_4(sc, AE_MAC_REG); in ae_stop_txmac()
1662 AE_WRITE_4(sc, AE_MAC_REG, val); in ae_stop_txmac()
1668 if (AE_READ_1(sc, AE_DMAREAD_REG) == AE_DMAREAD_EN) in ae_stop_txmac()
1669 AE_WRITE_1(sc, AE_DMAREAD_REG, 0); in ae_stop_txmac()
1675 val = AE_READ_4(sc, AE_IDLE_REG); in ae_stop_txmac()
1681 device_printf(sc->dev, "timed out while stopping Tx MAC.\n"); in ae_stop_txmac()
1685 ae_mac_config(ae_softc_t *sc) in ae_mac_config() argument
1690 AE_LOCK_ASSERT(sc); in ae_mac_config()
1692 mii = device_get_softc(sc->miibus); in ae_mac_config()
1693 val = AE_READ_4(sc, AE_MAC_REG); in ae_mac_config()
1700 AE_WRITE_4(sc, AE_MAC_REG, val); in ae_mac_config()
1706 ae_softc_t *sc; in ae_intr() local
1709 sc = (ae_softc_t *)arg; in ae_intr()
1710 KASSERT(sc != NULL, ("[ae, %d]: sc is NULL", __LINE__)); in ae_intr()
1712 val = AE_READ_4(sc, AE_ISR_REG); in ae_intr()
1717 AE_WRITE_4(sc, AE_ISR_REG, AE_ISR_DISABLE); in ae_intr()
1720 taskqueue_enqueue(sc->tq, &sc->int_task); in ae_intr()
1728 ae_softc_t *sc; in ae_int_task() local
1732 sc = (ae_softc_t *)arg; in ae_int_task()
1734 AE_LOCK(sc); in ae_int_task()
1736 ifp = sc->ifp; in ae_int_task()
1738 val = AE_READ_4(sc, AE_ISR_REG); /* Read interrupt status. */ in ae_int_task()
1740 AE_UNLOCK(sc); in ae_int_task()
1747 AE_WRITE_4(sc, AE_ISR_REG, val | AE_ISR_DISABLE); in ae_int_task()
1757 ae_init_locked(sc); in ae_int_task()
1758 AE_UNLOCK(sc); in ae_int_task()
1762 ae_tx_intr(sc); in ae_int_task()
1764 ae_rx_intr(sc); in ae_int_task()
1768 AE_WRITE_4(sc, AE_ISR_REG, 0); in ae_int_task()
1770 if ((sc->flags & AE_FLAG_TXAVAIL) != 0) { in ae_int_task()
1776 AE_UNLOCK(sc); in ae_int_task()
1780 ae_tx_intr(ae_softc_t *sc) in ae_tx_intr() argument
1787 AE_LOCK_ASSERT(sc); in ae_tx_intr()
1789 ifp = sc->ifp; in ae_tx_intr()
1798 bus_dmamap_sync(sc->dma_txd_tag, sc->dma_txd_map, in ae_tx_intr()
1800 bus_dmamap_sync(sc->dma_txs_tag, sc->dma_txs_map, in ae_tx_intr()
1804 txs = sc->txs_base + sc->txs_ack; in ae_tx_intr()
1810 ae_update_stats_tx(flags, &sc->stats); in ae_tx_intr()
1815 sc->txs_ack = (sc->txs_ack + 1) % AE_TXS_COUNT_DEFAULT; in ae_tx_intr()
1816 sc->flags |= AE_FLAG_TXAVAIL; in ae_tx_intr()
1818 txd = (ae_txd_t *)(sc->txd_base + sc->txd_ack); in ae_tx_intr()
1820 device_printf(sc->dev, "Size mismatch: TxS:%d TxD:%d\n", in ae_tx_intr()
1826 sc->txd_ack = ((sc->txd_ack + le16toh(txd->len) + in ae_tx_intr()
1834 sc->tx_inproc--; in ae_tx_intr()
1837 if ((sc->flags & AE_FLAG_TXAVAIL) != 0) in ae_tx_intr()
1839 if (sc->tx_inproc < 0) { in ae_tx_intr()
1841 sc->tx_inproc = 0; in ae_tx_intr()
1844 if (sc->tx_inproc == 0) in ae_tx_intr()
1845 sc->wd_timer = 0; /* Unarm watchdog. */ in ae_tx_intr()
1850 bus_dmamap_sync(sc->dma_txd_tag, sc->dma_txd_map, in ae_tx_intr()
1852 bus_dmamap_sync(sc->dma_txs_tag, sc->dma_txs_map, in ae_tx_intr()
1857 ae_rxeof(ae_softc_t *sc, ae_rxd_t *rxd) in ae_rxeof() argument
1864 AE_LOCK_ASSERT(sc); in ae_rxeof()
1866 ifp = sc->ifp; in ae_rxeof()
1895 AE_UNLOCK(sc); in ae_rxeof()
1897 AE_LOCK(sc); in ae_rxeof()
1901 ae_rx_intr(ae_softc_t *sc) in ae_rx_intr() argument
1908 KASSERT(sc != NULL, ("[ae, %d]: sc is NULL!", __LINE__)); in ae_rx_intr()
1910 AE_LOCK_ASSERT(sc); in ae_rx_intr()
1912 ifp = sc->ifp; in ae_rx_intr()
1917 bus_dmamap_sync(sc->dma_rxd_tag, sc->dma_rxd_map, in ae_rx_intr()
1921 rxd = (ae_rxd_t *)(sc->rxd_base + sc->rxd_cur); in ae_rx_intr()
1927 ae_update_stats_rx(flags, &sc->stats); in ae_rx_intr()
1932 sc->rxd_cur = (sc->rxd_cur + 1) % AE_RXD_COUNT_DEFAULT; in ae_rx_intr()
1935 ae_rxeof(sc, rxd); in ae_rx_intr()
1941 bus_dmamap_sync(sc->dma_rxd_tag, sc->dma_rxd_map, in ae_rx_intr()
1946 AE_WRITE_2(sc, AE_MB_RXD_IDX_REG, sc->rxd_cur); in ae_rx_intr()
1951 ae_watchdog(ae_softc_t *sc) in ae_watchdog() argument
1955 KASSERT(sc != NULL, ("[ae, %d]: sc is NULL!", __LINE__)); in ae_watchdog()
1956 AE_LOCK_ASSERT(sc); in ae_watchdog()
1957 ifp = sc->ifp; in ae_watchdog()
1959 if (sc->wd_timer == 0 || --sc->wd_timer != 0) in ae_watchdog()
1962 if ((sc->flags & AE_FLAG_LINK) == 0) in ae_watchdog()
1969 ae_init_locked(sc); in ae_watchdog()
1977 ae_softc_t *sc; in ae_tick() local
1980 sc = (ae_softc_t *)arg; in ae_tick()
1981 KASSERT(sc != NULL, ("[ae, %d]: sc is NULL!", __LINE__)); in ae_tick()
1982 AE_LOCK_ASSERT(sc); in ae_tick()
1984 mii = device_get_softc(sc->miibus); in ae_tick()
1986 ae_watchdog(sc); /* Watchdog check. */ in ae_tick()
1987 callout_reset(&sc->tick_ch, hz, ae_tick, sc); in ae_tick()
1991 ae_rxvlan(ae_softc_t *sc) in ae_rxvlan() argument
1996 AE_LOCK_ASSERT(sc); in ae_rxvlan()
1997 ifp = sc->ifp; in ae_rxvlan()
1998 val = AE_READ_4(sc, AE_MAC_REG); in ae_rxvlan()
2002 AE_WRITE_4(sc, AE_MAC_REG, val); in ae_rxvlan()
2017 ae_rxfilter(ae_softc_t *sc) in ae_rxfilter() argument
2023 KASSERT(sc != NULL, ("[ae, %d]: sc is NULL!", __LINE__)); in ae_rxfilter()
2025 AE_LOCK_ASSERT(sc); in ae_rxfilter()
2027 ifp = sc->ifp; in ae_rxfilter()
2029 rxcfg = AE_READ_4(sc, AE_MAC_REG); in ae_rxfilter()
2042 AE_WRITE_4(sc, AE_REG_MHT0, 0); in ae_rxfilter()
2043 AE_WRITE_4(sc, AE_REG_MHT1, 0); in ae_rxfilter()
2045 AE_WRITE_4(sc, AE_REG_MHT0, 0xffffffff); in ae_rxfilter()
2046 AE_WRITE_4(sc, AE_REG_MHT1, 0xffffffff); in ae_rxfilter()
2047 AE_WRITE_4(sc, AE_MAC_REG, rxcfg); in ae_rxfilter()
2056 AE_WRITE_4(sc, AE_REG_MHT0, mchash[0]); in ae_rxfilter()
2057 AE_WRITE_4(sc, AE_REG_MHT1, mchash[1]); in ae_rxfilter()
2058 AE_WRITE_4(sc, AE_MAC_REG, rxcfg); in ae_rxfilter()
2064 struct ae_softc *sc; in ae_ioctl() local
2069 sc = if_getsoftc(ifp); in ae_ioctl()
2078 AE_LOCK(sc); in ae_ioctl()
2082 ae_init_locked(sc); in ae_ioctl()
2084 AE_UNLOCK(sc); in ae_ioctl()
2088 AE_LOCK(sc); in ae_ioctl()
2091 if (((if_getflags(ifp) ^ sc->if_flags) in ae_ioctl()
2093 ae_rxfilter(sc); in ae_ioctl()
2095 if ((sc->flags & AE_FLAG_DETACH) == 0) in ae_ioctl()
2096 ae_init_locked(sc); in ae_ioctl()
2100 ae_stop(sc); in ae_ioctl()
2102 sc->if_flags = if_getflags(ifp); in ae_ioctl()
2103 AE_UNLOCK(sc); in ae_ioctl()
2107 AE_LOCK(sc); in ae_ioctl()
2109 ae_rxfilter(sc); in ae_ioctl()
2110 AE_UNLOCK(sc); in ae_ioctl()
2114 mii = device_get_softc(sc->miibus); in ae_ioctl()
2118 AE_LOCK(sc); in ae_ioctl()
2123 ae_rxvlan(sc); in ae_ioctl()
2126 AE_UNLOCK(sc); in ae_ioctl()
2136 ae_stop(ae_softc_t *sc) in ae_stop() argument
2141 AE_LOCK_ASSERT(sc); in ae_stop()
2143 ifp = sc->ifp; in ae_stop()
2145 sc->flags &= ~AE_FLAG_LINK; in ae_stop()
2146 sc->wd_timer = 0; /* Cancel watchdog. */ in ae_stop()
2147 callout_stop(&sc->tick_ch); in ae_stop()
2152 AE_WRITE_4(sc, AE_IMR_REG, 0); in ae_stop()
2153 AE_WRITE_4(sc, AE_ISR_REG, 0xffffffff); in ae_stop()
2158 ae_stop_txmac(sc); in ae_stop()
2159 ae_stop_rxmac(sc); in ae_stop()
2164 AE_WRITE_1(sc, AE_DMAREAD_REG, ~AE_DMAREAD_EN); in ae_stop()
2165 AE_WRITE_1(sc, AE_DMAWRITE_REG, ~AE_DMAWRITE_EN); in ae_stop()
2171 if (AE_READ_4(sc, AE_IDLE_REG) == 0) in ae_stop()
2176 device_printf(sc->dev, "could not enter idle state in stop.\n"); in ae_stop()