FreeBSD consumer bits of the nForce MCP NIC binary blob.

Demanded by:	DES
Encouraged by:	scottl
Obtained from:	q@onthenet.com.au (partially)
KNF'ed by:	obrien
This commit is contained in:
David E. O'Brien 2005-03-12 00:29:30 +00:00
parent 0587a1ea34
commit 1b1a07ad8b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=143442
8 changed files with 1917 additions and 0 deletions

View File

@ -176,6 +176,7 @@ device ppi # Parallel port interface device
device de # DEC/Intel DC21x4x (``Tulip'')
device em # Intel PRO/1000 adapter Gigabit Ethernet Card
device ixgb # Intel PRO/10GbE Ethernet Card
device nve # nVidia nForce MCP on-board Ethernet Networking
device txp # 3Com 3cR990 (``Typhoon'')
device vx # 3Com 3c590, 3c595 (``Vortex'')

View File

@ -57,6 +57,16 @@ opt_ah.h optional ath_hal \
no-obj no-implicit-rule before-depend \
clean "opt_ah.h"
#
nvenetlib.o optional nve pci \
dependency "$S/contrib/dev/nve/amd64/nvenetlib.o.bz2.uu" \
compile-with "uudecode $S/contrib/dev/nve/amd64/nvenetlib.o.bz2.uu ; bzip2 -df nvenetlib.o.bz2" \
no-implicit-rule
#
os+%DIKED-nve.h optional nve pci \
dependency "$S/contrib/dev/nve/os.h" \
compile-with "sed -e 's/^.*#include.*phy\.h.*$$//' $S/contrib/dev/nve/os.h > os+%DIKED-nve.h" \
no-implicit-rule no-obj before-depend
#
amd64/acpica/OsdEnvironment.c optional acpi
amd64/acpica/acpi_machdep.c optional acpi
amd64/acpica/acpi_wakeup.c optional acpi
@ -140,6 +150,7 @@ dev/kbd/kbd.c optional atkbd
dev/kbd/kbd.c optional sc
dev/kbd/kbd.c optional ukbd
dev/mem/memutil.c optional mem
dev/nve/if_nve.c optional nve pci
dev/ppc/ppc.c optional ppc
dev/sio/sio.c optional sio
dev/sio/sio_isa.c optional sio isa

View File

@ -61,6 +61,16 @@ opt_ah.h optional ath_hal \
no-obj no-implicit-rule before-depend \
clean "opt_ah.h"
#
nvenetlib.o optional nve pci \
dependency "$S/contrib/dev/nve/i386/nvenetlib.o.bz2.uu" \
compile-with "uudecode $S/contrib/dev/nve/i386/nvenetlib.o.bz2.uu ; bzip2 -df nvenetlib.o.bz2" \
no-implicit-rule
#
os+%DIKED-nve.h optional nve pci \
dependency "$S/contrib/dev/nve/os.h" \
compile-with "sed -e 's/^.*#include.*phy\.h.*$$//' $S/contrib/dev/nve/os.h > os+%DIKED-nve.h" \
no-implicit-rule no-obj before-depend
#
hptmvraid.o optional hptmv \
dependency "$S/dev/hptmv/i386-elf.raid.o.uu" \
compile-with "uudecode < $S/dev/hptmv/i386-elf.raid.o.uu" \
@ -176,6 +186,7 @@ dev/lnc/if_lnc_isa.c optional lnc isa
dev/mem/memutil.c optional mem
dev/mse/mse.c optional mse
dev/mse/mse_isa.c optional mse isa
dev/nve/if_nve.c optional nve pci
dev/ppc/ppc.c optional ppc
dev/ppc/ppc_puc.c optional ppc puc pci
dev/random/nehemiah.c optional random

1700
sys/dev/nve/if_nve.c Normal file

File diff suppressed because it is too large Load Diff

175
sys/dev/nve/if_nvereg.h Normal file
View File

@ -0,0 +1,175 @@
/*
* Copyright (c) 2003 by Quinton Dolan <q@onthenet.com.au>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS `AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_nvreg.h,v 1.6 2004/08/12 14:00:05 q Exp $
* $FreeBSD$
*/
#ifndef _IF_NVEREG_H_
#define _IF_NVEREG_H_
#ifndef NVIDIA_VENDORID
#define NVIDIA_VENDORID 0x10DE
#endif
#define NFORCE_MCPNET1_DEVICEID 0x01C3
#define NFORCE_MCPNET2_DEVICEID 0x0066
#define NFORCE_MCPNET3_DEVICEID 0x00D6
#define NV_RID 0x10
#define TX_RING_SIZE 64
#define RX_RING_SIZE 64
#define NV_MAX_FRAGS 63
#define FCS_LEN 4
#define NVE_DEBUG 0x0000
#define NVE_DEBUG_INIT 0x0001
#define NVE_DEBUG_RUNNING 0x0002
#define NVE_DEBUG_DEINIT 0x0004
#define NVE_DEBUG_IOCTL 0x0008
#define NVE_DEBUG_INTERRUPT 0x0010
#define NVE_DEBUG_API 0x0020
#define NVE_DEBUG_LOCK 0x0040
#define NVE_DEBUG_BROKEN 0x0080
#define NVE_DEBUG_MII 0x0100
#define NVE_DEBUG_ALL 0xFFFF
#if NVE_DEBUG
#define DEBUGOUT(level, fmt, args...) if (NVE_DEBUG & level) \
printf(fmt, ## args)
#else
#define DEBUGOUT(level, fmt, args...)
#endif
typedef unsigned long ulong;
struct nve_map_buffer {
struct mbuf *mbuf; /* mbuf receiving packet */
bus_dmamap_t map; /* DMA map */
};
struct nve_dma_info {
bus_dma_tag_t tag;
struct nve_map_buffer buf;
u_int16_t buflength;
caddr_t vaddr; /* Virtual memory address */
bus_addr_t paddr; /* DMA physical address */
};
struct nve_rx_desc {
struct nve_rx_desc *next;
struct nve_map_buffer buf;
u_int16_t buflength;
caddr_t vaddr;
bus_addr_t paddr;
};
struct nve_tx_desc {
/* Don't add anything above this structure */
TX_INFO_ADAP TxInfoAdap;
struct nve_tx_desc *next;
struct nve_map_buffer buf;
u_int16_t buflength;
u_int32_t numfrags;
bus_dma_segment_t frags[NV_MAX_FRAGS + 1];
};
struct nve_softc {
struct arpcom arpcom; /* interface info */
struct resource *res;
struct resource *irq;
ADAPTER_API *hwapi;
OS_API osapi;
device_t miibus;
device_t dev;
struct callout_handle stat_ch;
u_int32_t unit;
void *sc_ih;
bus_space_tag_t sc_st;
bus_space_handle_t sc_sh;
bus_dma_tag_t mtag;
bus_dma_tag_t rtag;
bus_dmamap_t rmap;
bus_dma_tag_t ttag;
bus_dmamap_t tmap;
struct nve_rx_desc *rx_desc;
struct nve_tx_desc *tx_desc;
bus_addr_t rx_addr;
bus_addr_t tx_addr;
u_int16_t rx_ring_full;
u_int16_t tx_ring_full;
u_int32_t cur_rx;
u_int32_t cur_tx;
u_int32_t pending_rxs;
u_int32_t pending_txs;
u_int32_t flags;
u_int32_t miicfg;
struct mtx mtx;
struct mtx osmtx;
/* Stuff for dealing with the NVIDIA OS API */
struct callout_handle ostimer;
PTIMER_FUNC ostimer_func;
void *ostimer_params;
int linkup;
ulong tx_errors;
NV_UINT32 hwmode;
NV_UINT32 max_frame_size;
NV_UINT32 phyaddr;
NV_UINT32 media;
CMNDATA_OS_ADAPTER adapterdata;
unsigned char original_mac_addr[6];
};
struct nve_type {
u_int16_t vid_id;
u_int16_t dev_id;
char *name;
};
#define sc_if arpcom.ac_if
#define sc_macaddr arpcom.ac_enaddr
#define NVE_LOCK(_sc) mtx_lock(&(_sc)->mtx)
#define NVE_UNLOCK(_sc) mtx_unlock(&(_sc)->mtx)
#define NVE_OSLOCK(_sc) mtx_lock_spin(&(_sc)->osmtx)
#define NVE_OSUNLOCK(_sc) mtx_unlock_spin(&(_sc)->osmtx)
#define IF_Kbps(x) ((x) * 1000) /* kilobits/sec. */
#define IF_Mbps(x) (IF_Kbps((x) * 1000)) /* megabits/sec. */
#define ETHER_ALIGN 2
extern int ADAPTER_ReadPhy (PVOID pContext, ULONG ulPhyAddr, ULONG ulReg, ULONG *pulVal);
extern int ADAPTER_WritePhy (PVOID pContext, ULONG ulPhyAddr, ULONG ulReg, ULONG ulVal);
extern int ADAPTER_Init (PVOID pContext, USHORT usForcedSpeed, UCHAR ucForceDpx, UCHAR ucForceMode, UINT *puiLinkState);
#endif /* _IF_NVEREG_H_ */

View File

@ -195,6 +195,7 @@ device ppi # Parallel port interface device
device de # DEC/Intel DC21x4x (``Tulip'')
device em # Intel PRO/1000 adapter Gigabit Ethernet Card
device ixgb # Intel PRO/10GbE Ethernet Card
device nve # nVidia nForce MCP on-board Ethernet Networking
device txp # 3Com 3cR990 (``Typhoon'')
device vx # 3Com 3c590, 3c595 (``Vortex'')

View File

@ -154,6 +154,7 @@ SUBDIR= ${_3dfx} \
nfsclient \
nfsserver \
nge \
${_nve} \
nmdm \
${_nsp} \
ntfs \
@ -331,6 +332,7 @@ _ncp= ncp
_ncv= ncv
_ndis= ndis
_nsp= nsp
_nve= nve
_nwfs= nwfs
_oltr= oltr
_pccard= pccard
@ -416,6 +418,7 @@ _ips= ips
#_lnc= lnc
_mly= mly
_ndis= ndis
_nve= nve
_safe= safe
_scsi_low= scsi_low
_smbfs= smbfs

15
sys/modules/nve/Makefile Normal file
View File

@ -0,0 +1,15 @@
# $FreeBSD$
.PATH: ${.CURDIR}/../../dev/nve
KMOD= if_nve
SRCS= if_nve.c if_nvereg.h miidevs.h \
device_if.h bus_if.h pci_if.h miibus_if.h
OBJS+= nvenetlib.o
CLEANFILES+= nvenetlib.o
nvenetlib.o: ${.CURDIR}/../../contrib/dev/nve/${MACHINE}/${.TARGET}.bz2.uu
uudecode < ${.CURDIR}/../../contrib/dev/nve/${MACHINE}/${.TARGET}.bz2.uu
bzip2 -d ${.TARGET}.bz2
.include <bsd.kmod.mk>