Home | History | Annotate | Line # | Download | only in ic
bcmgenetvar.h revision 1.1.2.2
      1  1.1.2.2  ad /* $NetBSD: bcmgenetvar.h,v 1.1.2.2 2020/02/29 20:19:08 ad Exp $ */
      2  1.1.2.2  ad 
      3  1.1.2.2  ad /*-
      4  1.1.2.2  ad  * Copyright (c) 2020 Jared McNeill <jmcneill (at) invisible.ca>
      5  1.1.2.2  ad  * All rights reserved.
      6  1.1.2.2  ad  *
      7  1.1.2.2  ad  * Redistribution and use in source and binary forms, with or without
      8  1.1.2.2  ad  * modification, are permitted provided that the following conditions
      9  1.1.2.2  ad  * are met:
     10  1.1.2.2  ad  * 1. Redistributions of source code must retain the above copyright
     11  1.1.2.2  ad  *    notice, this list of conditions and the following disclaimer.
     12  1.1.2.2  ad  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1.2.2  ad  *    notice, this list of conditions and the following disclaimer in the
     14  1.1.2.2  ad  *    documentation and/or other materials provided with the distribution.
     15  1.1.2.2  ad  *
     16  1.1.2.2  ad  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  1.1.2.2  ad  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18  1.1.2.2  ad  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19  1.1.2.2  ad  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  1.1.2.2  ad  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     21  1.1.2.2  ad  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     22  1.1.2.2  ad  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     23  1.1.2.2  ad  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     24  1.1.2.2  ad  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25  1.1.2.2  ad  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26  1.1.2.2  ad  * SUCH DAMAGE.
     27  1.1.2.2  ad  */
     28  1.1.2.2  ad 
     29  1.1.2.2  ad /*
     30  1.1.2.2  ad  * Broadcom GENETv5
     31  1.1.2.2  ad  */
     32  1.1.2.2  ad 
     33  1.1.2.2  ad #ifndef _BCMGENETVAR_H
     34  1.1.2.2  ad #define _BCMGENETVAR_H
     35  1.1.2.2  ad 
     36  1.1.2.2  ad #include <dev/ic/bcmgenetreg.h>
     37  1.1.2.2  ad 
     38  1.1.2.2  ad enum genet_phy_mode {
     39  1.1.2.2  ad 	GENET_PHY_MODE_RGMII,
     40  1.1.2.2  ad 	GENET_PHY_MODE_RGMII_TXID,
     41  1.1.2.2  ad 	GENET_PHY_MODE_RGMII_RXID,
     42  1.1.2.2  ad };
     43  1.1.2.2  ad 
     44  1.1.2.2  ad struct genet_bufmap {
     45  1.1.2.2  ad 	bus_dmamap_t		map;
     46  1.1.2.2  ad 	struct mbuf		*mbuf;
     47  1.1.2.2  ad };
     48  1.1.2.2  ad 
     49  1.1.2.2  ad struct genet_ring {
     50  1.1.2.2  ad 	bus_dma_tag_t		buf_tag;
     51  1.1.2.2  ad 	struct genet_bufmap	buf_map[GENET_DMA_DESC_COUNT];
     52  1.1.2.2  ad 	u_int			next, queued;
     53  1.1.2.2  ad 	uint32_t		cidx, pidx;
     54  1.1.2.2  ad };
     55  1.1.2.2  ad 
     56  1.1.2.2  ad struct genet_softc {
     57  1.1.2.2  ad 	device_t		sc_dev;
     58  1.1.2.2  ad 	bus_space_tag_t		sc_bst;
     59  1.1.2.2  ad 	bus_space_handle_t	sc_bsh;
     60  1.1.2.2  ad 	bus_dma_tag_t		sc_dmat;
     61  1.1.2.2  ad 	int			sc_phy_id;
     62  1.1.2.2  ad 	enum genet_phy_mode	sc_phy_mode;
     63  1.1.2.2  ad 
     64  1.1.2.2  ad 	struct ethercom		sc_ec;
     65  1.1.2.2  ad 	struct mii_data		sc_mii;
     66  1.1.2.2  ad 	callout_t		sc_stat_ch;
     67  1.1.2.2  ad 	kmutex_t		sc_lock;
     68  1.1.2.2  ad 
     69  1.1.2.2  ad 	struct genet_ring	sc_tx;
     70  1.1.2.2  ad 	struct genet_ring	sc_rx;
     71  1.1.2.2  ad };
     72  1.1.2.2  ad 
     73  1.1.2.2  ad int	genet_attach(struct genet_softc *);
     74  1.1.2.2  ad int	genet_intr(void *);
     75  1.1.2.2  ad 
     76  1.1.2.2  ad #endif /* !_BCMGENETVAR_H */
     77