The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/nve/if_nvereg.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 2005 by David E. O'Brien <obrien@FreeBSD.org>.
    3  * Copyright (c) 2003 by Quinton Dolan <q@onthenet.com.au>.
    4  * 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 AND CONTRIBUTORS `AS IS'' AND
   16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 
   19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
   21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
   22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
   24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
   25  * SUCH DAMAGE.
   26  *
   27  * $Id: if_nvreg.h,v 1.6 2004/08/12 14:00:05 q Exp $
   28  * $FreeBSD: releng/8.0/sys/dev/nve/if_nvereg.h 179458 2008-05-31 14:17:36Z remko $
   29  */
   30  
   31 #ifndef _IF_NVEREG_H_
   32 #define _IF_NVEREG_H_
   33 
   34 #ifndef PCI_VENDOR_NVIDIA
   35 #define PCI_VENDOR_NVIDIA 0x10DE
   36 #endif
   37 
   38 #define PCI_PRODUCT_NVIDIA_NFORCE_LAN           0x01C3
   39 #define PCI_PRODUCT_NVIDIA_NFORCE2_LAN          0x0066
   40 #define PCI_PRODUCT_NVIDIA_NFORCE3_LAN1         0x00D6
   41 #define PCI_PRODUCT_NVIDIA_NFORCE2_400_LAN1     0x0086
   42 #define PCI_PRODUCT_NVIDIA_NFORCE2_400_LAN2     0x008C
   43 #define PCI_PRODUCT_NVIDIA_NFORCE3_250_LAN      0x00E6
   44 #define PCI_PRODUCT_NVIDIA_NFORCE3_LAN4         0x00DF
   45 #define PCI_PRODUCT_NVIDIA_NFORCE4_LAN1         0x0056
   46 #define PCI_PRODUCT_NVIDIA_NFORCE4_LAN2         0x0057
   47 #define PCI_PRODUCT_NVIDIA_MCP04_LAN1           0x0037
   48 #define PCI_PRODUCT_NVIDIA_MCP04_LAN2           0x0038
   49 #define PCI_PRODUCT_NVIDIA_NFORCE430_LAN1       0x0268
   50 #define PCI_PRODUCT_NVIDIA_NFORCE430_LAN2       0x0269
   51 #define PCI_PRODUCT_NVIDIA_MCP55_LAN1           0x0372
   52 #define PCI_PRODUCT_NVIDIA_MCP55_LAN2           0x0373
   53 #define PCI_PRODUCT_NVIDIA_MCP61_LAN1           0x03e5
   54 #define PCI_PRODUCT_NVIDIA_MCP61_LAN2           0x03e6
   55 #define PCI_PRODUCT_NVIDIA_MCP61_LAN3           0x03ee
   56 #define PCI_PRODUCT_NVIDIA_MCP61_LAN4           0x03ef
   57 #define PCI_PRODUCT_NVIDIA_MCP65_LAN1           0x0450
   58 #define PCI_PRODUCT_NVIDIA_MCP65_LAN2           0x0451
   59 #define PCI_PRODUCT_NVIDIA_MCP65_LAN3           0x0452
   60 #define PCI_PRODUCT_NVIDIA_MCP65_LAN4           0x0453
   61 
   62 #define PCI_PRODUCT_NVIDIA_NFORCE3_LAN2 PCI_PRODUCT_NVIDIA_NFORCE2_400_LAN1
   63 #define PCI_PRODUCT_NVIDIA_NFORCE3_LAN3 PCI_PRODUCT_NVIDIA_NFORCE2_400_LAN2
   64 #define PCI_PRODUCT_NVIDIA_NFORCE3_LAN5 PCI_PRODUCT_NVIDIA_NFORCE3_250_LAN
   65 #define PCI_PRODUCT_NVIDIA_CK804_LAN1   PCI_PRODUCT_NVIDIA_NFORCE4_LAN1
   66 #define PCI_PRODUCT_NVIDIA_CK804_LAN2   PCI_PRODUCT_NVIDIA_NFORCE4_LAN2
   67 #define PCI_PRODUCT_NVIDIA_MCP51_LAN1   PCI_PRODUCT_NVIDIA_NFORCE430_LAN1
   68 #define PCI_PRODUCT_NVIDIA_MCP51_LAN2   PCI_PRODUCT_NVIDIA_NFORCE430_LAN2
   69 
   70 #define NV_RID          0x10
   71 
   72 #define TX_RING_SIZE    64
   73 #define RX_RING_SIZE    64
   74 #define NV_MAX_FRAGS    32      // match adapter.h:ADAPTER_WRITE_DATA.sElement[]
   75 
   76 #define FCS_LEN 4
   77 
   78 #define NVE_DEBUG               0x0000
   79 #define NVE_DEBUG_INIT          0x0001
   80 #define NVE_DEBUG_RUNNING       0x0002
   81 #define NVE_DEBUG_DEINIT        0x0004
   82 #define NVE_DEBUG_IOCTL         0x0008
   83 #define NVE_DEBUG_INTERRUPT     0x0010
   84 #define NVE_DEBUG_API           0x0020
   85 #define NVE_DEBUG_LOCK          0x0040
   86 #define NVE_DEBUG_BROKEN        0x0080
   87 #define NVE_DEBUG_MII           0x0100
   88 #define NVE_DEBUG_ALL           0xFFFF
   89 
   90 #if NVE_DEBUG
   91 #define DEBUGOUT(level, fmt, args...) if (NVE_DEBUG & level) \
   92     printf(fmt, ## args)
   93 #else
   94 #define DEBUGOUT(level, fmt, args...)
   95 #endif
   96 
   97 typedef unsigned long   ulong;
   98 
   99 struct nve_map_buffer {
  100         struct mbuf *mbuf;      /* mbuf receiving packet */
  101         bus_dmamap_t map;       /* DMA map */   
  102 };
  103 
  104 struct nve_dma_info {
  105         bus_dma_tag_t tag;
  106         struct nve_map_buffer buf;
  107         u_int16_t buflength;
  108         caddr_t vaddr;          /* Virtual memory address */
  109         bus_addr_t paddr;       /* DMA physical address */
  110 };
  111 
  112 struct nve_rx_desc {
  113         struct nve_rx_desc *next;
  114         struct nve_map_buffer buf;
  115         u_int16_t buflength;
  116         caddr_t vaddr;
  117         bus_addr_t paddr;
  118 };
  119 
  120 struct nve_tx_desc {
  121         /* Don't add anything above this structure */
  122         TX_INFO_ADAP TxInfoAdap;
  123         struct nve_tx_desc *next;
  124         struct nve_map_buffer buf;
  125         u_int16_t buflength;
  126         u_int32_t numfrags;
  127         bus_dma_segment_t frags[NV_MAX_FRAGS];
  128 };
  129 
  130 struct nve_softc {
  131         struct ifnet *ifp;      /* interface info */
  132         struct resource *res;
  133         struct resource *irq;
  134 
  135         ADAPTER_API *hwapi;
  136         OS_API osapi;
  137                 
  138         device_t miibus;
  139         device_t dev;
  140         struct callout stat_callout;
  141 
  142         void *sc_ih;
  143         bus_space_tag_t sc_st;
  144         bus_space_handle_t sc_sh;
  145         bus_dma_tag_t mtag;
  146         bus_dma_tag_t rtag;
  147         bus_dmamap_t rmap;
  148         bus_dma_tag_t ttag;
  149         bus_dmamap_t tmap;
  150 
  151         struct nve_rx_desc *rx_desc;
  152         struct nve_tx_desc *tx_desc;
  153         bus_addr_t rx_addr;
  154         bus_addr_t tx_addr;
  155         u_int16_t rx_ring_full;
  156         u_int16_t tx_ring_full;
  157         u_int32_t cur_rx;
  158         u_int32_t cur_tx;
  159         u_int32_t pending_rxs;
  160         u_int32_t pending_txs;
  161 
  162         struct mtx mtx;
  163 
  164         /* Stuff for dealing with the NVIDIA OS API */
  165         struct callout ostimer;
  166         PTIMER_FUNC ostimer_func;
  167         void *ostimer_params;
  168         int linkup;
  169         ulong tx_errors;
  170         NV_UINT32 hwmode;
  171         NV_UINT32 max_frame_size;
  172         NV_UINT32 phyaddr;
  173         NV_UINT32 media;
  174         CMNDATA_OS_ADAPTER adapterdata;
  175         unsigned char original_mac_addr[6];
  176 };
  177 
  178 struct nve_type {
  179         u_int16_t       vid_id;
  180         u_int16_t       dev_id;
  181         char            *name;
  182 };
  183 
  184 #define NVE_LOCK(_sc)           mtx_lock(&(_sc)->mtx)
  185 #define NVE_UNLOCK(_sc)         mtx_unlock(&(_sc)->mtx)
  186 #define NVE_LOCK_ASSERT(_sc)    mtx_assert(&(_sc)->mtx, MA_OWNED)
  187 
  188 #define IF_Kbps(x) ((x) * 1000)                 /* kilobits/sec. */
  189 #define IF_Mbps(x) (IF_Kbps((x) * 1000))        /* megabits/sec. */
  190 #define ETHER_ALIGN 2
  191 
  192 extern int ADAPTER_ReadPhy (PVOID pContext, ULONG ulPhyAddr, ULONG ulReg, ULONG *pulVal);
  193 extern int ADAPTER_WritePhy (PVOID pContext, ULONG ulPhyAddr, ULONG ulReg, ULONG ulVal);
  194 extern int ADAPTER_Init (PVOID pContext, USHORT usForcedSpeed, UCHAR ucForceDpx, UCHAR ucForceMode, UINT *puiLinkState);
  195 
  196 #endif  /* _IF_NVEREG_H_ */

Cache object: 97424770464915dfea1c660d4d1f4247


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.