dp8390: use new libnetdriver

Change-Id: Ieaf6d605832d475f95fd9b06026b349dce7ee025
This commit is contained in:
David van Moolenbroek 2014-12-02 14:02:02 +00:00
parent 29018b4ecd
commit 3913e49004
8 changed files with 185 additions and 1094 deletions

View file

@ -12,6 +12,7 @@
*/ */
#include <minix/drivers.h> #include <minix/drivers.h>
#include <minix/netdriver.h>
#include <net/gen/ether.h> #include <net/gen/ether.h>
#include <net/gen/eth_io.h> #include <net/gen/eth_io.h>

View file

@ -2,7 +2,7 @@
PROG= dp8390 PROG= dp8390
SRCS= 3c503.c dp8390.c ne2000.c rtl8029.c wdeth.c SRCS= 3c503.c dp8390.c ne2000.c rtl8029.c wdeth.c
DPADD+= ${LIBNETDRIVER} ${LIBSYS} ${LIBTIMERS} DPADD+= ${LIBNETDRIVER} ${LIBSYS}
LDADD+= -lnetdriver -lsys -ltimers LDADD+= -lnetdriver -lsys
.include <minix.service.mk> .include <minix.service.mk>

File diff suppressed because it is too large Load diff

View file

@ -173,45 +173,19 @@ typedef struct dp_rcvhdr
struct dpeth; struct dpeth;
struct iovec_dat; struct iovec_dat;
struct iovec_dat_s; struct iovec_dat_s;
typedef void(*dp_initf_t) (struct dpeth *dep); typedef void (*dp_initf_t)(struct dpeth *dep);
typedef void(*dp_stopf_t) (struct dpeth *dep); typedef void (*dp_stopf_t)(struct dpeth *dep);
typedef void(*dp_user2nicf_t) (struct dpeth *dep, struct iovec_dat typedef void (*dp_user2nicf_s_t)(struct dpeth *dep,
*iovp, vir_bytes offset, int nic_addr, vir_bytes count); struct netdriver_data *data, int nic_addr, size_t offset,
typedef void(*dp_user2nicf_s_t) (struct dpeth *dep, struct iovec_dat_s size_t count);
*iovp, vir_bytes offset, int nic_addr, vir_bytes count); typedef void (*dp_nic2userf_s_t)(struct dpeth *dep,
typedef void(*dp_nic2userf_t) (struct dpeth *dep, int nic_addr, struct struct netdriver_data *data, int nic_addr, size_t offset,
iovec_dat *iovp, vir_bytes offset, vir_bytes count); size_t count);
typedef void(*dp_nic2userf_s_t) (struct dpeth *dep, int nic_addr, struct typedef void (*dp_getblock_t)(struct dpeth *dep, int page, size_t
iovec_dat_s *iovp, vir_bytes offset, vir_bytes count);
#if 0
typedef void(*dp_getheaderf_t) (struct dpeth *dep, int page, struct
dp_rcvhdr *h, u16_t *eth_type);
#endif
typedef void(*dp_getblock_t) (struct dpeth *dep, int page, size_t
offset, size_t size, void *dst); offset, size_t size, void *dst);
/* iovectors are handled IOVEC_NR entries at a time. */
#define IOVEC_NR 16
typedef int irq_hook_t; typedef int irq_hook_t;
typedef struct iovec_dat
{
iovec_t iod_iovec[IOVEC_NR];
int iod_iovec_s;
endpoint_t iod_proc_nr;
vir_bytes iod_iovec_addr;
} iovec_dat_t;
typedef struct iovec_dat_s
{
iovec_s_t iod_iovec[IOVEC_NR];
int iod_iovec_s;
int iod_proc_nr;
cp_grant_id_t iod_grant;
vir_bytes iod_iovec_offset;
} iovec_dat_s_t;
#define SENDQ_NR 2 /* Maximum size of the send queue */ #define SENDQ_NR 2 /* Maximum size of the send queue */
#define SENDQ_PAGES 6 /* 6 * DP_PAGESIZE >= 1514 bytes */ #define SENDQ_PAGES 6 /* 6 * DP_PAGESIZE >= 1514 bytes */
@ -250,10 +224,8 @@ typedef struct dpeth
int de_startpage; int de_startpage;
int de_stoppage; int de_stoppage;
#if ENABLE_PCI
/* PCI config */ /* PCI config */
char de_pci; /* TRUE iff PCI device */ char de_pci; /* TRUE iff PCI device */
#endif
/* Do it yourself send queue */ /* Do it yourself send queue */
struct sendq struct sendq
@ -268,14 +240,7 @@ typedef struct dpeth
/* Fields for internal use by the dp8390 driver. */ /* Fields for internal use by the dp8390 driver. */
int de_flags; int de_flags;
int de_mode;
eth_stat_t de_stat; eth_stat_t de_stat;
iovec_dat_s_t de_read_iovec_s;
iovec_dat_s_t de_write_iovec_s;
iovec_dat_s_t de_tmp_iovec_s;
vir_bytes de_read_s;
endpoint_t de_client;
message de_sendmsg;
dp_user2nicf_s_t de_user2nicf_s; dp_user2nicf_s_t de_user2nicf_s;
dp_nic2userf_s_t de_nic2userf_s; dp_nic2userf_s_t de_nic2userf_s;
dp_getblock_t de_getblockf; dp_getblock_t de_getblockf;
@ -283,24 +248,10 @@ typedef struct dpeth
#define DEI_DEFAULT 0x8000 #define DEI_DEFAULT 0x8000
#define DEF_EMPTY 0x000 #define DEF_EMPTY 0x00
#define DEF_PACK_SEND 0x001 #define DEF_STOPPED 0x01
#define DEF_PACK_RECV 0x002
#define DEF_SEND_AVAIL 0x004
#define DEF_READING 0x010
#define DEF_PROMISC 0x040
#define DEF_MULTI 0x080
#define DEF_BROAD 0x100
#define DEF_ENABLED 0x200
#define DEF_STOPPED 0x400
#define DEM_DISABLED 0x0 #define debug 0
#define DEM_SINK 0x1
#define DEM_ENABLED 0x2
#if !__minix_vmd
#define debug 0 /* Standard Minix lacks debug variable */
#endif
/* /*
* $PchId: dp8390.h,v 1.10 2005/02/10 17:26:06 philip Exp $ * $PchId: dp8390.h,v 1.10 2005/02/10 17:26:06 philip Exp $

View file

@ -5,7 +5,6 @@ local.h
#define ENABLE_WDETH 1 #define ENABLE_WDETH 1
#define ENABLE_NE2000 1 #define ENABLE_NE2000 1
#define ENABLE_3C503 1 #define ENABLE_3C503 1
#define ENABLE_PCI 1
struct dpeth; struct dpeth;

View file

@ -8,12 +8,10 @@ Created: March 15, 1994 by Philip Homburg <philip@f-mnx.phicoh.com>
*/ */
#include <minix/drivers.h> #include <minix/drivers.h>
#include <minix/netdriver.h>
#include <net/gen/ether.h> #include <net/gen/ether.h>
#include <net/gen/eth_io.h> #include <net/gen/eth_io.h>
#if __minix_vmd
#include "config.h"
#endif
#include "local.h" #include "local.h"
#include "dp8390.h" #include "dp8390.h"

View file

@ -7,6 +7,7 @@ Created: April 2000 by Philip Homburg <philip@f-mnx.phicoh.com>
*/ */
#include <minix/drivers.h> #include <minix/drivers.h>
#include <minix/netdriver.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
@ -20,8 +21,6 @@ Created: April 2000 by Philip Homburg <philip@f-mnx.phicoh.com>
#include "dp8390.h" #include "dp8390.h"
#include "rtl8029.h" #include "rtl8029.h"
#if ENABLE_PCI
static void rtl_init(struct dpeth *dep); static void rtl_init(struct dpeth *dep);
#if 0 #if 0
static u16_t get_ee_word(dpeth_t *dep, int a); static u16_t get_ee_word(dpeth_t *dep, int a);
@ -312,8 +311,6 @@ dpeth_t *dep;
} }
#endif #endif
#endif /* ENABLE_PCI */
/* /*
* $PchId: rtl8029.c,v 1.7 2004/08/03 12:16:58 philip Exp $ * $PchId: rtl8029.c,v 1.7 2004/08/03 12:16:58 philip Exp $
*/ */

View file

@ -5,6 +5,7 @@ Created: March 14, 1994 by Philip Homburg
*/ */
#include <minix/drivers.h> #include <minix/drivers.h>
#include <minix/netdriver.h>
#include <net/gen/ether.h> #include <net/gen/ether.h>
#include <net/gen/eth_io.h> #include <net/gen/eth_io.h>
@ -70,9 +71,6 @@ dpeth_t *dep;
int we_type; int we_type;
int sendq_nr; int sendq_nr;
assert(dep->de_mode == DEM_ENABLED);
assert(!(dep->de_flags & DEF_ENABLED));
dep->de_address.ea_addr[0] = inb_we(dep, EPL_EA0); dep->de_address.ea_addr[0] = inb_we(dep, EPL_EA0);
dep->de_address.ea_addr[1] = inb_we(dep, EPL_EA1); dep->de_address.ea_addr[1] = inb_we(dep, EPL_EA1);
dep->de_address.ea_addr[2] = inb_we(dep, EPL_EA2); dep->de_address.ea_addr[2] = inb_we(dep, EPL_EA2);