rtl8139: use new libnetdriver

Change-Id: Iba941653b7c052375694bcec2561957c1979feb0
This commit is contained in:
David van Moolenbroek 2014-12-02 14:07:16 +00:00
parent bcc1b08c61
commit 4081bff625
4 changed files with 228 additions and 1049 deletions

View file

@ -1,13 +1,13 @@
# Makefile for the Realtek RTL8139 ethernet driver (RTL8139) # Makefile for the Realtek RTL8139 ethernet driver (RTL8139)
PROG= rtl8139 PROG= rtl8139
SRCS= rtl8139.c liveupdate.c SRCS= rtl8139.c
FILES=$(PROG).conf FILES=$(PROG).conf
FILESNAME=$(PROG) FILESNAME=$(PROG)
FILESDIR= /etc/system.conf.d FILESDIR= /etc/system.conf.d
DPADD+= ${LIBNETDRIVER} ${LIBSYS} ${LIBTIMERS} DPADD+= ${LIBNETDRIVER} ${LIBSYS}
LDADD+= -lnetdriver -lsys -ltimers LDADD+= -lnetdriver -lsys
CPPFLAGS+= -I${NETBSDSRCDIR}/minix CPPFLAGS+= -I${NETBSDSRCDIR}/minix

View file

@ -1,3 +1,5 @@
/* Code left here for historical purposes only. TODO: move into libnetdriver */
#include "rtl8139.h" #include "rtl8139.h"
/* State management variables. */ /* State management variables. */

File diff suppressed because it is too large Load diff

View file

@ -6,32 +6,9 @@ Created: Aug 2003 by Philip Homburg <philip@cs.vu.nl>
#include <minix/drivers.h> #include <minix/drivers.h>
#include <minix/netdriver.h> #include <minix/netdriver.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <minix/com.h>
#include <minix/ds.h>
#include <minix/keymap.h>
#include <minix/syslib.h>
#include <minix/type.h>
#include <minix/sysutil.h>
#include <minix/endpoint.h>
#include <minix/timers.h>
#include <net/hton.h>
#include <net/gen/ether.h>
#include <net/gen/eth_io.h>
#include <machine/pci.h> #include <machine/pci.h>
#include <minix/ds.h>
#include <sys/types.h>
#include <fcntl.h>
#include <assert.h> #include <assert.h>
#include <unistd.h>
#include <sys/ioc_memory.h>
#include "kernel/const.h"
#include "kernel/config.h"
#include "kernel/type.h"
#define RL_IDR 0x00 /* Ethernet address #define RL_IDR 0x00 /* Ethernet address
* Note: RL_9346CR_EEM_CONFIG mode is * Note: RL_9346CR_EEM_CONFIG mode is
@ -453,18 +430,12 @@ d8 R/W Config5 Configuration register 5
d9-ff reserved d9-ff reserved
#endif #endif
#define Proc_number(p) proc_number(p)
#define debug 0
#define printW() ((void)0)
#define vm_1phys2bus(p) (p) #define vm_1phys2bus(p) (p)
#define RX_BUFSIZE RL_RCR_RBLEN_64K_SIZE #define RX_BUFSIZE RL_RCR_RBLEN_64K_SIZE
#define RX_BUFBITS RL_RCR_RBLEN_64K #define RX_BUFBITS RL_RCR_RBLEN_64K
#define N_TX_BUF RL_N_TX #define N_TX_BUF RL_N_TX
/* I/O vectors are handled IOVEC_NR entries at a time. */
#define IOVEC_NR 16
/* Configuration */ /* Configuration */
#define RL_ENVVAR "RTLETH" #define RL_ENVVAR "RTLETH"
@ -473,8 +444,6 @@ typedef struct re
port_t re_base_port; port_t re_base_port;
int re_irq; int re_irq;
int re_mode; int re_mode;
int re_flags;
int re_client;
int re_link_up; int re_link_up;
int re_got_int; int re_got_int;
int re_send_int; int re_send_int;
@ -482,12 +451,12 @@ typedef struct re
int re_clear_rx; int re_clear_rx;
int re_need_reset; int re_need_reset;
int re_tx_alive; int re_tx_alive;
char *re_model; int re_tx_busy;
const char *re_model;
/* Rx */ /* Rx */
phys_bytes re_rx_buf; phys_bytes re_rx_buf;
char *v_re_rx_buf; char *v_re_rx_buf;
vir_bytes re_read_s;
/* Tx */ /* Tx */
int re_tx_head; int re_tx_head;
@ -500,33 +469,10 @@ typedef struct re
} re_tx[N_TX_BUF]; } re_tx[N_TX_BUF];
u32_t re_ertxth; /* Early Tx Threshold */ u32_t re_ertxth; /* Early Tx Threshold */
/* PCI related */
int re_seen; /* TRUE iff device available */
/* 'large' items */
int re_hook_id; /* IRQ hook id at kernel */ int re_hook_id; /* IRQ hook id at kernel */
eth_stat_t re_stat; eth_stat_t re_stat;
ether_addr_t re_address;
message re_rx_mess;
message re_tx_mess;
char re_name[sizeof("rtl8139#n")]; char re_name[sizeof("rtl8139#n")];
iovec_t re_iovec[IOVEC_NR]; } re_t;
iovec_s_t re_iovec_s[IOVEC_NR];
}
re_t;
#define REM_DISABLED 0x0
#define REM_ENABLED 0x1
#define REF_PACK_SENT 0x001
#define REF_PACK_RECV 0x002
#define REF_SEND_AVAIL 0x004
#define REF_READING 0x010
#define REF_EMPTY 0x000
#define REF_PROMISC 0x040
#define REF_MULTI 0x080
#define REF_BROAD 0x100
#define REF_ENABLED 0x200
/* /*
* $PchId: rtl8139.h,v 1.1 2003/09/05 10:58:50 philip Exp $ * $PchId: rtl8139.h,v 1.1 2003/09/05 10:58:50 philip Exp $