How to use nForce3 internal NIC on FreeBSD 5-CURRENT-AMD64
Masahiko KIMOTO
kimoto at ohnolab.org
Mon May 3 05:26:21 PDT 2004
Hello, all,
Now, I can use nForce3 Ethernet on FreeBSD 5-CURRENT-AMD64.
ABSTRACT:
- ports/net/nvnet is kernel module to use nForce Ethernet Controller.
- Driver for Linux-AMD64 is officially available.
- FreeBSD-AMD64 doesn't support kernel module currently.
- Thus, possibly I can use the driver for AMD64 with static linking.
PREPARATION:
Obtain two files:
nvnet-src-20040108.tar.gz
http://www.onthenet.com.au/~q/nvnet/nvnet-src-20040108.tar.gz
and
Official nForce Drivers for Linux AMD64(1.0.0269)
http://download.nvidia.com/XFree86/nforce/1.0-0269/NVIDIA_nforce-1.0-0269.tar.gz
Then, extract them in your temporary directory.
DRIVER INSTALLATION:
Make dir /usr/src/sys/dev/nvnet and collect the following files into the
directory.
(nvnet-src-20040108.tar.gz):
nvnet/src/{if_nv.c, if_nvreg.h}
(NVIDIA_nforce-1.0-0269.tar.gz):
nforce/nvnet/{basetype.h, os.h, adapter.h, nvnetlib.o, phy.h}
And, touch /usr/src/sys/dev/nvnet/nvnetlib.c.
At this point, you can see eight files under /usr/src/sys/dev/nvnet.
# cd /usr/src/sys/dev/nvnet/
# ls
adapter.h if_nv.c nvnetlib.c os.h
basetype.h if_nvreg.h nvnetlib.o phy.h
Apply the patch(nvnet-amd64-patch.diff attached to this mail) in the directory.
# patch -p1 < nvnet-amd64-patch.diff
Append the following lines to /usr/src/sys/conf/files.amd64.
dev/nvnet/if_nv.c optional nv pci
dev/nvnet/nvnetlib.c optional nv pci
COMPILING KERNEL:
Append a line to your kernel CONFIGFILE.
device nv
Then, execute 'config CONFIGFILE', move into compilation directory, copy
/usr/src/sys/dev/nvnet/nvnetlib.o into the directory (make sure that
nvnetlib.o is newer than /usr/src/sys/dev/nvnet/nvnetlib.c).
And make depend and make. You can build new kernel with nvnet driver.
dmesg is like this.
---------------------------------------------------------------------------
Copyright (c) 1992-2004 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD 5.2-CURRENT #15: Mon May 3 20:28:10 JST 2004
root at XXXXX:/usr/src/sys/amd64/compile/EIRENE
Preloaded elf kernel "/boot/kernel/kernel" at 0xffffffff80788000.
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: AMD Athlon(tm) 64 Processor 3200+ (1994.86-MHz K8-class CPU)
Origin = "AuthenticAMD" Id = 0xf48 Stepping = 8
Features=0x78bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2>
AMD Features=0xe0500800<SYSCALL,NX,MMX+,LM,3DNow!+,3DNow!>
real memory = 536805376 (511 MB)
avail memory = 508452864 (484 MB)
(snip)
nv0: <NVIDIA nForce MCP3 Networking Adapter> port 0xb400-0xb407 mem 0xe8000000-0xe8000fff irq 10 at device 5.0 on pci0
nv0: Reserved 0x1000 bytes for rid 0x10 type 3 at 0xe8000000
nv0: Ethernet address 00:30:1b:b3:b8:1d
miibus1: <MII bus> on nv0
rlphy0: <RTL8201L 10/100 media interface> on miibus1
rlphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
nv0: Ethernet address: 00:30:1b:b3:b8:1d
nv0: [GIANT-LOCKED]
---------------------------------------------------------------------------
Enjoy!
-----------------------------------------------------------------------------
Masahiko KIMOTO, Ph.D. <kimoto at ohnolab.org> - http://www.ohnolab.org/~kimoto
SOUM Corporation.
WIDE Project.
-------------- next part --------------
diff -u -r nvnet.orig/basetype.h nvnet/basetype.h
--- nvnet.orig/basetype.h Sat Nov 15 07:26:33 2003
+++ nvnet/basetype.h Mon May 3 16:54:18 2004
@@ -19,11 +19,11 @@
typedef unsigned char UCHAR;
typedef unsigned int UINT;
typedef unsigned short USHORT;
-#ifndef linux
+/*#ifndef linux
typedef unsigned long ULONG;
-#else
+#else*/
typedef unsigned int ULONG;
-#endif
+/*#endif*/
#define VOID void
diff -u -r nvnet.orig/if_nv.c nvnet/if_nv.c
--- nvnet.orig/if_nv.c Thu Jan 8 18:32:04 2004
+++ nvnet/if_nv.c Mon May 3 20:07:37 2004
@@ -114,7 +114,7 @@
MODULE_DEPEND(nv, ether, 1, 1, 1);
MODULE_DEPEND(nv, miibus, 1, 1, 1);
-#include "if_nvreg.h"
+#include <dev/nvnet/if_nvreg.h>
#include "miibus_if.h"
static int nv_probe(device_t);
@@ -147,20 +147,20 @@
static int nv_osallocex(void *, MEMORY_BLOCKEX *);
static int nv_osfreeex(void *, MEMORY_BLOCKEX *);
static int nv_osclear(void *, void *, int);
-static int nv_osdelay(void *, unsigned long);
+static int nv_osdelay(void *, ULONG);
static int nv_osallocrxbuf(void *, MEMORY_BLOCK *, void **);
static int nv_osfreerxbuf(void *, MEMORY_BLOCK *, void *);
-static int nv_ospackettx(void *, void *, unsigned long);
-static int nv_ospacketrx(void *, void *, unsigned long, unsigned char *, unsigned char);
+static int nv_ospackettx(void *, void *, ULONG);
+static int nv_ospacketrx(void *, void *, ULONG, unsigned char *, unsigned char);
static int nv_oslinkchg(void *, int);
static int nv_osalloctimer(void *, void **);
static int nv_osfreetimer(void *, void *);
static int nv_osinittimer(void *, void *, PTIMER_FUNC, void *);
-static int nv_ossettimer(void *, void *, unsigned long);
+static int nv_ossettimer(void *, void *, ULONG);
static int nv_oscanceltimer(void *, void *);
static int nv_ospreprocpkt(void *, void *, void **, unsigned char *, unsigned char);
static void *nv_ospreprocpktnopq(void *, void *);
-static int nv_osindicatepkt(void *, void **, unsigned long);
+static int nv_osindicatepkt(void *, void **, ULONG);
static int nv_oslockalloc(void *, int, void **);
static int nv_oslockacquire(void *, int, void *);
static int nv_oslockrelease(void *, int, void *);
@@ -1180,7 +1180,7 @@
nv_miibus_readreg(device_t dev, int phy, int reg)
{
struct nv_softc *sc = device_get_softc(dev);
- ulong data;
+ ULONG data;
DEBUGOUT(NV_DEBUG_MII, "nv: nv_miibus_readreg - entry\n");
@@ -1250,9 +1250,9 @@
mem_physical = vtophys(mem->pLogical);
mem->pPhysical = (PVOID)mem_physical;
- DEBUGOUT(NV_DEBUG_API, "nv: nv_osalloc 0x%x/0x%x - %d\n",
- (u_int32_t) mem->pLogical,
- (u_int32_t) mem->pPhysical, mem->uiLength);
+ /* DEBUGOUT(NV_DEBUG_API, "nv: nv_osalloc 0x%x/0x%x - %d\n",
+ mem->pLogical,
+ mem->pPhysical, mem->uiLength);*/
return (1);
}
@@ -1261,8 +1261,8 @@
static int
nv_osfree(void *ctx, MEMORY_BLOCK *mem)
{
- DEBUGOUT(NV_DEBUG_API, "nv: nv_osfree - 0x%x - %d\n",
- (u_int32_t) mem->pLogical, mem->uiLength);
+ /* DEBUGOUT(NV_DEBUG_API, "nv: nv_osfree - 0x%x - %d\n",
+ (u_int32_t) mem->pLogical, mem->uiLength);*/
contigfree(mem->pLogical, PAGE_SIZE, M_DEVBUF);
return (1);
@@ -1291,7 +1291,7 @@
return (0);
}
mem_block_ex->pLogicalOrig = mem_block.pLogical;
- mem_block_ex->pPhysicalOrigLow = (ULONG)mem_block.pPhysical;
+ mem_block_ex->pPhysicalOrigLow = (unsigned long)mem_block.pPhysical;
mem_block_ex->pPhysicalOrigHigh = 0;
mem_block_ex->pPhysical = mem_block.pPhysical;
@@ -1302,9 +1302,9 @@
offset = mem_block_ex->pPhysicalOrigLow & (mem_block_ex->AlignmentSize - 1);
if (offset) {
- mem_block_ex->pPhysical = (PVOID)((ULONG)mem_block_ex->pPhysical +
+ mem_block_ex->pPhysical = (PVOID)((unsigned long)mem_block_ex->pPhysical +
mem_block_ex->AlignmentSize - offset);
- mem_block_ex->pLogical = (PVOID)((ULONG)mem_block_ex->pLogical +
+ mem_block_ex->pLogical = (PVOID)((unsigned long)mem_block_ex->pLogical +
mem_block_ex->AlignmentSize - offset);
} /* if (offset) */
} /* if (mem_block_ex->uiLength !=
@@ -1321,7 +1321,7 @@
DEBUGOUT(NV_DEBUG_API, "nv: nv_osfreeex\n");
mem_block.pLogical = mem_block_ex->pLogicalOrig;
- mem_block.pPhysical = (PVOID)mem_block_ex->pPhysicalOrigLow;
+ mem_block.pPhysical = (PVOID)((unsigned long)mem_block_ex->pPhysicalOrigLow);
mem_block.uiLength = mem_block_ex->uiLengthOrig;
return (nv_osfree(ctx, &mem_block));
@@ -1338,7 +1338,7 @@
/* Sleep for a tick */
static int
-nv_osdelay(void *ctx, unsigned long usec)
+nv_osdelay(void *ctx, ULONG usec)
{
DELAY(usec);
return (1);
@@ -1432,7 +1432,7 @@
/* This gets called by the Nvidia API after our TX packet has been sent */
static int
-nv_ospackettx(void *ctx, void *id, unsigned long success)
+nv_ospackettx(void *ctx, void *id, ULONG success)
{
struct nv_softc *sc = ctx;
struct nv_map_buffer *buf;
@@ -1469,7 +1469,7 @@
/* This gets called by the Nvidia API when a new packet has been received */
/* XXX What is newbuf used for? XXX */
static int
-nv_ospacketrx(void *ctx, void *data, unsigned long success,
+nv_ospacketrx(void *ctx, void *data, ULONG success,
unsigned char *newbuf, unsigned char priority)
{
struct nv_softc *sc = ctx;
@@ -1591,7 +1591,7 @@
/* Set the timer to go off */
static int
-nv_ossettimer(void *ctx, void *timer, unsigned long delay)
+nv_ossettimer(void *ctx, void *timer, ULONG delay)
{
struct nv_softc *sc = ctx;
@@ -1636,7 +1636,7 @@
}
static int
-nv_osindicatepkt(void *ctx, void **id, unsigned long pktno)
+nv_osindicatepkt(void *ctx, void **id, ULONG pktno)
{
/* Not implemented */
DEBUGOUT(NV_DEBUG_BROKEN, "nv: nv_osindicatepkt\n");
diff -u -r nvnet.orig/if_nvreg.h nvnet/if_nvreg.h
--- nvnet.orig/if_nvreg.h Sat Nov 8 22:03:01 2003
+++ nvnet/if_nvreg.h Mon May 3 20:07:46 2004
@@ -29,9 +29,9 @@
#ifndef _IF_NVREG_H_
#define _IF_NVREG_H_
-#include "basetype.h"
-#include "os.h"
-#include "adapter.h"
+#include <dev/nvnet/basetype.h>
+#include <dev/nvnet/os.h>
+#include <dev/nvnet/adapter.h>
#ifndef NVIDIA_VENDORID
#define NVIDIA_VENDORID 0x10DE
@@ -149,7 +149,7 @@
void *ostimer_params;
unsigned int linkup;
ulong tx_errors;
- ulong phyaddr;
+ ULONG phyaddr;
unsigned char original_mac_addr[6];
};
Only in nvnet: nvnetlib.c
diff -u -r nvnet.orig/os.h nvnet/os.h
--- nvnet.orig/os.h Sat Nov 15 07:26:33 2003
+++ nvnet/os.h Mon May 3 20:12:31 2004
@@ -9,7 +9,7 @@
#ifndef _OS_H_
#define _OS_H_
-#include "phy.h"
+#include <dev/nvnet/phy.h>
#define HDO_VERSION_STRING "HDR O: $Revision: 1.1 $";
More information about the freebsd-amd64
mailing list