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