1694c6518SBenno Rice /*- 2*718cf2ccSPedro F. Giffuni * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3*718cf2ccSPedro F. Giffuni * 4269a0696SBenno Rice * Copyright (c) 2008 Benno Rice. All rights reserved. 5694c6518SBenno Rice * 6694c6518SBenno Rice * Redistribution and use in source and binary forms, with or without 7694c6518SBenno Rice * modification, are permitted provided that the following conditions 8694c6518SBenno Rice * are met: 9694c6518SBenno Rice * 1. Redistributions of source code must retain the above copyright 10694c6518SBenno Rice * notice, this list of conditions and the following disclaimer. 11694c6518SBenno Rice * 2. Redistributions in binary form must reproduce the above copyright 12694c6518SBenno Rice * notice, this list of conditions and the following disclaimer in the 13694c6518SBenno Rice * documentation and/or other materials provided with the distribution. 14694c6518SBenno Rice * 15694c6518SBenno Rice * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16694c6518SBenno Rice * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17694c6518SBenno Rice * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18694c6518SBenno Rice * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19694c6518SBenno Rice * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20694c6518SBenno Rice * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21694c6518SBenno Rice * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22694c6518SBenno Rice * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23694c6518SBenno Rice * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24694c6518SBenno Rice * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25694c6518SBenno Rice * 26694c6518SBenno Rice * $FreeBSD$ 27694c6518SBenno Rice * 28694c6518SBenno Rice */ 29694c6518SBenno Rice 30694c6518SBenno Rice #ifndef _IF_SMCVAR_H_ 31694c6518SBenno Rice #define _IF_SMCVAR_H_ 32694c6518SBenno Rice 33694c6518SBenno Rice struct smc_softc { 34694c6518SBenno Rice struct ifnet *smc_ifp; 35694c6518SBenno Rice device_t smc_dev; 36694c6518SBenno Rice struct mtx smc_mtx; 37694c6518SBenno Rice u_int smc_chip; 38694c6518SBenno Rice u_int smc_rev; 39694c6518SBenno Rice u_int smc_mask; 40694c6518SBenno Rice 41694c6518SBenno Rice /* Resources */ 42694c6518SBenno Rice int smc_usemem; 43694c6518SBenno Rice int smc_reg_rid; 44694c6518SBenno Rice int smc_irq_rid; 45694c6518SBenno Rice struct resource *smc_reg; 46694c6518SBenno Rice struct resource *smc_irq; 47694c6518SBenno Rice void *smc_ih; 48694c6518SBenno Rice 49694c6518SBenno Rice /* Tasks */ 50694c6518SBenno Rice struct taskqueue *smc_tq; 513c463a49SBenno Rice struct task smc_intr; 52694c6518SBenno Rice struct task smc_rx; 53694c6518SBenno Rice struct task smc_tx; 54694c6518SBenno Rice struct mbuf *smc_pending; 55694c6518SBenno Rice struct callout smc_watchdog; 56694c6518SBenno Rice 57694c6518SBenno Rice /* MII support */ 58694c6518SBenno Rice device_t smc_miibus; 59694c6518SBenno Rice struct callout smc_mii_tick_ch; 60694c6518SBenno Rice void (*smc_mii_tick)(void *); 61694c6518SBenno Rice void (*smc_mii_mediachg)(struct smc_softc *); 62694c6518SBenno Rice int (*smc_mii_mediaioctl)(struct smc_softc *, 63694c6518SBenno Rice struct ifreq *, u_long); 64694c6518SBenno Rice 65694c6518SBenno Rice /* DMA support */ 66694c6518SBenno Rice void (*smc_read_packet)(struct smc_softc *, 67694c6518SBenno Rice bus_addr_t, uint8_t *, bus_size_t); 68694c6518SBenno Rice void *smc_read_arg; 69694c6518SBenno Rice }; 70694c6518SBenno Rice 71694c6518SBenno Rice int smc_probe(device_t); 72694c6518SBenno Rice int smc_attach(device_t); 73694c6518SBenno Rice int smc_detach(device_t); 74694c6518SBenno Rice 75694c6518SBenno Rice int smc_miibus_readreg(device_t, int, int); 768e45f0b7SAndriy Gapon int smc_miibus_writereg(device_t, int, int, int); 77694c6518SBenno Rice void smc_miibus_statchg(device_t); 78694c6518SBenno Rice 79694c6518SBenno Rice #endif /* _IF_SMCVAR_H_ */ 80