xref: /freebsd/sys/dev/vnic/thunder_mdio_var.h (revision 441d67800c37883bc6433e00b39d6114695a7905)
1*441d6780SZbigniew Bodek /*-
2*441d6780SZbigniew Bodek  * Copyright (c) 2015 The FreeBSD Foundation
3*441d6780SZbigniew Bodek  * All rights reserved.
4*441d6780SZbigniew Bodek  *
5*441d6780SZbigniew Bodek  * This software was developed by Semihalf under
6*441d6780SZbigniew Bodek  * the sponsorship of the FreeBSD Foundation.
7*441d6780SZbigniew Bodek  *
8*441d6780SZbigniew Bodek  * Redistribution and use in source and binary forms, with or without
9*441d6780SZbigniew Bodek  * modification, are permitted provided that the following conditions
10*441d6780SZbigniew Bodek  * are met:
11*441d6780SZbigniew Bodek  * 1. Redistributions of source code must retain the above copyright
12*441d6780SZbigniew Bodek  *    notice, this list of conditions and the following disclaimer.
13*441d6780SZbigniew Bodek  * 2. Redistributions in binary form must reproduce the above copyright
14*441d6780SZbigniew Bodek  *    notice, this list of conditions and the following disclaimer in the
15*441d6780SZbigniew Bodek  *    documentation and/or other materials provided with the distribution.
16*441d6780SZbigniew Bodek  *
17*441d6780SZbigniew Bodek  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18*441d6780SZbigniew Bodek  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19*441d6780SZbigniew Bodek  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20*441d6780SZbigniew Bodek  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21*441d6780SZbigniew Bodek  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22*441d6780SZbigniew Bodek  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23*441d6780SZbigniew Bodek  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24*441d6780SZbigniew Bodek  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25*441d6780SZbigniew Bodek  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26*441d6780SZbigniew Bodek  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27*441d6780SZbigniew Bodek  * SUCH DAMAGE.
28*441d6780SZbigniew Bodek  *
29*441d6780SZbigniew Bodek  * $FreeBSD$
30*441d6780SZbigniew Bodek  *
31*441d6780SZbigniew Bodek  */
32*441d6780SZbigniew Bodek 
33*441d6780SZbigniew Bodek #ifndef __THUNDER_MDIO_VAR_H__
34*441d6780SZbigniew Bodek #define	__THUNDER_MDIO_VAR_H__
35*441d6780SZbigniew Bodek 
36*441d6780SZbigniew Bodek #define	THUNDER_MDIO_DEVSTR	"Cavium ThunderX SMI/MDIO driver"
37*441d6780SZbigniew Bodek DECLARE_CLASS(thunder_mdio_driver);
38*441d6780SZbigniew Bodek 
39*441d6780SZbigniew Bodek enum thunder_mdio_mode {
40*441d6780SZbigniew Bodek 	MODE_NONE = 0,
41*441d6780SZbigniew Bodek 	MODE_IEEE_C22,
42*441d6780SZbigniew Bodek 	MODE_IEEE_C45
43*441d6780SZbigniew Bodek };
44*441d6780SZbigniew Bodek 
45*441d6780SZbigniew Bodek struct phy_desc {
46*441d6780SZbigniew Bodek 	device_t		miibus; /* One miibus per LMAC */
47*441d6780SZbigniew Bodek 	struct ifnet *		ifp;	/* Fake ifp to satisfy miibus */
48*441d6780SZbigniew Bodek 	int			lmacid;	/* ID number of LMAC connected */
49*441d6780SZbigniew Bodek 	TAILQ_ENTRY(phy_desc)	phy_desc_list;
50*441d6780SZbigniew Bodek };
51*441d6780SZbigniew Bodek 
52*441d6780SZbigniew Bodek struct thunder_mdio_softc {
53*441d6780SZbigniew Bodek 	device_t		dev;
54*441d6780SZbigniew Bodek 	struct mtx		mtx;
55*441d6780SZbigniew Bodek 	struct resource *	reg_base;
56*441d6780SZbigniew Bodek 
57*441d6780SZbigniew Bodek 	enum thunder_mdio_mode	mode;
58*441d6780SZbigniew Bodek 
59*441d6780SZbigniew Bodek 	TAILQ_HEAD(,phy_desc)	phy_desc_head;
60*441d6780SZbigniew Bodek };
61*441d6780SZbigniew Bodek 
62*441d6780SZbigniew Bodek int thunder_mdio_attach(device_t);
63*441d6780SZbigniew Bodek #endif
64