Deleted Added
full compact
miivar.h (204646) miivar.h (213878)
1/* $NetBSD: miivar.h,v 1.8 1999/04/23 04:24:32 thorpej Exp $ */
2
3/*-
4 * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,

--- 15 unchanged lines hidden (view full) ---

24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 *
1/* $NetBSD: miivar.h,v 1.8 1999/04/23 04:24:32 thorpej Exp $ */
2
3/*-
4 * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,

--- 15 unchanged lines hidden (view full) ---

24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 *
32 * $FreeBSD: head/sys/dev/mii/miivar.h 204646 2010-03-03 17:55:51Z joel $
32 * $FreeBSD: head/sys/dev/mii/miivar.h 213878 2010-10-14 22:01:40Z marius $
33 */
34
35#ifndef _DEV_MII_MIIVAR_H_
36#define _DEV_MII_MIIVAR_H_
37
38#include <sys/queue.h>
39
40/*

--- 56 unchanged lines hidden (view full) ---

97
98/*
99 * Each PHY driver's softc has one of these as the first member.
100 * XXX This would be better named "phy_softc", but this is the name
101 * XXX BSDI used, and we would like to have the same interface.
102 */
103struct mii_softc {
104 device_t mii_dev; /* generic device glue */
33 */
34
35#ifndef _DEV_MII_MIIVAR_H_
36#define _DEV_MII_MIIVAR_H_
37
38#include <sys/queue.h>
39
40/*

--- 56 unchanged lines hidden (view full) ---

97
98/*
99 * Each PHY driver's softc has one of these as the first member.
100 * XXX This would be better named "phy_softc", but this is the name
101 * XXX BSDI used, and we would like to have the same interface.
102 */
103struct mii_softc {
104 device_t mii_dev; /* generic device glue */
105
105
106 LIST_ENTRY(mii_softc) mii_list; /* entry on parent's PHY list */
107
108 int mii_phy; /* our MII address */
109 int mii_inst; /* instance for ifmedia */
110
111 mii_downcall_t mii_service; /* our downcall */
112 struct mii_data *mii_pdata; /* pointer to parent's mii_data */
113
114 int mii_flags; /* misc. flags; see below */
115 int mii_capabilities; /* capabilities from BMSR */
116 int mii_extcapabilities; /* extended capabilities */
117 int mii_ticks; /* MII_TICK counter */
118 int mii_anegticks; /* ticks before retrying aneg */
119 int mii_media_active; /* last active media */
120 int mii_media_status; /* last active status */
121};
122typedef struct mii_softc mii_softc_t;
123
124/* mii_flags */
106 LIST_ENTRY(mii_softc) mii_list; /* entry on parent's PHY list */
107
108 int mii_phy; /* our MII address */
109 int mii_inst; /* instance for ifmedia */
110
111 mii_downcall_t mii_service; /* our downcall */
112 struct mii_data *mii_pdata; /* pointer to parent's mii_data */
113
114 int mii_flags; /* misc. flags; see below */
115 int mii_capabilities; /* capabilities from BMSR */
116 int mii_extcapabilities; /* extended capabilities */
117 int mii_ticks; /* MII_TICK counter */
118 int mii_anegticks; /* ticks before retrying aneg */
119 int mii_media_active; /* last active media */
120 int mii_media_status; /* last active status */
121};
122typedef struct mii_softc mii_softc_t;
123
124/* mii_flags */
125#define MIIF_INITDONE 0x0001 /* has been initialized (mii_data) */
126#define MIIF_NOISOLATE 0x0002 /* do not isolate the PHY */
127#define MIIF_NOLOOP 0x0004 /* no loopback capability */
128#define MIIF_AUTOTSLEEP 0x0010 /* use tsleep(), not callout() */
129#define MIIF_HAVEFIBER 0x0020 /* from parent: has fiber interface */
130#define MIIF_HAVE_GTCR 0x0040 /* has 100base-T2/1000base-T CR */
131#define MIIF_IS_1000X 0x0080 /* is a 1000BASE-X device */
132#define MIIF_DOPAUSE 0x0100 /* advertise PAUSE capability */
133#define MIIF_IS_HPNA 0x0200 /* is a HomePNA device */
134#define MIIF_FORCEANEG 0x0400 /* force auto-negotiation */
125#define MIIF_INITDONE 0x00000001 /* has been initialized (mii_data) */
126#define MIIF_NOISOLATE 0x00000002 /* do not isolate the PHY */
127#define MIIF_NOLOOP 0x00000004 /* no loopback capability */
128#define MIIF_AUTOTSLEEP 0x00000010 /* use tsleep(), not callout() */
129#define MIIF_HAVEFIBER 0x00000020 /* from parent: has fiber interface */
130#define MIIF_HAVE_GTCR 0x00000040 /* has 100base-T2/1000base-T CR */
131#define MIIF_IS_1000X 0x00000080 /* is a 1000BASE-X device */
132#define MIIF_DOPAUSE 0x00000100 /* advertise PAUSE capability */
133#define MIIF_IS_HPNA 0x00000200 /* is a HomePNA device */
134#define MIIF_FORCEANEG 0x00000400 /* force auto-negotiation */
135#define MIIF_MACPRIV0 0x01000000 /* private to the MAC driver */
136#define MIIF_MACPRIV1 0x02000000 /* private to the MAC driver */
137#define MIIF_MACPRIV2 0x04000000 /* private to the MAC driver */
138#define MIIF_PHYPRIV0 0x10000000 /* private to the PHY driver */
139#define MIIF_PHYPRIV1 0x20000000 /* private to the PHY driver */
140#define MIIF_PHYPRIV2 0x40000000 /* private to the PHY driver */
135
136/* Default mii_anegticks values */
137#define MII_ANEGTICKS 5
138#define MII_ANEGTICKS_GIGE 17
139
140#define MIIF_INHERIT_MASK (MIIF_NOISOLATE|MIIF_NOLOOP|MIIF_AUTOTSLEEP)
141
142/*
141
142/* Default mii_anegticks values */
143#define MII_ANEGTICKS 5
144#define MII_ANEGTICKS_GIGE 17
145
146#define MIIF_INHERIT_MASK (MIIF_NOISOLATE|MIIF_NOLOOP|MIIF_AUTOTSLEEP)
147
148/*
149 * Special `locators' passed to mii_attach(). If one of these is not
150 * an `any' value, we look for *that* PHY and configure it. If both
151 * are not `any', that is an error, and mii_attach() will panic.
152 */
153#define MII_OFFSET_ANY -1
154#define MII_PHY_ANY -1
155
156/*
143 * Used to attach a PHY to a parent.
144 */
145struct mii_attach_args {
146 struct mii_data *mii_data; /* pointer to parent data */
147 int mii_phyno; /* MII address */
148 int mii_id1; /* PHY ID register 1 */
149 int mii_id2; /* PHY ID register 2 */
150 int mii_capmask; /* capability mask from BMSR */

--- 36 unchanged lines hidden (view full) ---

187#ifdef _KERNEL
188
189#define PHY_READ(p, r) \
190 MIIBUS_READREG((p)->mii_dev, (p)->mii_phy, (r))
191
192#define PHY_WRITE(p, r, v) \
193 MIIBUS_WRITEREG((p)->mii_dev, (p)->mii_phy, (r), (v))
194
157 * Used to attach a PHY to a parent.
158 */
159struct mii_attach_args {
160 struct mii_data *mii_data; /* pointer to parent data */
161 int mii_phyno; /* MII address */
162 int mii_id1; /* PHY ID register 1 */
163 int mii_id2; /* PHY ID register 2 */
164 int mii_capmask; /* capability mask from BMSR */

--- 36 unchanged lines hidden (view full) ---

201#ifdef _KERNEL
202
203#define PHY_READ(p, r) \
204 MIIBUS_READREG((p)->mii_dev, (p)->mii_phy, (r))
205
206#define PHY_WRITE(p, r, v) \
207 MIIBUS_WRITEREG((p)->mii_dev, (p)->mii_phy, (r), (v))
208
209enum miibus_device_ivars {
210 MIIBUS_IVAR_FLAGS
211};
212
213/*
214 * Simplified accessors for miibus
215 */
216#define MIIBUS_ACCESSOR(var, ivar, type) \
217 __BUS_ACCESSOR(miibus, var, MIIBUS, ivar, type)
218
219MIIBUS_ACCESSOR(flags, FLAGS, int)
220
195extern devclass_t miibus_devclass;
196extern driver_t miibus_driver;
197
198int miibus_probe(device_t);
199int miibus_attach(device_t);
200int miibus_detach(device_t);
201
221extern devclass_t miibus_devclass;
222extern driver_t miibus_driver;
223
224int miibus_probe(device_t);
225int miibus_attach(device_t);
226int miibus_detach(device_t);
227
228int mii_attach(device_t, device_t *, struct ifnet *, ifm_change_cb_t,
229 ifm_stat_cb_t, int, int, int, int);
202int mii_anar(int);
203void mii_down(struct mii_data *);
204int mii_mediachg(struct mii_data *);
205void mii_tick(struct mii_data *);
206void mii_pollstat(struct mii_data *);
207int mii_phy_probe(device_t, device_t *, ifm_change_cb_t, ifm_stat_cb_t);
208void mii_add_media(struct mii_softc *);
209void mii_phy_add_media(struct mii_softc *);

--- 19 unchanged lines hidden ---
230int mii_anar(int);
231void mii_down(struct mii_data *);
232int mii_mediachg(struct mii_data *);
233void mii_tick(struct mii_data *);
234void mii_pollstat(struct mii_data *);
235int mii_phy_probe(device_t, device_t *, ifm_change_cb_t, ifm_stat_cb_t);
236void mii_add_media(struct mii_softc *);
237void mii_phy_add_media(struct mii_softc *);

--- 19 unchanged lines hidden ---