xref: /freebsd/sys/dev/smc/if_smcvar.h (revision 2008043f386721d58158e37e0d7e50df8095942d)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2008 Benno Rice.  All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  *
26  */
27 
28 #ifndef _IF_SMCVAR_H_
29 #define	_IF_SMCVAR_H_
30 
31 struct smc_softc {
32 	if_t			smc_ifp;
33 	device_t		smc_dev;
34 	struct mtx		smc_mtx;
35 	u_int			smc_chip;
36 	u_int			smc_rev;
37 	u_int			smc_mask;
38 
39 	/* Resources */
40 	int			smc_usemem;
41 	int			smc_reg_rid;
42 	int			smc_irq_rid;
43 	struct resource		*smc_reg;
44 	struct resource		*smc_irq;
45 	void			*smc_ih;
46 
47 	/* Tasks */
48 	struct taskqueue	*smc_tq;
49 	struct task		smc_intr;
50 	struct task		smc_rx;
51 	struct task		smc_tx;
52 	struct mbuf		*smc_pending;
53 	struct callout		smc_watchdog;
54 
55 	/* MII support */
56 	device_t		smc_miibus;
57 	struct callout		smc_mii_tick_ch;
58 	void			(*smc_mii_tick)(void *);
59 	void			(*smc_mii_mediachg)(struct smc_softc *);
60 	int			(*smc_mii_mediaioctl)(struct smc_softc *,
61 				    struct ifreq *, u_long);
62 
63 	/* DMA support */
64 	void			(*smc_read_packet)(struct smc_softc *,
65 				    bus_addr_t, uint8_t *, bus_size_t);
66 	void			*smc_read_arg;
67 };
68 
69 DECLARE_CLASS(smc_driver);
70 
71 int	smc_probe(device_t);
72 int	smc_attach(device_t);
73 int	smc_detach(device_t);
74 
75 int	smc_miibus_readreg(device_t, int, int);
76 int	smc_miibus_writereg(device_t, int, int, int);
77 void	smc_miibus_statchg(device_t);
78 
79 #endif /* _IF_SMCVAR_H_ */
80