xref: /freebsd/sys/dev/smc/if_smcvar.h (revision 2a58b312b62f908ec92311d1bd8536dbaeb8e55b)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
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  * $FreeBSD$
27  *
28  */
29 
30 #ifndef _IF_SMCVAR_H_
31 #define	_IF_SMCVAR_H_
32 
33 struct smc_softc {
34 	if_t			smc_ifp;
35 	device_t		smc_dev;
36 	struct mtx		smc_mtx;
37 	u_int			smc_chip;
38 	u_int			smc_rev;
39 	u_int			smc_mask;
40 
41 	/* Resources */
42 	int			smc_usemem;
43 	int			smc_reg_rid;
44 	int			smc_irq_rid;
45 	struct resource		*smc_reg;
46 	struct resource		*smc_irq;
47 	void			*smc_ih;
48 
49 	/* Tasks */
50 	struct taskqueue	*smc_tq;
51 	struct task		smc_intr;
52 	struct task		smc_rx;
53 	struct task		smc_tx;
54 	struct mbuf		*smc_pending;
55 	struct callout		smc_watchdog;
56 
57 	/* MII support */
58 	device_t		smc_miibus;
59 	struct callout		smc_mii_tick_ch;
60 	void			(*smc_mii_tick)(void *);
61 	void			(*smc_mii_mediachg)(struct smc_softc *);
62 	int			(*smc_mii_mediaioctl)(struct smc_softc *,
63 				    struct ifreq *, u_long);
64 
65 	/* DMA support */
66 	void			(*smc_read_packet)(struct smc_softc *,
67 				    bus_addr_t, uint8_t *, bus_size_t);
68 	void			*smc_read_arg;
69 };
70 
71 DECLARE_CLASS(smc_driver);
72 
73 int	smc_probe(device_t);
74 int	smc_attach(device_t);
75 int	smc_detach(device_t);
76 
77 int	smc_miibus_readreg(device_t, int, int);
78 int	smc_miibus_writereg(device_t, int, int, int);
79 void	smc_miibus_statchg(device_t);
80 
81 #endif /* _IF_SMCVAR_H_ */
82