xref: /freebsd/sys/dev/vnic/thunder_mdio_var.h (revision b9545c57941598857677c31b90c707123d8f4976)
1441d6780SZbigniew Bodek /*-
2441d6780SZbigniew Bodek  * Copyright (c) 2015 The FreeBSD Foundation
3441d6780SZbigniew Bodek  *
4441d6780SZbigniew Bodek  * This software was developed by Semihalf under
5441d6780SZbigniew Bodek  * the sponsorship of the FreeBSD Foundation.
6441d6780SZbigniew Bodek  *
7441d6780SZbigniew Bodek  * Redistribution and use in source and binary forms, with or without
8441d6780SZbigniew Bodek  * modification, are permitted provided that the following conditions
9441d6780SZbigniew Bodek  * are met:
10441d6780SZbigniew Bodek  * 1. Redistributions of source code must retain the above copyright
11441d6780SZbigniew Bodek  *    notice, this list of conditions and the following disclaimer.
12441d6780SZbigniew Bodek  * 2. Redistributions in binary form must reproduce the above copyright
13441d6780SZbigniew Bodek  *    notice, this list of conditions and the following disclaimer in the
14441d6780SZbigniew Bodek  *    documentation and/or other materials provided with the distribution.
15441d6780SZbigniew Bodek  *
16441d6780SZbigniew Bodek  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17441d6780SZbigniew Bodek  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18441d6780SZbigniew Bodek  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19441d6780SZbigniew Bodek  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20441d6780SZbigniew Bodek  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21441d6780SZbigniew Bodek  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22441d6780SZbigniew Bodek  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23441d6780SZbigniew Bodek  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24441d6780SZbigniew Bodek  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25441d6780SZbigniew Bodek  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26441d6780SZbigniew Bodek  * SUCH DAMAGE.
27441d6780SZbigniew Bodek  *
28441d6780SZbigniew Bodek  * $FreeBSD$
29441d6780SZbigniew Bodek  *
30441d6780SZbigniew Bodek  */
31441d6780SZbigniew Bodek 
32441d6780SZbigniew Bodek #ifndef __THUNDER_MDIO_VAR_H__
33441d6780SZbigniew Bodek #define	__THUNDER_MDIO_VAR_H__
34441d6780SZbigniew Bodek 
35441d6780SZbigniew Bodek #define	THUNDER_MDIO_DEVSTR	"Cavium ThunderX SMI/MDIO driver"
363f51d888SZbigniew Bodek MALLOC_DECLARE(M_THUNDER_MDIO);
37441d6780SZbigniew Bodek DECLARE_CLASS(thunder_mdio_driver);
38441d6780SZbigniew Bodek 
39441d6780SZbigniew Bodek enum thunder_mdio_mode {
40441d6780SZbigniew Bodek 	MODE_NONE = 0,
41441d6780SZbigniew Bodek 	MODE_IEEE_C22,
42441d6780SZbigniew Bodek 	MODE_IEEE_C45
43441d6780SZbigniew Bodek };
44441d6780SZbigniew Bodek 
45441d6780SZbigniew Bodek struct phy_desc {
46441d6780SZbigniew Bodek 	device_t		miibus; /* One miibus per LMAC */
47*b9545c57SJustin Hibbits 	if_t 			ifp;	/* Fake ifp to satisfy miibus */
48441d6780SZbigniew Bodek 	int			lmacid;	/* ID number of LMAC connected */
49441d6780SZbigniew Bodek 	TAILQ_ENTRY(phy_desc)	phy_desc_list;
50441d6780SZbigniew Bodek };
51441d6780SZbigniew Bodek 
52441d6780SZbigniew Bodek struct thunder_mdio_softc {
53441d6780SZbigniew Bodek 	device_t		dev;
54441d6780SZbigniew Bodek 	struct mtx		mtx;
55441d6780SZbigniew Bodek 	struct resource *	reg_base;
56441d6780SZbigniew Bodek 
57441d6780SZbigniew Bodek 	enum thunder_mdio_mode	mode;
58441d6780SZbigniew Bodek 
59441d6780SZbigniew Bodek 	TAILQ_HEAD(,phy_desc)	phy_desc_head;
60441d6780SZbigniew Bodek };
61441d6780SZbigniew Bodek 
62441d6780SZbigniew Bodek int thunder_mdio_attach(device_t);
63441d6780SZbigniew Bodek #endif
64