Index: uspace/srv/net/netif/dp8390/Makefile
===================================================================
--- uspace/srv/net/netif/dp8390/Makefile	(revision e417b961e64a18ae1b50d3898c8108c524af1400)
+++ 	(revision )
@@ -1,68 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - 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.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-#
-
-NET_BASE = ../..
-USPACE_PREFIX = ../../../..
-ROOT_PATH = $(USPACE_PREFIX)/..
-
-COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
-CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
-
-BINARY = dp8390
-
--include $(COMMON_MAKEFILE)
--include $(CONFIG_MAKEFILE)
-
-SOURCES = \
-	dp8390.c \
-	dp8390_module.c \
-	ne2000.c \
-	$(NET_BASE)/module.c \
-	$(NET_BASE)/modules.c \
-	$(NET_BASE)/netif/netif.c \
-	$(NET_BASE)/structures/measured_strings.c \
-	$(NET_BASE)/structures/packet/packet.c \
-	$(NET_BASE)/structures/packet/packet_client.c \
-	$(NET_BASE)/structures/packet/packet_remote.c
-
-ifeq ($(CONFIG_NETWORKING),module)
-	SOURCES += \
-		$(NET_BASE)/checksum.c \
-		$(NET_BASE)/nil/eth/eth.c \
-		$(NET_BASE)/net/net_remote.c \
-		$(NET_BASE)/netif/netif_nil_bundle.c
-endif
-
-ifeq ($(CONFIG_NETWORKING),modular)
-	SOURCES += \
-		$(NET_BASE)/nil/nil_remote.c \
-		$(NET_BASE)/netif/netif_standalone.c
-endif
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/net/netif/dp8390/dp8390.c
===================================================================
--- uspace/srv/net/netif/dp8390/dp8390.c	(revision e417b961e64a18ae1b50d3898c8108c524af1400)
+++ 	(revision )
@@ -1,1674 +1,0 @@
-/*
- * Copyright (c) 1987,1997, 2006, Vrije Universiteit, Amsterdam, The Netherlands All rights reserved. Redistribution and use of the MINIX 3 operating system in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of the Vrije Universiteit nor the names of the software authors or contributors may be used to endorse or promote products derived from this software without specific prior written permission.
- * * Any deviations from these conditions require written permission from the copyright holder in advance
- *
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, 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 COPYRIGHT HOLDER OR ANY AUTHORS 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.
- *
- * Changes:
- *  2009 ported to HelenOS, Lukas Mejdrech
- */
-
-/** @addtogroup dp8390
- *  @{
- */
-
-/** @file
- *  DP8390 network interface core implementation.
- */
-
-#include <assert.h>
-#include <errno.h>
-
-#include "../../include/byteorder.h"
-
-#include "../../structures/packet/packet.h"
-#include "../../structures/packet/packet_client.h"
-
-#include "../netif.h"
-
-#include "dp8390_drv.h"
-#include "dp8390_port.h"
-
-/*
- * dp8390.c
- *
- * Created:	before Dec 28, 1992 by Philip Homburg <philip@f-mnx.phicoh.com>
- *
- * Modified Mar 10 1994 by Philip Homburg
- *	Become a generic dp8390 driver.
- *
- * Modified Dec 20 1996 by G. Falzoni <falzoni@marina.scn.de>
- *	Added support for 3c503 boards.
- */
-
-#include "local.h"
-#include "dp8390.h"
-
-/** Queues the outgoing packet.
- *  @param[in] dep The network interface structure.
- *  @param[in] packet The outgoing packet.
- *  @returns EOK on success.
- *  @returns EINVAL 
- */
-int queue_packet(dpeth_t * dep, packet_t packet);
-
-/** Reads a memory block byte by byte.
- *  @param[in] port The source address.
- *  @param[out] buf The destination buffer.
- *  @param[in] size The memory block size in bytes.
- */
-static void outsb(port_t port, void * buf, size_t size);
-
-/** Reads a memory block word by word.
- *  @param[in] port The source address.
- *  @param[out] buf The destination buffer.
- *  @param[in] size The memory block size in bytes.
- */
-static void outsw(port_t port, void * buf, size_t size);
-
-//static u16_t eth_ign_proto;
-//static char *progname;
-
-/* Configuration */
-/*typedef struct dp_conf
-{
-	port_t dpc_port;
-	int dpc_irq;
-	phys_bytes dpc_mem;
-	char *dpc_envvar;
-} dp_conf_t;
-*/
-//dp_conf_t dp_conf[]=	/* Card addresses */
-//{
-	/* I/O port, IRQ,  Buffer address,  Env. var. */
-/*	{ 0x280,     3,    0xD0000,        "DPETH0"	},
-	{ 0x300,     5,    0xC8000,        "DPETH1"	},
-	{ 0x380,    10,    0xD8000,        "DPETH2"	},
-};
-*/
-/* Test if dp_conf has exactly DE_PORT_NR entries.  If not then you will see
- * the error: "array size is negative".
- */
-//extern int ___dummy[DE_PORT_NR == sizeof(dp_conf)/sizeof(dp_conf[0]) ? 1 : -1];
-
-/* Card inits configured out? */
-#if !ENABLE_WDETH
-#define wdeth_probe(dep)	(0)
-#endif
-#if !ENABLE_NE2000
-#define ne_probe(dep)		(0)
-#endif
-#if !ENABLE_3C503
-#define el2_probe(dep)		(0)
-#endif
-
-/* Some clones of the dp8390 and the PC emulator 'Bochs' require the CR_STA
- * on writes to the CR register. Additional CR_STAs do not appear to hurt
- * genuine dp8390s
- */
-#define CR_EXTRA	CR_STA
-
-//#if ENABLE_PCI
-//_PROTOTYPE(static void pci_conf, (void)				);
-//#endif
-//_PROTOTYPE(static void do_vwrite, (message *mp, int from_int,
-//							int vectored)	);
-//_PROTOTYPE(static void do_vwrite_s, (message *mp, int from_int)	);
-//_PROTOTYPE(static void do_vread, (message *mp, int vectored)		);
-//_PROTOTYPE(static void do_vread_s, (message *mp)			);
-//_PROTOTYPE(static void do_init, (message *mp)				);
-//_PROTOTYPE(static void do_int, (dpeth_t *dep)				);
-//_PROTOTYPE(static void do_getstat, (message *mp)			);
-//_PROTOTYPE(static void do_getstat_s, (message *mp)			);
-//_PROTOTYPE(static void do_getname, (message *mp)			);
-//_PROTOTYPE(static void do_stop, (message *mp)				);
-_PROTOTYPE(static void dp_init, (dpeth_t *dep)				);
-//_PROTOTYPE(static void dp_confaddr, (dpeth_t *dep)			);
-_PROTOTYPE(static void dp_reinit, (dpeth_t *dep)			);
-_PROTOTYPE(static void dp_reset, (dpeth_t *dep)			);
-//_PROTOTYPE(static void dp_check_ints, (dpeth_t *dep)			);
-_PROTOTYPE(static void dp_recv, (dpeth_t *dep)				);
-_PROTOTYPE(static void dp_send, (dpeth_t *dep)				);
-//_PROTOTYPE(static void dp8390_stop, (void)				);
-_PROTOTYPE(static void dp_getblock, (dpeth_t *dep, int page,
-				size_t offset, size_t size, void *dst)	);
-_PROTOTYPE(static void dp_pio8_getblock, (dpeth_t *dep, int page,
-				size_t offset, size_t size, void *dst)	);
-_PROTOTYPE(static void dp_pio16_getblock, (dpeth_t *dep, int page,
-				size_t offset, size_t size, void *dst)	);
-_PROTOTYPE(static int dp_pkt2user, (dpeth_t *dep, int page,
-							int length) );
-//_PROTOTYPE(static int dp_pkt2user_s, (dpeth_t *dep, int page,
-//							int length)	);
-_PROTOTYPE(static void dp_user2nic, (dpeth_t *dep, iovec_dat_t *iovp, 
-		vir_bytes offset, int nic_addr, vir_bytes count) );
-//_PROTOTYPE(static void dp_user2nic_s, (dpeth_t *dep, iovec_dat_s_t *iovp, 
-//		vir_bytes offset, int nic_addr, vir_bytes count)	);
-_PROTOTYPE(static void dp_pio8_user2nic, (dpeth_t *dep,
-				iovec_dat_t *iovp, vir_bytes offset,
-				int nic_addr, vir_bytes count) );
-//_PROTOTYPE(static void dp_pio8_user2nic_s, (dpeth_t *dep,
-//				iovec_dat_s_t *iovp, vir_bytes offset,
-//				int nic_addr, vir_bytes count)		);
-_PROTOTYPE(static void dp_pio16_user2nic, (dpeth_t *dep,
-				iovec_dat_t *iovp, vir_bytes offset,
-				int nic_addr, vir_bytes count) );
-//_PROTOTYPE(static void dp_pio16_user2nic_s, (dpeth_t *dep,
-//				iovec_dat_s_t *iovp, vir_bytes offset,
-//				int nic_addr, vir_bytes count)		);
-_PROTOTYPE(static void dp_nic2user, (dpeth_t *dep, int nic_addr, 
-		iovec_dat_t *iovp, vir_bytes offset, vir_bytes count)	);
-//_PROTOTYPE(static void dp_nic2user_s, (dpeth_t *dep, int nic_addr, 
-//		iovec_dat_s_t *iovp, vir_bytes offset, vir_bytes count)	);
-_PROTOTYPE(static void dp_pio8_nic2user, (dpeth_t *dep, int nic_addr, 
-		iovec_dat_t *iovp, vir_bytes offset, vir_bytes count)	);
-//_PROTOTYPE(static void dp_pio8_nic2user_s, (dpeth_t *dep, int nic_addr, 
-//		iovec_dat_s_t *iovp, vir_bytes offset, vir_bytes count)	);
-_PROTOTYPE(static void dp_pio16_nic2user, (dpeth_t *dep, int nic_addr, 
-		iovec_dat_t *iovp, vir_bytes offset, vir_bytes count)	);
-//_PROTOTYPE(static void dp_pio16_nic2user_s, (dpeth_t *dep, int nic_addr, 
-//		iovec_dat_s_t *iovp, vir_bytes offset, vir_bytes count)	);
-_PROTOTYPE(static void dp_next_iovec, (iovec_dat_t *iovp)		);
-//_PROTOTYPE(static void dp_next_iovec_s, (iovec_dat_s_t *iovp)		);
-_PROTOTYPE(static void conf_hw, (dpeth_t *dep)				);
-//_PROTOTYPE(static void update_conf, (dpeth_t *dep, dp_conf_t *dcp)	);
-_PROTOTYPE(static void map_hw_buffer, (dpeth_t *dep)			);
-//_PROTOTYPE(static int calc_iovec_size, (iovec_dat_t *iovp)		);
-//_PROTOTYPE(static int calc_iovec_size_s, (iovec_dat_s_t *iovp)		);
-_PROTOTYPE(static void reply, (dpeth_t *dep, int err, int may_block)	);
-//_PROTOTYPE(static void mess_reply, (message *req, message *reply)	);
-_PROTOTYPE(static void get_userdata, (int user_proc,
-		vir_bytes user_addr, vir_bytes count, void *loc_addr)	);
-//_PROTOTYPE(static void get_userdata_s, (int user_proc,
-//		cp_grant_id_t grant, vir_bytes offset, vir_bytes count,
-//		void *loc_addr)	);
-//_PROTOTYPE(static void put_userdata, (int user_proc,
-//		vir_bytes user_addr, vir_bytes count, void *loc_addr)	);
-//_PROTOTYPE(static void put_userdata_s, (int user_proc,
-//		cp_grant_id_t grant, size_t count, void *loc_addr)	);
-_PROTOTYPE(static void insb, (port_t port, void *buf, size_t size)				);
-_PROTOTYPE(static void insw, (port_t port, void *buf, size_t size)				);
-//_PROTOTYPE(static void do_vir_insb, (port_t port, int proc,
-//					vir_bytes buf, size_t size)	);
-//_PROTOTYPE(static void do_vir_insw, (port_t port, int proc,
-//					vir_bytes buf, size_t size)	);
-//_PROTOTYPE(static void do_vir_outsb, (port_t port, int proc,
-//					vir_bytes buf, size_t size)	);
-//_PROTOTYPE(static void do_vir_outsw, (port_t port, int proc,
-//					vir_bytes buf, size_t size)	);
-
-int do_probe(dpeth_t * dep){
-	/* This is the default, try to (re)locate the device. */
-	conf_hw(dep);
-	if (dep->de_mode == DEM_DISABLED)
-	{
-		/* Probe failed, or the device is configured off. */
-		return EXDEV;//ENXIO;
-	}
-	if (dep->de_mode == DEM_ENABLED)
-		dp_init(dep);
-	return EOK;
-}
-
-/*===========================================================================*
- *				dp8390_dump				     *
- *===========================================================================*/
-void dp8390_dump(dpeth_t * dep)
-{
-//	dpeth_t *dep;
-	int /*i,*/ isr;
-
-//	printf("\n");
-//	for (i= 0, dep = &de_table[0]; i<DE_PORT_NR; i++, dep++)
-//	{
-#if XXX
-		if (dep->de_mode == DEM_DISABLED)
-			printf("dp8390 port %d is disabled\n", i);
-		else if (dep->de_mode == DEM_SINK)
-			printf("dp8390 port %d is in sink mode\n", i);
-#endif
-
-		if (dep->de_mode != DEM_ENABLED)
-//			continue;
-			return;
-
-//		printf("dp8390 statistics of port %d:\n", i);
-
-		printf("recvErr    :%8ld\t", dep->de_stat.ets_recvErr);
-		printf("sendErr    :%8ld\t", dep->de_stat.ets_sendErr);
-		printf("OVW        :%8ld\n", dep->de_stat.ets_OVW);
-
-		printf("CRCerr     :%8ld\t", dep->de_stat.ets_CRCerr);
-		printf("frameAll   :%8ld\t", dep->de_stat.ets_frameAll);
-		printf("missedP    :%8ld\n", dep->de_stat.ets_missedP);
-
-		printf("packetR    :%8ld\t", dep->de_stat.ets_packetR);
-		printf("packetT    :%8ld\t", dep->de_stat.ets_packetT);
-		printf("transDef   :%8ld\n", dep->de_stat.ets_transDef);
-
-		printf("collision  :%8ld\t", dep->de_stat.ets_collision);
-		printf("transAb    :%8ld\t", dep->de_stat.ets_transAb);
-		printf("carrSense  :%8ld\n", dep->de_stat.ets_carrSense);
-
-		printf("fifoUnder  :%8ld\t", dep->de_stat.ets_fifoUnder);
-		printf("fifoOver   :%8ld\t", dep->de_stat.ets_fifoOver);
-		printf("CDheartbeat:%8ld\n", dep->de_stat.ets_CDheartbeat);
-
-		printf("OWC        :%8ld\t", dep->de_stat.ets_OWC);
-
-		isr= inb_reg0(dep, DP_ISR);
-		printf("dp_isr = 0x%x + 0x%x, de_flags = 0x%x\n", isr,
-					inb_reg0(dep, DP_ISR), dep->de_flags);
-//	}
-}
-
-/*===========================================================================*
- *				do_init					     *
- *===========================================================================*/
-int do_init(dpeth_t * dep, int mode){
-	if (dep->de_mode == DEM_DISABLED)
-	{
-		// might call do_probe()
-		return EXDEV;
-	}
-
-	if (dep->de_mode == DEM_SINK)
-	{
-//		strncpy((char *) dep->de_address.ea_addr, "ZDP", 6);
-//		dep->de_address.ea_addr[5] = port;
-//		dp_confaddr(dep);
-//		reply_mess.m_type = DL_CONF_REPLY;
-//		reply_mess.m3_i1 = mp->DL_PORT;
-//		reply_mess.m3_i2 = DE_PORT_NR;
-//		*(ether_addr_t *) reply_mess.m3_ca1 = dep->de_address;
-//		mess_reply(mp, &reply_mess);
-//		return;
-		return EOK;
-	}
-	assert(dep->de_mode == DEM_ENABLED);
-	assert(dep->de_flags &DEF_ENABLED);
-
-	dep->de_flags &= ~(DEF_PROMISC | DEF_MULTI | DEF_BROAD);
-
-	if (mode &DL_PROMISC_REQ)
-		dep->de_flags |= DEF_PROMISC | DEF_MULTI | DEF_BROAD;
-	if (mode &DL_MULTI_REQ)
-		dep->de_flags |= DEF_MULTI;
-	if (mode &DL_BROAD_REQ)
-		dep->de_flags |= DEF_BROAD;
-
-//	dep->de_client = mp->m_source;
-	dp_reinit(dep);
-
-//	reply_mess.m_type = DL_CONF_REPLY;
-//	reply_mess.m3_i1 = mp->DL_PORT;
-//	reply_mess.m3_i2 = DE_PORT_NR;
-//	*(ether_addr_t *) reply_mess.m3_ca1 = dep->de_address;
-
-//	mess_reply(mp, &reply_mess);
-	return EOK;
-}
-
-/*===========================================================================*
- *				do_stop					     *
- *===========================================================================*/
-void do_stop(dpeth_t * dep){
-	if((dep->de_mode != DEM_SINK) && (dep->de_mode == DEM_ENABLED) && (dep->de_flags &DEF_ENABLED)){
-		outb_reg0(dep, DP_CR, CR_STP | CR_DM_ABORT);
-		(dep->de_stopf)(dep);
-
-		dep->de_flags = DEF_EMPTY;
-	}
-}
-
-int queue_packet(dpeth_t * dep, packet_t packet){
-	packet_t tmp;
-
-	if(dep->packet_count >= MAX_PACKETS){
-		netif_pq_release(packet_get_id(packet));
-		return ELIMIT;
-	}
-
-	tmp = dep->packet_queue;
-	while(pq_next(tmp)){
-		tmp = pq_next(tmp);
-	}
-	if(pq_add(&tmp, packet, 0, 0) != EOK){
-		return EINVAL;
-	}
-	if(! dep->packet_count){
-		dep->packet_queue = packet;
-	}
-	++ dep->packet_count;
-	return EBUSY;
-}
-
-/*===========================================================================*
- *			based on	do_vwrite				     *
- *===========================================================================*/
-int do_pwrite(dpeth_t * dep, packet_t packet, int from_int)
-{
-//	int port, count, size;
-	int size;
-	int sendq_head;
-/*	dpeth_t *dep;
-
-	port = mp->DL_PORT;
-	count = mp->DL_COUNT;
-	if (port < 0 || port >= DE_PORT_NR)
-		panic("", "dp8390: illegal port", port);
-	dep= &de_table[port];
-	dep->de_client= mp->DL_PROC;
-*/
-	if (dep->de_mode == DEM_SINK)
-	{
-		assert(!from_int);
-//		dep->de_flags |= DEF_PACK_SEND;
-		reply(dep, OK, FALSE);
-//		return;
-		return EOK;
-	}
-	assert(dep->de_mode == DEM_ENABLED);
-	assert(dep->de_flags &DEF_ENABLED);
-	if(dep->packet_queue && (! from_int)){
-//	if (dep->de_flags &DEF_SEND_AVAIL){
-//		panic("", "dp8390: send already in progress", NO_NUM);
-		return queue_packet(dep, packet);
-	}
-
-	sendq_head= dep->de_sendq_head;
-//	if (dep->de_sendq[sendq_head].sq_filled)
-//	{
-//		if (from_int)
-//			panic("", "dp8390: should not be sending\n", NO_NUM);
-//		dep->de_sendmsg= *mp;
-//		dep->de_flags |= DEF_SEND_AVAIL;
-//		reply(dep, OK, FALSE);
-//		return;
-//		return queue_packet(dep, packet);
-//	}
-//	assert(!(dep->de_flags &DEF_PACK_SEND));
-
-/*	if (vectored)
-	{
-		get_userdata(mp->DL_PROC, (vir_bytes) mp->DL_ADDR,
-			(count > IOVEC_NR ? IOVEC_NR : count) *
-			sizeof(iovec_t), dep->de_write_iovec.iod_iovec);
-		dep->de_write_iovec.iod_iovec_s = count;
-		dep->de_write_iovec.iod_proc_nr = mp->DL_PROC;
-		dep->de_write_iovec.iod_iovec_addr = (vir_bytes) mp->DL_ADDR;
-
-		dep->de_tmp_iovec = dep->de_write_iovec;
-		size = calc_iovec_size(&dep->de_tmp_iovec);
-	}
-	else
-	{ 
-		dep->de_write_iovec.iod_iovec[0].iov_addr =
-			(vir_bytes) mp->DL_ADDR;
-		dep->de_write_iovec.iod_iovec[0].iov_size =
-			mp->DL_COUNT;
-		dep->de_write_iovec.iod_iovec_s = 1;
-		dep->de_write_iovec.iod_proc_nr = mp->DL_PROC;
-		dep->de_write_iovec.iod_iovec_addr = 0;
-		size= mp->DL_COUNT;
-	}
-*/
-	size = packet_get_data_length(packet);
-	dep->de_write_iovec.iod_iovec[0].iov_addr = (vir_bytes) packet_get_data(packet);
-	dep->de_write_iovec.iod_iovec[0].iov_size = size;
-	dep->de_write_iovec.iod_iovec_s = 1;
-	dep->de_write_iovec.iod_iovec_addr = NULL;
-
-	if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED)
-	{
-		panic("", "dp8390: invalid packet size", size);
-		return EINVAL;
-	}
-	(dep->de_user2nicf)(dep, &dep->de_write_iovec, 0,
-		dep->de_sendq[sendq_head].sq_sendpage * DP_PAGESIZE,
-		size);
-	dep->de_sendq[sendq_head].sq_filled= TRUE;
-	if (dep->de_sendq_tail == sendq_head)
-	{
-		outb_reg0(dep, DP_TPSR, dep->de_sendq[sendq_head].sq_sendpage);
-		outb_reg0(dep, DP_TBCR1, size >> 8);
-		outb_reg0(dep, DP_TBCR0, size &0xff);
-		outb_reg0(dep, DP_CR, CR_TXP | CR_EXTRA);/* there it goes.. */
-	}
-	else
-		dep->de_sendq[sendq_head].sq_size= size;
-	
-	if (++sendq_head == dep->de_sendq_nr)
-		sendq_head= 0;
-	assert(sendq_head < SENDQ_NR);
-	dep->de_sendq_head= sendq_head;
-
-//	dep->de_flags |= DEF_PACK_SEND;
-
-	/* If the interrupt handler called, don't send a reply. The reply
-	 * will be sent after all interrupts are handled. 
-	 */
-	if (from_int)
-		return EOK;
-	reply(dep, OK, FALSE);
-
-	assert(dep->de_mode == DEM_ENABLED);
-	assert(dep->de_flags &DEF_ENABLED);
-	return EOK;
-}
-
-/*===========================================================================*
- *				dp_init					     *
- *===========================================================================*/
-void dp_init(dep)
-dpeth_t *dep;
-{
-	int dp_rcr_reg;
-	int i;//, r;
-
-	/* General initialization */
-	dep->de_flags = DEF_EMPTY;
-	(*dep->de_initf)(dep);
-
-//	dp_confaddr(dep);
-
-	if (debug)
-	{
-		printf("%s: Ethernet address ", dep->de_name);
-		for (i= 0; i < 6; i++)
-			printf("%x%c", dep->de_address.ea_addr[i],
-							i < 5 ? ':' : '\n');
-	}
-
-	/* Map buffer */
-	map_hw_buffer(dep);
-
-	/* Initialization of the dp8390 following the mandatory procedure
-	 * in reference manual ("DP8390D/NS32490D NIC Network Interface
-	 * Controller", National Semiconductor, July 1995, Page 29).
-	 */
-	/* Step 1: */
-	outb_reg0(dep, DP_CR, CR_PS_P0 | CR_STP | CR_DM_ABORT);
-	/* Step 2: */
-	if (dep->de_16bit)
-		outb_reg0(dep, DP_DCR, DCR_WORDWIDE | DCR_8BYTES | DCR_BMS);
-	else
-		outb_reg0(dep, DP_DCR, DCR_BYTEWIDE | DCR_8BYTES | DCR_BMS);
-	/* Step 3: */
-	outb_reg0(dep, DP_RBCR0, 0);
-	outb_reg0(dep, DP_RBCR1, 0);
-	/* Step 4: */
-	dp_rcr_reg = 0;
-	if (dep->de_flags &DEF_PROMISC)
-		dp_rcr_reg |= RCR_AB | RCR_PRO | RCR_AM;
-	if (dep->de_flags &DEF_BROAD)
-		dp_rcr_reg |= RCR_AB;
-	if (dep->de_flags &DEF_MULTI)
-		dp_rcr_reg |= RCR_AM;
-	outb_reg0(dep, DP_RCR, dp_rcr_reg);
-	/* Step 5: */
-	outb_reg0(dep, DP_TCR, TCR_INTERNAL);
-	/* Step 6: */
-	outb_reg0(dep, DP_BNRY, dep->de_startpage);
-	outb_reg0(dep, DP_PSTART, dep->de_startpage);
-	outb_reg0(dep, DP_PSTOP, dep->de_stoppage);
-	/* Step 7: */
-	outb_reg0(dep, DP_ISR, 0xFF);
-	/* Step 8: */
-	outb_reg0(dep, DP_IMR, IMR_PRXE | IMR_PTXE | IMR_RXEE | IMR_TXEE |
-		IMR_OVWE | IMR_CNTE);
-	/* Step 9: */
-	outb_reg0(dep, DP_CR, CR_PS_P1 | CR_DM_ABORT | CR_STP);
-
-	outb_reg1(dep, DP_PAR0, dep->de_address.ea_addr[0]);
-	outb_reg1(dep, DP_PAR1, dep->de_address.ea_addr[1]);
-	outb_reg1(dep, DP_PAR2, dep->de_address.ea_addr[2]);
-	outb_reg1(dep, DP_PAR3, dep->de_address.ea_addr[3]);
-	outb_reg1(dep, DP_PAR4, dep->de_address.ea_addr[4]);
-	outb_reg1(dep, DP_PAR5, dep->de_address.ea_addr[5]);
-
-	outb_reg1(dep, DP_MAR0, 0xff);
-	outb_reg1(dep, DP_MAR1, 0xff);
-	outb_reg1(dep, DP_MAR2, 0xff);
-	outb_reg1(dep, DP_MAR3, 0xff);
-	outb_reg1(dep, DP_MAR4, 0xff);
-	outb_reg1(dep, DP_MAR5, 0xff);
-	outb_reg1(dep, DP_MAR6, 0xff);
-	outb_reg1(dep, DP_MAR7, 0xff);
-
-	outb_reg1(dep, DP_CURR, dep->de_startpage + 1);
-	/* Step 10: */
-	outb_reg0(dep, DP_CR, CR_DM_ABORT | CR_STA);
-	/* Step 11: */
-	outb_reg0(dep, DP_TCR, TCR_NORMAL);
-
-	inb_reg0(dep, DP_CNTR0);		/* reset counters by reading */
-	inb_reg0(dep, DP_CNTR1);
-	inb_reg0(dep, DP_CNTR2);
-
-	/* Finish the initialization. */
-	dep->de_flags |= DEF_ENABLED;
-	for (i= 0; i<dep->de_sendq_nr; i++)
-		dep->de_sendq[i].sq_filled= 0;
-	dep->de_sendq_head= 0;
-	dep->de_sendq_tail= 0;
-	if (!dep->de_prog_IO)
-	{
-		dep->de_user2nicf= dp_user2nic;
-//		dep->de_user2nicf_s= dp_user2nic_s;
-		dep->de_nic2userf= dp_nic2user;
-//		dep->de_nic2userf_s= dp_nic2user_s;
-		dep->de_getblockf= dp_getblock;
-	}
-	else if (dep->de_16bit)
-	{
-		dep->de_user2nicf= dp_pio16_user2nic;
-//		dep->de_user2nicf_s= dp_pio16_user2nic_s;
-		dep->de_nic2userf= dp_pio16_nic2user;
-//		dep->de_nic2userf_s= dp_pio16_nic2user_s;
-		dep->de_getblockf= dp_pio16_getblock;
-	}
-	else
-	{
-		dep->de_user2nicf= dp_pio8_user2nic;
-//		dep->de_user2nicf_s= dp_pio8_user2nic_s;
-		dep->de_nic2userf= dp_pio8_nic2user;
-//		dep->de_nic2userf_s= dp_pio8_nic2user_s;
-		dep->de_getblockf= dp_pio8_getblock;
-	}
-
-	/* Set the interrupt handler and policy. Do not automatically 
-	 * reenable interrupts. Return the IRQ line number on interrupts.
- 	 */
-/* 	dep->de_hook = dep->de_irq;
-	r= sys_irqsetpolicy(dep->de_irq, 0, &dep->de_hook);
-	if (r != OK)
-		panic("DP8390", "sys_irqsetpolicy failed", r);
-
-	r= sys_irqenable(&dep->de_hook);
-	if (r != OK)
-	{
-		panic("DP8390", "unable enable interrupts", r);
-	}
-*/
-}
-
-/*===========================================================================*
- *				dp_reinit				     *
- *===========================================================================*/
-static void dp_reinit(dep)
-dpeth_t *dep;
-{
-	int dp_rcr_reg;
-
-	outb_reg0(dep, DP_CR, CR_PS_P0 | CR_EXTRA);
-
-	dp_rcr_reg = 0;
-	if (dep->de_flags &DEF_PROMISC)
-		dp_rcr_reg |= RCR_AB | RCR_PRO | RCR_AM;
-	if (dep->de_flags &DEF_BROAD)
-		dp_rcr_reg |= RCR_AB;
-	if (dep->de_flags &DEF_MULTI)
-		dp_rcr_reg |= RCR_AM;
-	outb_reg0(dep, DP_RCR, dp_rcr_reg);
-}
-
-/*===========================================================================*
- *				dp_reset				     *
- *===========================================================================*/
-static void dp_reset(dep)
-dpeth_t *dep;
-{
-	int i;
-
-	/* Stop chip */
-	outb_reg0(dep, DP_CR, CR_STP | CR_DM_ABORT);
-	outb_reg0(dep, DP_RBCR0, 0);
-	outb_reg0(dep, DP_RBCR1, 0);
-	for (i= 0; i < 0x1000 && ((inb_reg0(dep, DP_ISR) &ISR_RST) == 0); i++)
-		; /* Do nothing */
-	outb_reg0(dep, DP_TCR, TCR_1EXTERNAL|TCR_OFST);
-	outb_reg0(dep, DP_CR, CR_STA|CR_DM_ABORT);
-	outb_reg0(dep, DP_TCR, TCR_NORMAL);
-
-	/* Acknowledge the ISR_RDC (remote dma) interrupt. */
-	for (i= 0; i < 0x1000 && ((inb_reg0(dep, DP_ISR) &ISR_RDC) == 0); i++)
-		; /* Do nothing */
-	outb_reg0(dep, DP_ISR, inb_reg0(dep, DP_ISR) &~ISR_RDC);
-
-	/* Reset the transmit ring. If we were transmitting a packet, we
-	 * pretend that the packet is processed. Higher layers will
-	 * retransmit if the packet wasn't actually sent.
-	 */
-	dep->de_sendq_head= dep->de_sendq_tail= 0;
-	for (i= 0; i<dep->de_sendq_nr; i++)
-		dep->de_sendq[i].sq_filled= 0;
-	dp_send(dep);
-	dep->de_flags &= ~DEF_STOPPED;
-}
-
-/*===========================================================================*
- *				dp_check_ints				     *
- *===========================================================================*/
-void dp_check_ints(dep, isr)
-dpeth_t *dep;
-int isr;
-{
-	int /*isr,*/ tsr;
-	int size, sendq_tail;
-
-	if (!(dep->de_flags &DEF_ENABLED))
-		panic("", "dp8390: got premature interrupt", NO_NUM);
-
-	for(;;)
-	{
-//		isr = inb_reg0(dep, DP_ISR);
-		if (!isr)
-			break;
-		outb_reg0(dep, DP_ISR, isr);
-		if (isr &(ISR_PTX|ISR_TXE))
-		{
-			if (isr &ISR_TXE)
-			{
-#if DEBUG
- {printf("%s: got send Error\n", dep->de_name);}
-#endif
-				dep->de_stat.ets_sendErr++;
-			}
-			else
-			{
-				tsr = inb_reg0(dep, DP_TSR);
-
-				if (tsr &TSR_PTX) dep->de_stat.ets_packetT++;
-#if 0	/* Reserved in later manuals, should be ignored */
-				if (!(tsr &TSR_DFR))
-				{
-					/* In most (all?) implementations of
-					 * the dp8390, this bit is set
-					 * when the packet is not deferred
-					 */
-					dep->de_stat.ets_transDef++;
-				}
-#endif
-				if (tsr &TSR_COL) dep->de_stat.ets_collision++;
-				if (tsr &TSR_ABT) dep->de_stat.ets_transAb++;
-				if (tsr &TSR_CRS) dep->de_stat.ets_carrSense++;
-				if (tsr &TSR_FU
-					&& ++dep->de_stat.ets_fifoUnder <= 10)
-				{
-					printf("%s: fifo underrun\n",
-						dep->de_name);
-				}
-				if (tsr &TSR_CDH
-					&& ++dep->de_stat.ets_CDheartbeat <= 10)
-				{
-					printf("%s: CD heart beat failure\n",
-						dep->de_name);
-				}
-				if (tsr &TSR_OWC) dep->de_stat.ets_OWC++;
-			}
-			sendq_tail= dep->de_sendq_tail;
-
-			if (!(dep->de_sendq[sendq_tail].sq_filled))
-			{
-				/* Software bug? */
-				assert(!debug);
-
-				/* Or hardware bug? */
-				printf(
-				"%s: transmit interrupt, but not sending\n",
-					dep->de_name);
-				continue;
-			}
-			dep->de_sendq[sendq_tail].sq_filled= 0;
-			if (++sendq_tail == dep->de_sendq_nr)
-				sendq_tail= 0;
-			dep->de_sendq_tail= sendq_tail;
-			if (dep->de_sendq[sendq_tail].sq_filled)
-			{
-				size= dep->de_sendq[sendq_tail].sq_size;
-				outb_reg0(dep, DP_TPSR,
-					dep->de_sendq[sendq_tail].sq_sendpage);
-				outb_reg0(dep, DP_TBCR1, size >> 8);
-				outb_reg0(dep, DP_TBCR0, size &0xff);
-				outb_reg0(dep, DP_CR, CR_TXP | CR_EXTRA);
-			}
-//			if (dep->de_flags &DEF_SEND_AVAIL)
-				dp_send(dep);
-		}
-
-		if (isr &ISR_PRX)
-		{
-			/* Only call dp_recv if there is a read request */
-//			if (dep->de_flags) &DEF_READING)
-				dp_recv(dep);
-		}
-		
-		if (isr &ISR_RXE) dep->de_stat.ets_recvErr++;
-		if (isr &ISR_CNT)
-		{
-			dep->de_stat.ets_CRCerr += inb_reg0(dep, DP_CNTR0);
-			dep->de_stat.ets_frameAll += inb_reg0(dep, DP_CNTR1);
-			dep->de_stat.ets_missedP += inb_reg0(dep, DP_CNTR2);
-		}
-		if (isr &ISR_OVW)
-		{
-			dep->de_stat.ets_OVW++;
-#if 0
-			{printW(); printf(
-				"%s: got overwrite warning\n", dep->de_name);}
-#endif
-/*			if (dep->de_flags &DEF_READING)
-			{
-				printf(
-"dp_check_ints: strange: overwrite warning and pending read request\n");
-				dp_recv(dep);
-			}
-*/		}
-		if (isr &ISR_RDC)
-		{
-			/* Nothing to do */
-		}
-		if (isr &ISR_RST)
-		{
-			/* this means we got an interrupt but the ethernet 
-			 * chip is shutdown. We set the flag DEF_STOPPED,
-			 * and continue processing arrived packets. When the
-			 * receive buffer is empty, we reset the dp8390.
-			 */
-#if 0
-			 {printW(); printf(
-				"%s: NIC stopped\n", dep->de_name);}
-#endif
-			dep->de_flags |= DEF_STOPPED;
-			break;
-		}
-		isr = inb_reg0(dep, DP_ISR);
-	}
-//	if ((dep->de_flags &(DEF_READING|DEF_STOPPED)) == 
-//						(DEF_READING|DEF_STOPPED))
-	if ((dep->de_flags &DEF_STOPPED) == DEF_STOPPED)
-	{
-		/* The chip is stopped, and all arrived packets are 
-		 * delivered.
-		 */
-		dp_reset(dep);
-	}
-}
-
-/*===========================================================================*
- *				dp_recv					     *
- *===========================================================================*/
-static void dp_recv(dep)
-dpeth_t *dep;
-{
-	dp_rcvhdr_t header;
-	//unsigned pageno, curr, next;
-	int pageno, curr, next;
-	vir_bytes length;
-	int packet_processed, r;
-	u16_t eth_type;
-
-	packet_processed = FALSE;
-	pageno = inb_reg0(dep, DP_BNRY) + 1;
-	if (pageno == dep->de_stoppage) pageno = dep->de_startpage;
-
-	do
-	{
-		outb_reg0(dep, DP_CR, CR_PS_P1 | CR_EXTRA);
-		curr = inb_reg1(dep, DP_CURR);
-		outb_reg0(dep, DP_CR, CR_PS_P0 | CR_EXTRA);
-
-		if (curr == pageno) break;
-
-		(dep->de_getblockf)(dep, pageno, (size_t)0, sizeof(header),
-			&header);
-		(dep->de_getblockf)(dep, pageno, sizeof(header) +
-			2*sizeof(ether_addr_t), sizeof(eth_type), &eth_type);
-
-		length = (header.dr_rbcl | (header.dr_rbch << 8)) -
-			sizeof(dp_rcvhdr_t);
-		next = header.dr_next;
-		if (length < ETH_MIN_PACK_SIZE ||
-			length > ETH_MAX_PACK_SIZE_TAGGED)
-		{
-			printf("%s: packet with strange length arrived: %d\n",
-				dep->de_name, (int) length);
-			next= curr;
-		}
-		else if (next < dep->de_startpage || next >= dep->de_stoppage)
-		{
-			printf("%s: strange next page\n", dep->de_name);
-			next= curr;
-		}
-/*		else if (eth_type == eth_ign_proto)
-		{
-*/			/* Hack: ignore packets of a given protocol, useful
-			 * if you share a net with 80 computers sending
-			 * Amoeba FLIP broadcasts.  (Protocol 0x8146.)
-			 */
-/*			static int first= 1;
-			if (first)
-			{
-				first= 0;
-				printf("%s: dropping proto 0x%04x packets\n",
-					dep->de_name,
-					ntohs(eth_ign_proto));
-			}
-			dep->de_stat.ets_packetR++;
-		}
-*/		else if (header.dr_status &RSR_FO)
-		{
-			/* This is very serious, so we issue a warning and
-			 * reset the buffers */
-			printf("%s: fifo overrun, resetting receive buffer\n",
-				dep->de_name);
-			dep->de_stat.ets_fifoOver++;
-			next = curr;
-		}
-		else if ((header.dr_status &RSR_PRX) && 
-					   (dep->de_flags &DEF_ENABLED))
-		{
-//			if (dep->de_safecopy_read)
-//				r = dp_pkt2user_s(dep, pageno, length);
-//			else
-				r = dp_pkt2user(dep, pageno, length);
-			if (r != OK)
-				return;
-
-			packet_processed = TRUE;
-			dep->de_stat.ets_packetR++;
-		}
-		if (next == dep->de_startpage)
-			outb_reg0(dep, DP_BNRY, dep->de_stoppage - 1);
-		else
-			outb_reg0(dep, DP_BNRY, next - 1);
-
-		pageno = next;
-	}
-	while (!packet_processed);
-}
-
-/*===========================================================================*
- *				dp_send					     *
- *===========================================================================*/
-static void dp_send(dep)
-dpeth_t *dep;
-{
-	packet_t packet;
-
-//	if (!(dep->de_flags &DEF_SEND_AVAIL))
-//		return;
-
-	if(dep->packet_queue){
-		packet = dep->packet_queue;
-		dep->packet_queue = pq_detach(packet);
-		do_pwrite(dep, packet, TRUE);
-		netif_pq_release(packet_get_id(packet));
-		-- dep->packet_count;
-	}
-//	if(! dep->packet_queue){
-//		dep->de_flags &= ~DEF_SEND_AVAIL;
-//	}
-/*	switch(dep->de_sendmsg.m_type)
-	{
-	case DL_WRITE:	do_vwrite(&dep->de_sendmsg, TRUE, FALSE);	break;
-	case DL_WRITEV:	do_vwrite(&dep->de_sendmsg, TRUE, TRUE);	break;
-	case DL_WRITEV_S: do_vwrite_s(&dep->de_sendmsg, TRUE);	break;
-	default:
-		panic("", "dp8390: wrong type", dep->de_sendmsg.m_type);
-		break;
-	}
-*/
-}
-
-/*===========================================================================*
- *				dp_getblock				     *
- *===========================================================================*/
-static void dp_getblock(dep, page, offset, size, dst)
-dpeth_t *dep;
-int page;
-size_t offset;
-size_t size;
-void *dst;
-{
-//	int r;
-
-	offset = page * DP_PAGESIZE + offset;
-
-	memcpy(dst, dep->de_locmem + offset, size);
-}
-
-/*===========================================================================*
- *				dp_pio8_getblock			     *
- *===========================================================================*/
-static void dp_pio8_getblock(dep, page, offset, size, dst)
-dpeth_t *dep;
-int page;
-size_t offset;
-size_t size;
-void *dst;
-{
-	offset = page * DP_PAGESIZE + offset;
-	outb_reg0(dep, DP_RBCR0, size &0xFF);
-	outb_reg0(dep, DP_RBCR1, size >> 8);
-	outb_reg0(dep, DP_RSAR0, offset &0xFF);
-	outb_reg0(dep, DP_RSAR1, offset >> 8);
-	outb_reg0(dep, DP_CR, CR_DM_RR | CR_PS_P0 | CR_STA);
-
-	insb(dep->de_data_port, dst, size);
-}
-
-/*===========================================================================*
- *				dp_pio16_getblock			     *
- *===========================================================================*/
-static void dp_pio16_getblock(dep, page, offset, size, dst)
-dpeth_t *dep;
-int page;
-size_t offset;
-size_t size;
-void *dst;
-{
-	offset = page * DP_PAGESIZE + offset;
-	outb_reg0(dep, DP_RBCR0, size &0xFF);
-	outb_reg0(dep, DP_RBCR1, size >> 8);
-	outb_reg0(dep, DP_RSAR0, offset &0xFF);
-	outb_reg0(dep, DP_RSAR1, offset >> 8);
-	outb_reg0(dep, DP_CR, CR_DM_RR | CR_PS_P0 | CR_STA);
-
-	assert (!(size &1));
-	insw(dep->de_data_port, dst, size);
-}
-
-/*===========================================================================*
- *				dp_pkt2user				     *
- *===========================================================================*/
-static int dp_pkt2user(dep, page, length)
-dpeth_t *dep;
-int page, length;
-{
-	int last, count;
-	packet_t packet;
-
-//	if (!(dep->de_flags &DEF_READING))
-//		return EGENERIC;
-
-	packet = netif_packet_get_1(length);
-	if(! packet){
-		return ENOMEM;
-	}
-	dep->de_read_iovec.iod_iovec[0].iov_addr = (vir_bytes) packet_suffix(packet, length);
-	dep->de_read_iovec.iod_iovec[0].iov_size = length;
-	dep->de_read_iovec.iod_iovec_s = 1;
-	dep->de_read_iovec.iod_iovec_addr = NULL;
-
-	last = page + (length - 1) / DP_PAGESIZE;
-	if (last >= dep->de_stoppage)
-	{
-		count = (dep->de_stoppage - page) * DP_PAGESIZE -
-			sizeof(dp_rcvhdr_t);
-
-		/* Save read_iovec since we need it twice. */
-		dep->de_tmp_iovec = dep->de_read_iovec;
-		(dep->de_nic2userf)(dep, page * DP_PAGESIZE +
-			sizeof(dp_rcvhdr_t), &dep->de_tmp_iovec, 0, count);
-		(dep->de_nic2userf)(dep, dep->de_startpage * DP_PAGESIZE, 
-			&dep->de_read_iovec, count, length - count);
-	}
-	else
-	{
-		(dep->de_nic2userf)(dep, page * DP_PAGESIZE +
-			sizeof(dp_rcvhdr_t), &dep->de_read_iovec, 0, length);
-	}
-
-	dep->de_read_s = length;
-	dep->de_flags |= DEF_PACK_RECV;
-//	dep->de_flags &= ~DEF_READING;
-
-	if(dep->received_count >= MAX_PACKETS){
-		netif_pq_release(packet_get_id(packet));
-		return ELIMIT;
-	}else{
-		if(pq_add(&dep->received_queue, packet, 0, 0) == EOK){
-			++ dep->received_count;
-		}else{
-			netif_pq_release(packet_get_id(packet));
-		}
-	}
-	return OK;
-}
-
-/*===========================================================================*
- *				dp_user2nic				     *
- *===========================================================================*/
-static void dp_user2nic(dep, iovp, offset, nic_addr, count)
-dpeth_t *dep;
-iovec_dat_t *iovp;
-vir_bytes offset;
-int nic_addr;
-vir_bytes count;
-{
-	vir_bytes vir_hw;//, vir_user;
-	//int bytes, i, r;
-	int i, r;
-	vir_bytes bytes;
-
-	vir_hw = (vir_bytes)dep->de_locmem + nic_addr;
-
-	i= 0;
-	while (count > 0)
-	{
-		if (i >= IOVEC_NR)
-		{
-			dp_next_iovec(iovp);
-			i= 0;
-			continue;
-		}
-		assert(i < iovp->iod_iovec_s);
-		if (offset >= iovp->iod_iovec[i].iov_size)
-		{
-			offset -= iovp->iod_iovec[i].iov_size;
-			i++;
-			continue;
-		}
-		bytes = iovp->iod_iovec[i].iov_size - offset;
-		if (bytes > count)
-			bytes = count;
-
-		r= sys_vircopy(iovp->iod_proc_nr, D,
-			iovp->iod_iovec[i].iov_addr + offset,
-			SELF, D, vir_hw, bytes);
-		if (r != OK)
-			panic("DP8390", "dp_user2nic: sys_vircopy failed", r);
-
-		count -= bytes;
-		vir_hw += bytes;
-		offset += bytes;
-	}
-	assert(count == 0);
-}
-
-/*===========================================================================*
- *				dp_pio8_user2nic			     *
- *===========================================================================*/
-static void dp_pio8_user2nic(dep, iovp, offset, nic_addr, count)
-dpeth_t *dep;
-iovec_dat_t *iovp;
-vir_bytes offset;
-int nic_addr;
-vir_bytes count;
-{
-//	phys_bytes phys_user;
-	int i;
-	vir_bytes bytes;
-
-	outb_reg0(dep, DP_ISR, ISR_RDC);
-
-	outb_reg0(dep, DP_RBCR0, count &0xFF);
-	outb_reg0(dep, DP_RBCR1, count >> 8);
-	outb_reg0(dep, DP_RSAR0, nic_addr &0xFF);
-	outb_reg0(dep, DP_RSAR1, nic_addr >> 8);
-	outb_reg0(dep, DP_CR, CR_DM_RW | CR_PS_P0 | CR_STA);
-
-	i= 0;
-	while (count > 0)
-	{
-		if (i >= IOVEC_NR)
-		{
-			dp_next_iovec(iovp);
-			i= 0;
-			continue;
-		}
-		assert(i < iovp->iod_iovec_s);
-		if (offset >= iovp->iod_iovec[i].iov_size)
-		{
-			offset -= iovp->iod_iovec[i].iov_size;
-			i++;
-			continue;
-		}
-		bytes = iovp->iod_iovec[i].iov_size - offset;
-		if (bytes > count)
-			bytes = count;
-
-		do_vir_outsb(dep->de_data_port, iovp->iod_proc_nr,
-			iovp->iod_iovec[i].iov_addr + offset, bytes);
-		count -= bytes;
-		offset += bytes;
-	}
-	assert(count == 0);
-
-	for (i= 0; i<100; i++)
-	{
-		if (inb_reg0(dep, DP_ISR) &ISR_RDC)
-			break;
-	}
-	if (i == 100)
-	{
-		panic("", "dp8390: remote dma failed to complete", NO_NUM);
-	}
-}
-
-/*===========================================================================*
- *				dp_pio16_user2nic			     *
- *===========================================================================*/
-static void dp_pio16_user2nic(dep, iovp, offset, nic_addr, count)
-dpeth_t *dep;
-iovec_dat_t *iovp;
-vir_bytes offset;
-int nic_addr;
-vir_bytes count;
-{
-	vir_bytes vir_user;
-	vir_bytes ecount;
-	int i, r, user_proc;
-	vir_bytes bytes;
-	//u8_t two_bytes[2];
-	u16_t two_bytes;
-	int odd_byte;
-
-	ecount= (count+1) &~1;
-	odd_byte= 0;
-
-	outb_reg0(dep, DP_ISR, ISR_RDC);
-	outb_reg0(dep, DP_RBCR0, ecount &0xFF);
-	outb_reg0(dep, DP_RBCR1, ecount >> 8);
-	outb_reg0(dep, DP_RSAR0, nic_addr &0xFF);
-	outb_reg0(dep, DP_RSAR1, nic_addr >> 8);
-	outb_reg0(dep, DP_CR, CR_DM_RW | CR_PS_P0 | CR_STA);
-
-	i= 0;
-	while (count > 0)
-	{
-		if (i >= IOVEC_NR)
-		{
-			dp_next_iovec(iovp);
-			i= 0;
-			continue;
-		}
-		assert(i < iovp->iod_iovec_s);
-		if (offset >= iovp->iod_iovec[i].iov_size)
-		{
-			offset -= iovp->iod_iovec[i].iov_size;
-			i++;
-			continue;
-		}
-		bytes = iovp->iod_iovec[i].iov_size - offset;
-		if (bytes > count)
-			bytes = count;
-
-		user_proc= iovp->iod_proc_nr;
-		vir_user= iovp->iod_iovec[i].iov_addr + offset;
-		if (odd_byte)
-		{
-			r= sys_vircopy(user_proc, D, vir_user, 
-			//	SELF, D, (vir_bytes)&two_bytes[1], 1);
-				SELF, D, (vir_bytes)&(((u8_t *)&two_bytes)[1]), 1);
-			if (r != OK)
-			{
-				panic("DP8390",
-					"dp_pio16_user2nic: sys_vircopy failed",
-					r);
-			}
-			//outw(dep->de_data_port, *(u16_t *)two_bytes);
-			outw(dep->de_data_port, two_bytes);
-			count--;
-			offset++;
-			bytes--;
-			vir_user++;
-			odd_byte= 0;
-			if (!bytes)
-				continue;
-		}
-		ecount= bytes &~1;
-		if (ecount != 0)
-		{
-			do_vir_outsw(dep->de_data_port, user_proc, vir_user,
-				ecount);
-			count -= ecount;
-			offset += ecount;
-			bytes -= ecount;
-			vir_user += ecount;
-		}
-		if (bytes)
-		{
-			assert(bytes == 1);
-			r= sys_vircopy(user_proc, D, vir_user, 
-			//	SELF, D, (vir_bytes)&two_bytes[0], 1);
-				SELF, D, (vir_bytes)&(((u8_t *)&two_bytes)[0]), 1);
-			if (r != OK)
-			{
-				panic("DP8390",
-					"dp_pio16_user2nic: sys_vircopy failed",
-					r);
-			}
-			count--;
-			offset++;
-			bytes--;
-			vir_user++;
-			odd_byte= 1;
-		}
-	}
-	assert(count == 0);
-
-	if (odd_byte)
-		//outw(dep->de_data_port, *(u16_t *)two_bytes);
-		outw(dep->de_data_port, two_bytes);
-
-	for (i= 0; i<100; i++)
-	{
-		if (inb_reg0(dep, DP_ISR) &ISR_RDC)
-			break;
-	}
-	if (i == 100)
-	{
-		panic("", "dp8390: remote dma failed to complete", NO_NUM);
-	}
-}
-
-/*===========================================================================*
- *				dp_nic2user				     *
- *===========================================================================*/
-static void dp_nic2user(dep, nic_addr, iovp, offset, count)
-dpeth_t *dep;
-int nic_addr;
-iovec_dat_t *iovp;
-vir_bytes offset;
-vir_bytes count;
-{
-	vir_bytes vir_hw;//, vir_user;
-	vir_bytes bytes;
-	int i, r;
-
-	vir_hw = (vir_bytes)dep->de_locmem + nic_addr;
-
-	i= 0;
-	while (count > 0)
-	{
-		if (i >= IOVEC_NR)
-		{
-			dp_next_iovec(iovp);
-			i= 0;
-			continue;
-		}
-		assert(i < iovp->iod_iovec_s);
-		if (offset >= iovp->iod_iovec[i].iov_size)
-		{
-			offset -= iovp->iod_iovec[i].iov_size;
-			i++;
-			continue;
-		}
-		bytes = iovp->iod_iovec[i].iov_size - offset;
-		if (bytes > count)
-			bytes = count;
-
-		r= sys_vircopy(SELF, D, vir_hw,
-			iovp->iod_proc_nr, D,
-			iovp->iod_iovec[i].iov_addr + offset, bytes);
-		if (r != OK)
-			panic("DP8390", "dp_nic2user: sys_vircopy failed", r);
-
-		count -= bytes;
-		vir_hw += bytes;
-		offset += bytes;
-	}
-	assert(count == 0);
-}
-
-/*===========================================================================*
- *				dp_pio8_nic2user			     *
- *===========================================================================*/
-static void dp_pio8_nic2user(dep, nic_addr, iovp, offset, count)
-dpeth_t *dep;
-int nic_addr;
-iovec_dat_t *iovp;
-vir_bytes offset;
-vir_bytes count;
-{
-//	phys_bytes phys_user;
-	int i;
-	vir_bytes bytes;
-
-	outb_reg0(dep, DP_RBCR0, count &0xFF);
-	outb_reg0(dep, DP_RBCR1, count >> 8);
-	outb_reg0(dep, DP_RSAR0, nic_addr &0xFF);
-	outb_reg0(dep, DP_RSAR1, nic_addr >> 8);
-	outb_reg0(dep, DP_CR, CR_DM_RR | CR_PS_P0 | CR_STA);
-
-	i= 0;
-	while (count > 0)
-	{
-		if (i >= IOVEC_NR)
-		{
-			dp_next_iovec(iovp);
-			i= 0;
-			continue;
-		}
-		assert(i < iovp->iod_iovec_s);
-		if (offset >= iovp->iod_iovec[i].iov_size)
-		{
-			offset -= iovp->iod_iovec[i].iov_size;
-			i++;
-			continue;
-		}
-		bytes = iovp->iod_iovec[i].iov_size - offset;
-		if (bytes > count)
-			bytes = count;
-
-		do_vir_insb(dep->de_data_port, iovp->iod_proc_nr,
-			iovp->iod_iovec[i].iov_addr + offset, bytes);
-		count -= bytes;
-		offset += bytes;
-	}
-	assert(count == 0);
-}
-
-/*===========================================================================*
- *				dp_pio16_nic2user			     *
- *===========================================================================*/
-static void dp_pio16_nic2user(dep, nic_addr, iovp, offset, count)
-dpeth_t *dep;
-int nic_addr;
-iovec_dat_t *iovp;
-vir_bytes offset;
-vir_bytes count;
-{
-	vir_bytes vir_user;
-	vir_bytes ecount;
-	int i, r, user_proc;
-	vir_bytes bytes;
-	//u8_t two_bytes[2];
-	u16_t two_bytes;
-	int odd_byte;
-
-	ecount= (count+1) &~1;
-	odd_byte= 0;
-
-	outb_reg0(dep, DP_RBCR0, ecount &0xFF);
-	outb_reg0(dep, DP_RBCR1, ecount >> 8);
-	outb_reg0(dep, DP_RSAR0, nic_addr &0xFF);
-	outb_reg0(dep, DP_RSAR1, nic_addr >> 8);
-	outb_reg0(dep, DP_CR, CR_DM_RR | CR_PS_P0 | CR_STA);
-
-	i= 0;
-	while (count > 0)
-	{
-		if (i >= IOVEC_NR)
-		{
-			dp_next_iovec(iovp);
-			i= 0;
-			continue;
-		}
-		assert(i < iovp->iod_iovec_s);
-		if (offset >= iovp->iod_iovec[i].iov_size)
-		{
-			offset -= iovp->iod_iovec[i].iov_size;
-			i++;
-			continue;
-		}
-		bytes = iovp->iod_iovec[i].iov_size - offset;
-		if (bytes > count)
-			bytes = count;
-
-		user_proc= iovp->iod_proc_nr;
-		vir_user= iovp->iod_iovec[i].iov_addr + offset;
-		if (odd_byte)
-		{
-			//r= sys_vircopy(SELF, D, (vir_bytes)&two_bytes[1],
-			r= sys_vircopy(SELF, D, (vir_bytes)&(((u8_t *)&two_bytes)[1]),
-				user_proc, D, vir_user,  1);
-			if (r != OK)
-			{
-				panic("DP8390",
-					"dp_pio16_nic2user: sys_vircopy failed",
-					r);
-			}
-			count--;
-			offset++;
-			bytes--;
-			vir_user++;
-			odd_byte= 0;
-			if (!bytes)
-				continue;
-		}
-		ecount= bytes &~1;
-		if (ecount != 0)
-		{
-			do_vir_insw(dep->de_data_port, user_proc, vir_user,
-				ecount);
-			count -= ecount;
-			offset += ecount;
-			bytes -= ecount;
-			vir_user += ecount;
-		}
-		if (bytes)
-		{
-			assert(bytes == 1);
-			//*(u16_t *)two_bytes= inw(dep->de_data_port);
-			two_bytes= inw(dep->de_data_port);
-			//r= sys_vircopy(SELF, D, (vir_bytes)&two_bytes[0],
-			r= sys_vircopy(SELF, D, (vir_bytes)&(((u8_t *)&two_bytes)[0]),
-				user_proc, D, vir_user,  1);
-			if (r != OK)
-			{
-				panic("DP8390",
-					"dp_pio16_nic2user: sys_vircopy failed",
-					r);
-			}
-			count--;
-			offset++;
-			bytes--;
-			vir_user++;
-			odd_byte= 1;
-		}
-	}
-	assert(count == 0);
-}
-
-/*===========================================================================*
- *				dp_next_iovec				     *
- *===========================================================================*/
-static void dp_next_iovec(iovp)
-iovec_dat_t *iovp;
-{
-	assert(iovp->iod_iovec_s > IOVEC_NR);
-
-	iovp->iod_iovec_s -= IOVEC_NR;
-
-	iovp->iod_iovec_addr += IOVEC_NR * sizeof(iovec_t);
-
-	get_userdata(iovp->iod_proc_nr, iovp->iod_iovec_addr, 
-		(iovp->iod_iovec_s > IOVEC_NR ? IOVEC_NR : iovp->iod_iovec_s) *
-		sizeof(iovec_t), iovp->iod_iovec); 
-}
-
-/*===========================================================================*
- *				conf_hw					     *
- *===========================================================================*/
-static void conf_hw(dep)
-dpeth_t *dep;
-{
-//	static eth_stat_t empty_stat = {0, 0, 0, 0, 0, 0 	/* ,... */};
-
-//	int ifnr;
-//	dp_conf_t *dcp;
-
-//	dep->de_mode= DEM_DISABLED;	/* Superfluous */
-//	ifnr= dep-de_table;
-
-//	dcp= &dp_conf[ifnr];
-//	update_conf(dep, dcp);
-//	if (dep->de_mode != DEM_ENABLED)
-//		return;
-	if (!wdeth_probe(dep) && !ne_probe(dep) && !el2_probe(dep))
-	{
-		printf("%s: No ethernet card found at 0x%x\n", 
-			dep->de_name, dep->de_base_port);
-		dep->de_mode= DEM_DISABLED;
-		return;
-	}
-
-/* XXX */ if (dep->de_linmem == 0) dep->de_linmem= 0xFFFF0000;
-
-	dep->de_mode = DEM_ENABLED;
-
-	dep->de_flags = DEF_EMPTY;
-//	dep->de_stat = empty_stat;
-}
-
-/*===========================================================================*
- *				map_hw_buffer				     *
- *===========================================================================*/
-static void map_hw_buffer(dep)
-dpeth_t *dep;
-{
-//	int r;
-//	size_t o, size;
-//	char *buf, *abuf;
-
-	if (dep->de_prog_IO)
-	{
-#if 0
-		if(debug){
-			printf(
-			"map_hw_buffer: programmed I/O, no need to map buffer\n");
-		}
-#endif
-		dep->de_locmem = (char *)-dep->de_ramsize; /* trap errors */
-		return;
-	}else{
-		printf("map_hw_buffer: no buffer!\n");
-	}
-
-//	size = dep->de_ramsize + PAGE_SIZE;	/* Add PAGE_SIZE for
-//						 * alignment
-//						 */
-//	buf= malloc(size);
-//	if (buf == NULL)
-//		panic(__FILE__, "map_hw_buffer: cannot malloc size", size);
-//	o= PAGE_SIZE - ((vir_bytes)buf % PAGE_SIZE);
-//	abuf= buf + o;
-//	printf("buf at 0x%x, abuf at 0x%x\n", buf, abuf);
-
-//	r= sys_vm_map(SELF, 1 /* map */, (vir_bytes)abuf,
-//			dep->de_ramsize, (phys_bytes)dep->de_linmem);
-//	if (r != OK)
-//		panic(__FILE__, "map_hw_buffer: sys_vm_map failed", r);
-//	dep->de_locmem = abuf;
-}
-
-/*===========================================================================*
- *				reply					     *
- *===========================================================================*/
-static void reply(dep, err, may_block)
-dpeth_t *dep;
-int err;
-int may_block;
-{
-/*	message reply;
-	int status;
-	int r;
-
-	status = 0;
-	if (dep->de_flags &DEF_PACK_SEND)
-		status |= DL_PACK_SEND;
-	if (dep->de_flags &DEF_PACK_RECV)
-		status |= DL_PACK_RECV;
-
-	reply.m_type = DL_TASK_REPLY;
-	reply.DL_PORT = dep - de_table;
-	reply.DL_PROC = dep->de_client;
-	reply.DL_STAT = status | ((u32_t) err << 16);
-	reply.DL_COUNT = dep->de_read_s;
-	reply.DL_CLCK = 0;	*//* Don't know */
-/*	r= send(dep->de_client, &reply);
-
-	if (r == ELOCKED && may_block)
-	{
-#if 0
-		printf("send locked\n");
-#endif
-		return;
-	}
-
-	if (r < 0)
-		panic("", "dp8390: send failed:", r);
-	
-*/	dep->de_read_s = 0;
-//	dep->de_flags &= ~(DEF_PACK_SEND | DEF_PACK_RECV);
-}
-
-/*===========================================================================*
- *				get_userdata				     *
- *===========================================================================*/
-static void get_userdata(user_proc, user_addr, count, loc_addr)
-int user_proc;
-vir_bytes user_addr;
-vir_bytes count;
-void *loc_addr;
-{
-	int r;
-
-	r= sys_vircopy(user_proc, D, user_addr,
-		SELF, D, (vir_bytes)loc_addr, count);
-	if (r != OK)
-		panic("DP8390", "get_userdata: sys_vircopy failed", r);
-}
-
-static void insb(port_t port, void *buf, size_t size)
-{
-	size_t i;
-
-	for(i = 0; i < size; ++ i){
-		*((uint8_t *) buf + i) = inb(port);
-	}
-}
-
-static void insw(port_t port, void *buf, size_t size)
-{
-	size_t i;
-
-	for(i = 0; i * 2 < size; ++ i){
-		*((uint16_t *) buf + i) = inw(port);
-	}
-}
-
-static void outsb(port_t port, void *buf, size_t size)
-{
-	size_t i;
-
-	for(i = 0; i < size; ++ i){
-		outb(port, *((uint8_t *) buf + i));
-	}
-}
-
-static void outsw(port_t port, void *buf, size_t size)
-{
-	size_t i;
-
-	for(i = 0; i * 2 < size; ++ i){
-		outw(port, *((uint16_t *) buf + i));
-	}
-}
-
-/*
- * $PchId: dp8390.c,v 1.25 2005/02/10 17:32:07 philip Exp $
- */
-
-/** @}
- */
Index: uspace/srv/net/netif/dp8390/dp8390.h
===================================================================
--- uspace/srv/net/netif/dp8390/dp8390.h	(revision e417b961e64a18ae1b50d3898c8108c524af1400)
+++ 	(revision )
@@ -1,431 +1,0 @@
-/*
- * Copyright (c) 1987,1997, 2006, Vrije Universiteit, Amsterdam, The Netherlands All rights reserved. Redistribution and use of the MINIX 3 operating system in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of the Vrije Universiteit nor the names of the software authors or contributors may be used to endorse or promote products derived from this software without specific prior written permission.
- * * Any deviations from these conditions require written permission from the copyright holder in advance
- *
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, 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 COPYRIGHT HOLDER OR ANY AUTHORS 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.
- *
- * Changes:
- *  2009 ported to HelenOS, Lukas Mejdrech
- */
-
-/** @addtogroup dp8390
- *  @{
- */
-
-/** @file
- *  DP8390 network interface definitions.
- */
-
-#ifndef __NET_NETIF_DP8390_H__
-#define __NET_NETIF_DP8390_H__
-
-#include "../../structures/packet/packet.h"
-
-#include "dp8390_port.h"
-#include "local.h"
-
-/** Input/output size.
- */
-#define DP8390_IO_SIZE	0x01f
-
-/*
-dp8390.h
-
-Created:	before Dec 28, 1992 by Philip Homburg
-*/
-
-/* National Semiconductor DP8390 Network Interface Controller. */
-
-				/* Page 0, for reading ------------- */
-#define	DP_CR		0x0	/* Read side of Command Register     */
-#define	DP_CLDA0	0x1	/* Current Local Dma Address 0       */
-#define	DP_CLDA1	0x2	/* Current Local Dma Address 1       */
-#define	DP_BNRY		0x3	/* Boundary Pointer                  */
-#define	DP_TSR		0x4	/* Transmit Status Register          */
-#define	DP_NCR		0x5	/* Number of Collisions Register     */
-#define	DP_FIFO		0x6	/* Fifo ??                           */
-#define	DP_ISR		0x7	/* Interrupt Status Register         */
-#define	DP_CRDA0	0x8	/* Current Remote Dma Address 0      */
-#define	DP_CRDA1	0x9	/* Current Remote Dma Address 1      */
-#define	DP_DUM1		0xA	/* unused                            */
-#define	DP_DUM2		0xB	/* unused                            */
-#define	DP_RSR		0xC	/* Receive Status Register           */
-#define	DP_CNTR0	0xD	/* Tally Counter 0                   */
-#define	DP_CNTR1	0xE	/* Tally Counter 1                   */
-#define	DP_CNTR2	0xF	/* Tally Counter 2                   */
-
-				/* Page 0, for writing ------------- */
-#define	DP_CR		0x0	/* Write side of Command Register    */
-#define	DP_PSTART	0x1	/* Page Start Register               */
-#define	DP_PSTOP	0x2	/* Page Stop Register                */
-#define	DP_BNRY		0x3	/* Boundary Pointer                  */
-#define	DP_TPSR		0x4	/* Transmit Page Start Register      */
-#define	DP_TBCR0	0x5	/* Transmit Byte Count Register 0    */
-#define	DP_TBCR1	0x6	/* Transmit Byte Count Register 1    */
-#define	DP_ISR		0x7	/* Interrupt Status Register         */
-#define	DP_RSAR0	0x8	/* Remote Start Address Register 0   */
-#define	DP_RSAR1	0x9	/* Remote Start Address Register 1   */
-#define	DP_RBCR0	0xA	/* Remote Byte Count Register 0      */
-#define	DP_RBCR1	0xB	/* Remote Byte Count Register 1      */
-#define	DP_RCR		0xC	/* Receive Configuration Register    */
-#define	DP_TCR		0xD	/* Transmit Configuration Register   */
-#define	DP_DCR		0xE	/* Data Configuration Register       */
-#define	DP_IMR		0xF	/* Interrupt Mask Register           */
-
-				/* Page 1, read/write -------------- */
-#define	DP_CR		0x0	/* Command Register                  */
-#define	DP_PAR0		0x1	/* Physical Address Register 0       */
-#define	DP_PAR1		0x2	/* Physical Address Register 1       */
-#define	DP_PAR2		0x3	/* Physical Address Register 2       */
-#define	DP_PAR3		0x4	/* Physical Address Register 3       */
-#define	DP_PAR4		0x5	/* Physical Address Register 4       */
-#define	DP_PAR5		0x6	/* Physical Address Register 5       */
-#define	DP_CURR		0x7	/* Current Page Register             */
-#define	DP_MAR0		0x8	/* Multicast Address Register 0      */
-#define	DP_MAR1		0x9	/* Multicast Address Register 1      */
-#define	DP_MAR2		0xA	/* Multicast Address Register 2      */
-#define	DP_MAR3		0xB	/* Multicast Address Register 3      */
-#define	DP_MAR4		0xC	/* Multicast Address Register 4      */
-#define	DP_MAR5		0xD	/* Multicast Address Register 5      */
-#define	DP_MAR6		0xE	/* Multicast Address Register 6      */
-#define	DP_MAR7		0xF	/* Multicast Address Register 7      */
-
-/* Bits in dp_cr */
-#define CR_STP		0x01	/* Stop: software reset              */
-#define CR_STA		0x02	/* Start: activate NIC               */
-#define CR_TXP		0x04	/* Transmit Packet                   */
-#define CR_DMA		0x38	/* Mask for DMA control              */
-#define CR_DM_NOP	0x00	/* DMA: No Operation                 */
-#define CR_DM_RR	0x08	/* DMA: Remote Read                  */
-#define CR_DM_RW	0x10	/* DMA: Remote Write                 */
-#define CR_DM_SP	0x18	/* DMA: Send Packet                  */
-#define CR_DM_ABORT	0x20	/* DMA: Abort Remote DMA Operation   */
-#define CR_PS		0xC0	/* Mask for Page Select              */
-#define CR_PS_P0	0x00	/* Register Page 0                   */
-#define CR_PS_P1	0x40	/* Register Page 1                   */
-#define CR_PS_P2	0x80	/* Register Page 2                   */
-#define CR_PS_T1	0xC0	/* Test Mode Register Map            */
-
-/* Bits in dp_isr */
-#define ISR_PRX		0x01	/* Packet Received with no errors    */
-#define ISR_PTX		0x02	/* Packet Transmitted with no errors */
-#define ISR_RXE		0x04	/* Receive Error                     */
-#define ISR_TXE		0x08	/* Transmit Error                    */
-#define ISR_OVW		0x10	/* Overwrite Warning                 */
-#define ISR_CNT		0x20	/* Counter Overflow                  */
-#define ISR_RDC		0x40	/* Remote DMA Complete               */
-#define ISR_RST		0x80	/* Reset Status                      */
-
-/* Bits in dp_imr */
-#define IMR_PRXE	0x01	/* Packet Received iEnable           */
-#define IMR_PTXE	0x02	/* Packet Transmitted iEnable        */
-#define IMR_RXEE	0x04	/* Receive Error iEnable             */
-#define IMR_TXEE	0x08	/* Transmit Error iEnable            */
-#define IMR_OVWE	0x10	/* Overwrite Warning iEnable         */
-#define IMR_CNTE	0x20	/* Counter Overflow iEnable          */
-#define IMR_RDCE	0x40	/* DMA Complete iEnable              */
-
-/* Bits in dp_dcr */
-#define DCR_WTS		0x01	/* Word Transfer Select              */
-#define DCR_BYTEWIDE	0x00	/* WTS: byte wide transfers          */
-#define DCR_WORDWIDE	0x01	/* WTS: word wide transfers          */
-#define DCR_BOS		0x02	/* Byte Order Select                 */
-#define DCR_LTLENDIAN	0x00	/* BOS: Little Endian                */
-#define DCR_BIGENDIAN	0x02	/* BOS: Big Endian                   */
-#define DCR_LAS		0x04	/* Long Address Select               */
-#define DCR_BMS		0x08	/* Burst Mode Select
-				 * Called Loopback Select (LS) in 
-				 * later manuals. Should be set.     */
-#define DCR_AR		0x10	/* Autoinitialize Remote             */
-#define DCR_FTS		0x60	/* Fifo Threshold Select             */
-#define DCR_2BYTES	0x00	/* 2 bytes                           */
-#define DCR_4BYTES	0x40	/* 4 bytes                           */
-#define DCR_8BYTES	0x20	/* 8 bytes                           */
-#define DCR_12BYTES	0x60	/* 12 bytes                          */
-
-/* Bits in dp_tcr */
-#define TCR_CRC		0x01	/* Inhibit CRC                       */
-#define TCR_ELC		0x06	/* Encoded Loopback Control          */
-#define TCR_NORMAL	0x00	/* ELC: Normal Operation             */
-#define TCR_INTERNAL	0x02	/* ELC: Internal Loopback            */
-#define TCR_0EXTERNAL	0x04	/* ELC: External Loopback LPBK=0     */
-#define TCR_1EXTERNAL	0x06	/* ELC: External Loopback LPBK=1     */
-#define TCR_ATD		0x08	/* Auto Transmit Disable             */
-#define TCR_OFST	0x10	/* Collision Offset Enable (be nice) */
-
-/* Bits in dp_tsr */
-#define TSR_PTX		0x01	/* Packet Transmitted (without error)*/
-#define TSR_DFR		0x02	/* Transmit Deferred, reserved in
-				 * later manuals.		     */
-#define TSR_COL		0x04	/* Transmit Collided                 */
-#define TSR_ABT		0x08	/* Transmit Aborted                  */
-#define TSR_CRS		0x10	/* Carrier Sense Lost                */
-#define TSR_FU		0x20	/* FIFO Underrun                     */
-#define TSR_CDH		0x40	/* CD Heartbeat                      */
-#define TSR_OWC		0x80	/* Out of Window Collision           */
-
-/* Bits in tp_rcr */
-#define RCR_SEP		0x01	/* Save Errored Packets              */
-#define RCR_AR		0x02	/* Accept Runt Packets               */
-#define RCR_AB		0x04	/* Accept Broadcast                  */
-#define RCR_AM		0x08	/* Accept Multicast                  */
-#define RCR_PRO		0x10	/* Physical Promiscuous              */
-#define RCR_MON		0x20	/* Monitor Mode                      */
-
-/* Bits in dp_rsr */
-#define RSR_PRX		0x01	/* Packet Received Intact            */
-#define RSR_CRC		0x02	/* CRC Error                         */
-#define RSR_FAE		0x04	/* Frame Alignment Error             */
-#define RSR_FO		0x08	/* FIFO Overrun                      */
-#define RSR_MPA		0x10	/* Missed Packet                     */
-#define RSR_PHY		0x20	/* Multicast Address Match           */
-#define RSR_DIS		0x40	/* Receiver Disabled                 */
-#define RSR_DFR		0x80	/* In later manuals: Deferring       */
-
-/** Type definition of the receive header.
- */
-typedef struct dp_rcvhdr
-{
-	/** Copy of rsr.
-	 */
-	u8_t dr_status;
-	/** Pointer to next packet.
-	 */
-	u8_t dr_next;
-	/** Receive Byte Count Low.
-	 */
-	u8_t dr_rbcl;
-	/** Receive Byte Count High.
-	 */
-	u8_t dr_rbch;
-} dp_rcvhdr_t;
-
-/** Page size.
- */
-#define DP_PAGESIZE	256
-
-/* Some macros to simplify accessing the dp8390 */
-/** Reads 1 byte from the zero page register.
- *  @param[in] dep The network interface structure.
- *  @param[in] reg The register offset.
- *  @returns The read value.
- */
-#define inb_reg0(dep, reg)		(inb(dep->de_dp8390_port+reg))
-
-/** Writes 1 byte zero page register.
- *  @param[in] dep The network interface structure.
- *  @param[in] reg The register offset.
- *  @param[in] data The value to be written.
- */
-#define outb_reg0(dep, reg, data)	(outb(dep->de_dp8390_port+reg, data))
-
-/** Reads 1 byte from the first page register.
- *  @param[in] dep The network interface structure.
- *  @param[in] reg The register offset.
- *  @returns The read value.
- */
-#define inb_reg1(dep, reg)		(inb(dep->de_dp8390_port+reg))
-
-/** Writes 1 byte first page register.
- *  @param[in] dep The network interface structure.
- *  @param[in] reg The register offset.
- *  @param[in] data The value to be written.
- */
-#define outb_reg1(dep, reg, data)	(outb(dep->de_dp8390_port+reg, data))
-
-/* Software interface to the dp8390 driver */
-
-struct dpeth;
-struct iovec_dat;
-//struct iovec_dat_s;
-_PROTOTYPE(typedef void (*dp_initf_t), (struct dpeth *dep)		);
-_PROTOTYPE(typedef void (*dp_stopf_t), (struct dpeth *dep)		);
-_PROTOTYPE(typedef void (*dp_user2nicf_t), (struct dpeth *dep,
-			struct iovec_dat *iovp, vir_bytes offset,
-			int nic_addr, vir_bytes count) );
-//_PROTOTYPE(typedef void (*dp_user2nicf_s_t), (struct dpeth *dep,
-//			struct iovec_dat_s *iovp, vir_bytes offset,
-//			int nic_addr, vir_bytes count)			);
-_PROTOTYPE(typedef void (*dp_nic2userf_t), (struct dpeth *dep,
-			int nic_addr, struct iovec_dat *iovp,
-			vir_bytes offset, vir_bytes count) );
-//_PROTOTYPE(typedef void (*dp_nic2userf_s_t), (struct dpeth *dep,
-//			int nic_addr, struct iovec_dat_s *iovp,
-//			vir_bytes offset, vir_bytes count)		);
-//#if 0
-//_PROTOTYPE(typedef void (*dp_getheaderf_t), (struct dpeth *dep,
-//			int page, struct dp_rcvhdr *h, u16_t *eth_type)	);
-//#endif
-_PROTOTYPE(typedef void (*dp_getblock_t), (struct dpeth *dep,
-		int page, size_t offset, size_t size, void *dst)	);
-
-/* iovectors are handled IOVEC_NR entries at a time. */
-//#define IOVEC_NR	16
-// no vectors allowed
-#define IOVEC_NR	1
-
-/*
-typedef int irq_hook_t;
-*/
-typedef struct iovec_dat
-{
-  iovec_t iod_iovec[IOVEC_NR];
-  int iod_iovec_s;
-  // no direct process access
-  int 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	1	/* Maximum size of the send queue */
-#define SENDQ_PAGES	6	/* 6 * DP_PAGESIZE >= 1514 bytes */
-
-/** Maximum number of waiting packets to be sent or received.
- */
-#define MAX_PACKETS	4
-
-typedef struct dpeth
-{
-	/** Outgoing packets queue.
-	 */
-	packet_t packet_queue;
-	/** Outgoing packets count.
-	 */
-	int packet_count;
-
-	/** Received packets queue.
-	 */
-	packet_t received_queue;
-	/** Received packets count.
-	 */
-	int received_count;
-
-	/* The de_base_port field is the starting point of the probe.
-	 * The conf routine also fills de_linmem and de_irq. If the probe
-	 * routine knows the irq and/or memory address because they are
-	 * hardwired in the board, the probe should modify these fields.
-	 * Futhermore, the probe routine should also fill in de_initf and
-	 * de_stopf fields with the appropriate function pointers and set
-	 * de_prog_IO iff programmed I/O is to be used.
-	 */
-	port_t de_base_port;
-	phys_bytes de_linmem;
-	char *de_locmem;
-	int de_irq;
-	int de_int_pending;
-//	irq_hook_t de_hook;
-	dp_initf_t de_initf; 
-	dp_stopf_t de_stopf; 
-	int de_prog_IO;
-	char de_name[sizeof("dp8390#n")];
-
-	/* The initf function fills the following fields. Only cards that do
-	 * programmed I/O fill in the de_pata_port field.
-	 * In addition, the init routine has to fill in the sendq data
-	 * structures.
-	 */
-	ether_addr_t de_address;
-	port_t de_dp8390_port;
-	port_t de_data_port;
-	int de_16bit;
-	long de_ramsize;
-	int de_offset_page;
-	int de_startpage;
-	int de_stoppage;
-
-	/* should be here - read even for ne2k isa init... */
-	char de_pci;			/* TRUE iff PCI device */
-
-#if ENABLE_PCI
-	/* PCI config */
-//	char de_pci;			/* TRUE iff PCI device */
-//	u8_t de_pcibus;	
-//	u8_t de_pcidev;	
-//	u8_t de_pcifunc;	
-#endif
-
-	/* Do it yourself send queue */
-	struct sendq
-	{
-		int sq_filled;		/* this buffer contains a packet */
-		int sq_size;		/* with this size */
-		int sq_sendpage;	/* starting page of the buffer */
-	} de_sendq[SENDQ_NR];
-	int de_sendq_nr;
-	int de_sendq_head;		/* Enqueue at the head */
-	int de_sendq_tail;		/* Dequeue at the tail */
-
-	/* Fields for internal use by the dp8390 driver. */
-	int de_flags;
-	int de_mode;
-	eth_stat_t de_stat;
-	iovec_dat_t de_read_iovec;
-//	iovec_dat_s_t de_read_iovec_s;
-//	int de_safecopy_read;
-	iovec_dat_t de_write_iovec;
-//	iovec_dat_s_t de_write_iovec_s;
-	iovec_dat_t de_tmp_iovec;
-//	iovec_dat_s_t de_tmp_iovec_s;
-	vir_bytes de_read_s;
-//	int de_client;
-//	message de_sendmsg;
-	dp_user2nicf_t de_user2nicf; 
-//	dp_user2nicf_s_t de_user2nicf_s; 
-	dp_nic2userf_t de_nic2userf;
-//	dp_nic2userf_s_t de_nic2userf_s; 
-	dp_getblock_t de_getblockf;
-} dpeth_t;
-
-#define DEI_DEFAULT	0x8000
-
-#define DEF_EMPTY	0x000
-#define DEF_PACK_SEND	0x001
-#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 DEM_SINK	0x1
-#define DEM_ENABLED	0x2
-
-//#if !__minix_vmd
-#define debug		1	/* Standard Minix lacks debug variable */
-//#endif
-
-/*
- * $PchId: dp8390.h,v 1.10 2005/02/10 17:26:06 philip Exp $
- */
-
-#endif
-
-/** @}
- */
Index: uspace/srv/net/netif/dp8390/dp8390_drv.h
===================================================================
--- uspace/srv/net/netif/dp8390/dp8390_drv.h	(revision e417b961e64a18ae1b50d3898c8108c524af1400)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - 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.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
- */
-
-/** @addtogroup dp8390
- *  @{
- */
-
-/** @file
- *  DP8390 network interface driver interface.
- */
-
-#ifndef __NET_NETIF_DP8390_DRIVER_H__
-#define __NET_NETIF_DP8390_DRIVER_H__
-
-#include "dp8390.h"
-
-/** Initializes and/or starts the network interface.
- *  @param[in,out] dep The network interface structure.
- *  @param[in] mode The state mode.
- *  @returns EOK on success.
- *  @returns EXDEV if the network interface is disabled.
- */
-int do_init(dpeth_t *dep, int mode);
-
-/** Stops the network interface.
- *  @param[in,out] dep The network interface structure.
- */
-void do_stop(dpeth_t *dep);
-
-/** Processes the interrupt.
- *  @param[in,out] dep The network interface structure.
- *  @param[in] isr The interrupt status register.
- */
-void dp_check_ints(dpeth_t *dep, int isr);
-
-/** Probes and initializes the network interface.
- *  @param[in,out] dep The network interface structure.
- *  @returns EOK on success.
- *  @returns EXDEV if the network interface was not recognized.
- */
-int do_probe(dpeth_t * dep);
-
-/** Sends a packet.
- *  @param[in,out] dep The network interface structure.
- *  @param[in] packet The packet t be sent.
- *  @param[in] from_int The value indicating whether the sending is initialized from the interrupt handler.
- *  @returns 
- */
-int do_pwrite(dpeth_t * dep, packet_t packet, int from_int);
-
-/** Prints out network interface information.
- *  @param[in] dep The network interface structure.
- */
-void dp8390_dump(dpeth_t * dep);
-
-#endif
-
-/** @}
- */
Index: uspace/srv/net/netif/dp8390/dp8390_module.c
===================================================================
--- uspace/srv/net/netif/dp8390/dp8390_module.c	(revision e417b961e64a18ae1b50d3898c8108c524af1400)
+++ 	(revision )
@@ -1,332 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - 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.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
- */
-
-/** @addtogroup dp8390
- *  @{
- */
-
-/** @file
- *  DP8390 network interface implementation.
- */
-
-#include <assert.h>
-#include <async.h>
-#include <ddi.h>
-#include <errno.h>
-#include <malloc.h>
-//#include <stdio.h>
-#include <ipc/ipc.h>
-#include <ipc/services.h>
-
-#include "../../err.h"
-#include "../../messages.h"
-#include "../../modules.h"
-
-#include "../../structures/packet/packet_client.h"
-#include "../../structures/measured_strings.h"
-
-#include "../../include/device.h"
-#include "../../include/nil_interface.h"
-
-#include "../netif.h"
-#include "../netif_module.h"
-
-#include "dp8390.h"
-#include "dp8390_drv.h"
-#include "dp8390_port.h"
-
-/** DP8390 module name.
- */
-#define NAME	"dp8390 network interface"
-
-/** Returns the device from the interrupt call.
- *  @param[in] call The interrupt call.
- */
-#define IRQ_GET_DEVICE(call)			(device_id_t) IPC_GET_METHOD(*call)
-
-/** Returns the interrupt status register from the interrupt call.
- *  @param[in] call The interrupt call.
- */
-#define IPC_GET_ISR(call)				(int) IPC_GET_ARG2(*call)
-
-/** DP8390 kernel interrupt command sequence.
- */
-static irq_cmd_t	dp8390_cmds[] = {
-	{	.cmd = CMD_PIO_READ_8,
-		.addr = NULL,
-		.dstarg = 2
-	},
-	{
-		.cmd = CMD_PREDICATE,
-		.value = 1,
-		.srcarg = 2
-	},
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-/** DP8390 kernel interrupt code.
- */
-static irq_code_t	dp8390_code = {
-	sizeof(dp8390_cmds) / sizeof(irq_cmd_t),
-	dp8390_cmds
-};
-
-/** Network interface module global data.
- */
-netif_globals_t netif_globals;
-
-/** Prints the module name.
- *  @see NAME
- */
-void module_print_name(void);
-
-/** Handles the interrupt messages.
- *  This is the interrupt handler callback function.
- *  @param[in] iid The interrupt message identifier.
- *  @param[in] call The interrupt message.
- */
-void irq_handler(ipc_callid_t iid, ipc_call_t * call);
-
-/** Changes the network interface state.
- *  @param[in,out] device The network interface.
- *  @param[in] state The new state.
- *  @returns The new state.
- */
-int change_state(device_ref device, device_state_t state);
-
-int netif_specific_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
-	return ENOTSUP;
-}
-
-int netif_get_device_stats(device_id_t device_id, device_stats_ref stats){
-	ERROR_DECLARE;
-
-	device_ref device;
-	eth_stat_t * de_stat;
-
-	if(! stats){
-		return EBADMEM;
-	}
-	ERROR_PROPAGATE(find_device(device_id, &device));
-	de_stat = &((dpeth_t *) device->specific)->de_stat;
-	null_device_stats(stats);
-	stats->receive_errors = de_stat->ets_recvErr;
-	stats->send_errors = de_stat->ets_sendErr;
-	stats->receive_crc_errors = de_stat->ets_CRCerr;
-	stats->receive_frame_errors = de_stat->ets_frameAll;
-	stats->receive_missed_errors = de_stat->ets_missedP;
-	stats->receive_packets = de_stat->ets_packetR;
-	stats->send_packets = de_stat->ets_packetT;
-	stats->collisions = de_stat->ets_collision;
-	stats->send_aborted_errors = de_stat->ets_transAb;
-	stats->send_carrier_errors = de_stat->ets_carrSense;
-	stats->send_heartbeat_errors = de_stat->ets_CDheartbeat;
-	stats->send_window_errors = de_stat->ets_OWC;
-	return EOK;
-}
-
-void module_print_name(void){
-	printf("%s", NAME);
-}
-
-int netif_get_addr_message(device_id_t device_id, measured_string_ref address){
-	ERROR_DECLARE;
-
-	device_ref device;
-
-	if(! address){
-		return EBADMEM;
-	}
-	ERROR_PROPAGATE(find_device(device_id, &device));
-	address->value = (char *) (&((dpeth_t *) device->specific)->de_address);
-	address->length = CONVERT_SIZE(ether_addr_t, char, 1);
-	return EOK;
-}
-
-void irq_handler(ipc_callid_t iid, ipc_call_t * call)
-{
-	device_ref device;
-	dpeth_t * dep;
-	packet_t received;
-	device_id_t device_id;
-	int phone;
-
-	device_id = IRQ_GET_DEVICE(call);
-	fibril_rwlock_write_lock(&netif_globals.lock);
-	if(find_device(device_id, &device) != EOK){
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-		return;
-	}
-	dep = (dpeth_t *) device->specific;
-	if (dep->de_mode != DEM_ENABLED){
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-		return;
-	}
-	assert(dep->de_flags &DEF_ENABLED);
-	dep->de_int_pending = 0;
-//	remove debug print:
-#ifdef CONFIG_DEBUG
-	printf("I%d: 0x%x\n", device_id, IPC_GET_ISR(call));
-#endif
-	dp_check_ints(dep, IPC_GET_ISR(call));
-	if(dep->received_queue){
-		received = dep->received_queue;
-		phone = device->nil_phone;
-		dep->received_queue = NULL;
-		dep->received_count = 0;
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-//	remove debug dump:
-#ifdef CONFIG_DEBUG
-	uint8_t * data;
-	data = packet_get_data(received);
-	printf("Receiving packet:\n\tid\t= %d\n\tlength\t= %d\n\tdata\t= %.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX\n\t\t%.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX\n", packet_get_id(received), packet_get_data_length(received), data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11], data[12], data[13], data[14], data[15], data[16], data[17], data[18], data[19], data[20], data[21], data[22], data[23], data[24], data[25], data[26], data[27], data[28], data[29], data[30], data[31], data[32], data[33], data[34], data[35], data[36], data[37], data[38], data[39], data[40], data[41], data[42], data[43], data[44], data[45], data[46], data[47], data[48], data[49], data[50], data[51], data[52], data[53], data[54], data[55], data[56], data[57], data[58], data[59]);
-#endif
-		nil_received_msg(phone, device_id, received, NULL);
-	}else{
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-	}
-	ipc_answer_0(iid, EOK);
-}
-
-int netif_probe_message(device_id_t device_id, int irq, uintptr_t io){
-	ERROR_DECLARE;
-
-	device_ref device;
-	dpeth_t * dep;
-
-	device = (device_ref) malloc(sizeof(device_t));
-	if(! device){
-		return ENOMEM;
-	}
-	dep = (dpeth_t *) malloc(sizeof(dpeth_t));
-	if(! dep){
-		free(device);
-		return ENOMEM;
-	}
-	bzero(device, sizeof(device_t));
-	bzero(dep, sizeof(dpeth_t));
-	device->device_id = device_id;
-	device->nil_phone = -1;
-	device->specific = (void *) dep;
-	device->state = NETIF_STOPPED;
-	dep->de_irq = irq;
-	dep->de_mode = DEM_DISABLED;
-	//TODO address?
-	if(ERROR_OCCURRED(pio_enable((void *) io, DP8390_IO_SIZE, (void **) &dep->de_base_port))
-		|| ERROR_OCCURRED(do_probe(dep))){
-		free(dep);
-		free(device);
-		return ERROR_CODE;
-	}
-	if(ERROR_OCCURRED(device_map_add(&netif_globals.device_map, device->device_id, device))){
-		free(dep);
-		free(device);
-		return ERROR_CODE;
-	}
-	return EOK;
-}
-
-int netif_send_message(device_id_t device_id, packet_t packet, services_t sender){
-	ERROR_DECLARE;
-
-	device_ref device;
-	dpeth_t * dep;
-	packet_t next;
-
-	ERROR_PROPAGATE(find_device(device_id, &device));
-	if(device->state != NETIF_ACTIVE){
-		netif_pq_release(packet_get_id(packet));
-		return EFORWARD;
-	}
-	dep = (dpeth_t *) device->specific;
-	// process packet queue
-	do{
-		next = pq_detach(packet);
-//		remove debug dump:
-#ifdef CONFIG_DEBUG
-		uint8_t * data;
-		data = packet_get_data(packet);
-		printf("Sending packet:\n\tid\t= %d\n\tlength\t= %d\n\tdata\t= %.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX\n\t\t%.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX\n", packet_get_id(packet), packet_get_data_length(packet), data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11], data[12], data[13], data[14], data[15], data[16], data[17], data[18], data[19], data[20], data[21], data[22], data[23], data[24], data[25], data[26], data[27], data[28], data[29], data[30], data[31], data[32], data[33], data[34], data[35], data[36], data[37], data[38], data[39], data[40], data[41], data[42], data[43], data[44], data[45], data[46], data[47], data[48], data[49], data[50], data[51], data[52], data[53], data[54], data[55], data[56], data[57], data[58], data[59]);
-#endif
-		if(do_pwrite(dep, packet, FALSE) != EBUSY){
-			netif_pq_release(packet_get_id(packet));
-		}
-		packet = next;
-	}while(packet);
-	return EOK;
-}
-
-int netif_start_message(device_ref device){
-	ERROR_DECLARE;
-
-	dpeth_t * dep;
-
-	if(device->state != NETIF_ACTIVE){
-		dep = (dpeth_t *) device->specific;
-		dp8390_cmds[0].addr = (void *) (uintptr_t) (dep->de_dp8390_port + DP_ISR);
-		dp8390_cmds[2].addr = dp8390_cmds[0].addr;
-		ERROR_PROPAGATE(ipc_register_irq(dep->de_irq, device->device_id, device->device_id, &dp8390_code));
-		if(ERROR_OCCURRED(do_init(dep, DL_BROAD_REQ))){
-			ipc_unregister_irq(dep->de_irq, device->device_id);
-			return ERROR_CODE;
-		}
-		return change_state(device, NETIF_ACTIVE);
-	}
-	return EOK;
-}
-
-int netif_stop_message(device_ref device){
-	dpeth_t * dep;
-
-	if(device->state != NETIF_STOPPED){
-		dep = (dpeth_t *) device->specific;
-		do_stop(dep);
-		ipc_unregister_irq(dep->de_irq, device->device_id);
-		return change_state(device, NETIF_STOPPED);
-	}
-	return EOK;
-}
-
-int change_state(device_ref device, device_state_t state){
-	device->state = state;
-	printf("State changed to %s\n", (state == NETIF_ACTIVE) ? "ACTIVE" : "STOPPED");
-	return state;
-}
-
-int netif_initialize(void){
-	ipcarg_t phonehash;
-
-	async_set_interrupt_received(irq_handler);
-
-	return REGISTER_ME(SERVICE_DP8390, &phonehash);
-}
-
-/** @}
- */
Index: uspace/srv/net/netif/dp8390/dp8390_port.h
===================================================================
--- uspace/srv/net/netif/dp8390/dp8390_port.h	(revision e417b961e64a18ae1b50d3898c8108c524af1400)
+++ 	(revision )
@@ -1,274 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - 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.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
- */
-
-/** @addtogroup dp8390
- *  @{
- */
-
-/** @file
- *  DP8390 network interface types and structures ports.
- */
-
-#ifndef __NET_NETIF_DP8390_PORT_H__
-#define __NET_NETIF_DP8390_PORT_H__
-
-#include <errno.h>
-#include <mem.h>
-#include <stdio.h>
-#include <libarch/ddi.h>
-#include <sys/types.h>
-
-/** Macro for difining functions.
- *  @param[in] function The function type and name definition.
- *  @param[in] params The function parameters definition.
- */
-#define _PROTOTYPE(function, params) function params
-
-/** Success error code.
- */
-#define OK	EOK
-
-/** Type definition of the unsigned byte.
- */
-typedef uint8_t u8_t;
-
-/** Type definition of the unsigned short.
- */
-typedef uint16_t u16_t;
-
-/** Compares two memory blocks.
- *  @param[in] first The first memory block.
- *  @param[in] second The second memory block.
- *  @param[in] size The blocks size in bytes.
- *  @returns 0 if equeal.
- *  @returns -1 if the first is greater than the second.
- *  @returns 1 if the second is greater than the first.
- */
-#define memcmp(first, second, size)	bcmp((char *) (first), (char *) (second), (size))
-
-/** Reads 1 byte.
- *  @param[in] port The address to be read.
- *  @returns The read value.
- */
-#define inb(port)	pio_read_8((ioport8_t *) (port))
-
-/** Reads 1 word (2 bytes).
- *  @param[in] port The address to be read.
- *  @returns The read value.
- */
-#define inw(port)	pio_read_16((ioport16_t *) (port))
-
-/** Writes 1 byte.
- *  @param[in] port The address to be written.
- *  @param[in] value The value to be written.
- */
-#define outb(port, value)	pio_write_8((ioport8_t *) (port), (value))
-
-/** Writes 1 word (2 bytes).
- *  @param[in] port The address to be written.
- *  @param[in] value The value to be written.
- */
-#define outw(port, value)	pio_write_16((ioport16_t *) (port), (value))
-
-/** Prints out the driver critical error.
- *  Does not call the system panic().
- */
-#define panic(...)	printf("%s%s%d", __VA_ARGS__)
-
-/** Copies a memory block.
- *  @param proc The source process. Ignored parameter.
- *  @param src_s Ignored parameter.
- *  @param[in] src The source address.
- *  @param me The current proces. Ignored parameter.
- *  @param dst_s Ignored parameter.
- *  @param[in] dst The destination address.
- *  @param[in] bytes The block size in bytes.
- *  @returns EOK.
- */
-#define sys_vircopy(proc, src_s, src, me, dst_s, dst, bytes)	({memcpy((void *)(dst), (void *)(src), (bytes)); EOK;})
-
-/** Reads a memory block byte by byte.
- *  @param[in] port The address to be written.
- *  @param proc The source process. Ignored parameter.
- *  @param[in] dst The destination address.
- *  @param[in] bytes The block size in bytes.
- */
-#define do_vir_insb(port, proc, dst, bytes)	insb((port), (void *)(dst), (bytes))
-
-/** Reads a memory block word by word (2 bytes).
- *  @param[in] port The address to be written.
- *  @param proc The source process. Ignored parameter.
- *  @param[in] dst The destination address.
- *  @param[in] bytes The block size in bytes.
- */
-#define do_vir_insw(port, proc, dst, bytes)	insw((port), (void *)(dst), (bytes))
-
-/** Writes a memory block byte by byte.
- *  @param[in] port The address to be written.
- *  @param proc The source process. Ignored parameter.
- *  @param[in] src The source address.
- *  @param[in] bytes The block size in bytes.
- */
-#define do_vir_outsb(port, proc, src, bytes)	outsb((port), (void *)(src), (bytes))
-
-/** Writes a memory block word by word (2 bytes).
- *  @param[in] port The address to be written.
- *  @param proc The source process. Ignored parameter.
- *  @param[in] src The source address.
- *  @param[in] bytes The block size in bytes.
- */
-#define do_vir_outsw(port, proc, src, bytes)	outsw((port), (void *)(src), (bytes))
-
-/* com.h */
-/* Bits in 'DL_MODE' field of DL requests. */
-#  define DL_NOMODE		0x0
-#  define DL_PROMISC_REQ	0x2
-#  define DL_MULTI_REQ		0x4
-#  define DL_BROAD_REQ		0x8
-
-/* const.h */
-/** True value.
- */
-#define TRUE               1	/* used for turning integers into Booleans */
-
-/** False value.
- */
-#define FALSE              0	/* used for turning integers into Booleans */
-
-/** No number value.
- */
-#define NO_NUM        0x8000	/* used as numerical argument to panic() */
-
-/* devio.h */
-//typedef u16_t port_t;
-/** Type definition of a port.
- */
-typedef long port_t;
-
-/* dl_eth.h */
-/** Ethernet statistics.
- */
-typedef struct eth_stat
-{
-	/** Number of receive errors.
-	 */
-	unsigned long ets_recvErr;
-	/** Number of send error.
-	 */
-	unsigned long ets_sendErr;
-	/** Number of buffer overwrite warnings.
-	 */
-	unsigned long ets_OVW;
-	/** Number of crc errors of read.
-	 */
-	unsigned long ets_CRCerr;
-	/** Number of frames not alligned (number of bits % 8 != 0).
-	 */
-	unsigned long ets_frameAll;
-	/** Number of packets missed due to slow processing.
-	 */
-	unsigned long ets_missedP;
-	/** Number of packets received.
-	 */
-	unsigned long ets_packetR;
-	/** Number of packets transmitted.
-	 */
-	unsigned long ets_packetT;
-	/** Number of transmission defered (Tx was busy).
-	 */
-	unsigned long ets_transDef;
-	/** Number of collissions.
-	 */
-	unsigned long ets_collision;
-	/** Number of Tx aborted due to excess collisions.
-	 */
-	unsigned long ets_transAb;
-	/** Number of carrier sense lost.
-	 */
-	unsigned long ets_carrSense;
-	/** Number of FIFO underruns (processor too busy).
-	 */
-	unsigned long ets_fifoUnder;
-	/** Number of FIFO overruns (processor too busy).
-	 */
-	unsigned long ets_fifoOver;
-	/** Number of times unable to transmit collision sig.
-	 */
-	unsigned long ets_CDheartbeat;
-	/** Number of times out of window collision.
-	 */
-	unsigned long ets_OWC;
-} eth_stat_t;
-
-/* errno.h */
-/** Generic error.
- */
-#define EGENERIC     EINVAL
-
-/* ether.h */
-/** Minimum Ethernet packet size in bytes.
- */
-#define ETH_MIN_PACK_SIZE		  60
-
-/** Maximum Ethernet packet size in bytes.
- */
-#define ETH_MAX_PACK_SIZE_TAGGED	1518
-
-/** Ethernet address type definition.
- */
-typedef struct ether_addr
-{
-	/** Address data.
-	 */
-	u8_t ea_addr[6];
-} ether_addr_t;
-
-/* type.h */
-/** Type definition of the physical addresses and lengths in bytes.
- */
-typedef unsigned long phys_bytes;
-
-/** Type definition of the virtual addresses and lengths in bytes.
- */
-typedef unsigned long vir_bytes;
-
-/** Type definition of the input/output vector.
- */
-typedef struct {
-	/** Address of an I/O buffer.
-	 */
-	vir_bytes iov_addr;
-	/** Sizeof an I/O buffer.
-	 */
-	vir_bytes iov_size;
-} iovec_t;
-
-#endif
-
-/** @}
- */
Index: uspace/srv/net/netif/dp8390/local.h
===================================================================
--- uspace/srv/net/netif/dp8390/local.h	(revision e417b961e64a18ae1b50d3898c8108c524af1400)
+++ 	(revision )
@@ -1,99 +1,0 @@
-/*
- * Copyright (c) 1987,1997, 2006, Vrije Universiteit, Amsterdam, The Netherlands All rights reserved. Redistribution and use of the MINIX 3 operating system in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of the Vrije Universiteit nor the names of the software authors or contributors may be used to endorse or promote products derived from this software without specific prior written permission.
- * * Any deviations from these conditions require written permission from the copyright holder in advance
- *
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, 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 COPYRIGHT HOLDER OR ANY AUTHORS 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.
- *
- * Changes:
- *  2009 ported to HelenOS, Lukas Mejdrech
- */
-
-/** @addtogroup dp8390
- *  @{
- */
-
-/** @file
- *  Network interface probe functions.
- */
-
-#ifndef __NET_NETIF_DP8390_CONFIG_H__
-#define __NET_NETIF_DP8390_CONFIG_H__
-
-#include "dp8390_port.h"
-
-/*
-local.h
-*/
-
-/** WDETH switch.
- */
-#define ENABLE_WDETH 0
-
-/** NE2000 switch.
- */
-#define ENABLE_NE2000 1
-
-/** 3C503 switch.
- */
-#define ENABLE_3C503 0
-
-/** PCI support switch.
- */
-#define ENABLE_PCI 0
-
-struct dpeth;
-
-/* 3c503.c */
-/* * Probes a 3C503 network interface.
- *  @param[in] dep The network interface structure.
- *  @returns 1 if the NE2000 network interface is present.
- *  @returns 0 otherwise.
- */
-//_PROTOTYPE(int el2_probe, (struct dpeth*dep)				);
-
-/* ne2000.c */
-/** Probes a NE2000 or NE1000 network interface.
- *  @param[in] dep The network interface structure.
- *  @returns 1 if the NE2000 network interface is present.
- *  @returns 0 otherwise.
- */
-int ne_probe(struct dpeth * dep);
-//_PROTOTYPE(int ne_probe, (struct dpeth *dep)				);
-//_PROTOTYPE(void ne_init, (struct dpeth *dep)				);
-
-/* rtl8029.c */
-/* * Probes a RTL8029 network interface.
- *  @param[in] dep The network interface structure.
- *  @returns 1 if the NE2000 network interface is present.
- *  @returns 0 otherwise.
- */
-//_PROTOTYPE(int rtl_probe, (struct dpeth *dep)				);
-
-/* wdeth.c */
-/* * Probes a WDETH network interface.
- *  @param[in] dep The network interface structure.
- *  @returns 1 if the NE2000 network interface is present.
- *  @returns 0 otherwise.
- */
-//_PROTOTYPE(int wdeth_probe, (struct dpeth*dep)				);
-
-#endif
-
-/** @}
- */
Index: uspace/srv/net/netif/dp8390/ne2000.c
===================================================================
--- uspace/srv/net/netif/dp8390/ne2000.c	(revision e417b961e64a18ae1b50d3898c8108c524af1400)
+++ 	(revision )
@@ -1,416 +1,0 @@
-/*
- * Copyright (c) 1987,1997, 2006, Vrije Universiteit, Amsterdam, The Netherlands All rights reserved. Redistribution and use of the MINIX 3 operating system in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of the Vrije Universiteit nor the names of the software authors or contributors may be used to endorse or promote products derived from this software without specific prior written permission.
- * * Any deviations from these conditions require written permission from the copyright holder in advance
- *
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, 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 COPYRIGHT HOLDER OR ANY AUTHORS 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.
- *
- * Changes:
- *  2009 ported to HelenOS, Lukas Mejdrech
- */
-
-/** @addtogroup ne2k
- *  @{
- */
-
-/** @file
- *  NE1000 and NE2000 network interface initialization and probe functions implementation.
- */
-
-#include <stdio.h>
-#include <unistd.h>
-
-#include "dp8390_port.h"
-
-/*
-ne2000.c
-
-Driver for the ne2000 ethernet cards. This file contains only the ne2000
-specific code, the rest is in dp8390.c
-
-Created:	March 15, 1994 by Philip Homburg <philip@f-mnx.phicoh.com>
-*/
-
-//#include "../drivers.h"
-
-//#include <net/gen/ether.h>
-//#include <net/gen/eth_io.h>
-//#if __minix_vmd
-//#include "config.h"
-//#endif
-
-#include "local.h"
-#include "dp8390.h"
-#include "ne2000.h"
-
-#if ENABLE_NE2000
-
-/** Number of bytes to transfer.
- */
-#define N 100
-
-//#define MILLIS_TO_TICKS(m)  (((m)*HZ/1000)+1)
-
-/** Sleeps for the defined millicesonds.
- *  @param[in] millis The number of milliseconds to sleep.
- */
-#define milli_delay(millis)	usleep((millis) * 1000)
-
-/** Type definition of the testing function.
- */
-_PROTOTYPE(typedef int (*testf_t), (dpeth_t *dep, int pos, u8_t *pat)	);
-
-/** First data pattern.
- */
-u8_t	pat0[]= {0x00, 0x00, 0x00, 0x00};
-
-/** Second data pattern.
- */
-u8_t	pat1[]= {0xFF, 0xFF, 0xFF, 0xFF};
-
-/** Third data pattern.
- */
-u8_t	pat2[]= {0xA5, 0x5A, 0x69, 0x96};
-
-/** Fourth data pattern.
- */
-u8_t	pat3[]= {0x96, 0x69, 0x5A, 0xA5};
-
-/** Tests 8 bit NE2000 network interface.
- *  @param[in,out] dep The network interface structure.
- *  @param[in] pos The starting position.
- *  @param[in] pat The data pattern to be written.
- *  @returns True on success.
- *  @returns FALSE otherwise.
- */
-static int test_8(dpeth_t *dep, int pos, u8_t *pat);
-
-/** Tests 16 bit NE2000 network interface.
- *  @param[in,out] dep The network interface structure.
- *  @param[in] pos The starting position.
- *  @param[in] pat The data pattern to be written.
- *  @returns True on success.
- *  @returns FALSE otherwise.
- */
-static int test_16(dpeth_t *dep, int pos, u8_t *pat);
-
-/** Stops the NE2000 network interface.
- *  @param[in,out] dep The network interface structure.
- */
-static void ne_stop(dpeth_t *dep);
-//_PROTOTYPE(static void milli_delay, (unsigned long millis)		);
-
-/** Initializes the NE2000 network interface.
- *  @param[in,out] dep The network interface structure.
- */
-void ne_init(struct dpeth *dep);
-
-/*===========================================================================*
- *				ne_probe				     *
- *===========================================================================*/
-int ne_probe(dep)
-dpeth_t *dep;
-{
-	int byte;
-	int i;
-	int loc1, loc2;
-	testf_t f;
-
-	dep->de_dp8390_port= dep->de_base_port + NE_DP8390;
-
-	/* We probe for an ne1000 or an ne2000 by testing whether the
-	 * on board is reachable through the dp8390. Note that the
-	 * ne1000 is an 8bit card and has a memory region distict from
-	 * the 16bit ne2000
-	 */
-
-	for (dep->de_16bit= 0; dep->de_16bit < 2; dep->de_16bit++)
-	{
-		/* Reset the ethernet card */
-		byte= inb_ne(dep, NE_RESET);
-		milli_delay(2);
-		outb_ne(dep, NE_RESET, byte);
-		milli_delay(2);
-
-		/* Reset the dp8390 */
-		outb_reg0(dep, DP_CR, CR_STP | CR_DM_ABORT);
-		for (i= 0; i < 0x1000 && ((inb_reg0(dep, DP_ISR) &ISR_RST) == 0); i++)
-			; /* Do nothing */
-
-		/* Check if the dp8390 is really there */
-		if ((inb_reg0(dep, DP_CR) &(CR_STP|CR_DM_ABORT)) !=
-			(CR_STP|CR_DM_ABORT))
-		{
-			return 0;
-		}
-
-		/* Disable the receiver and init TCR and DCR. */
-		outb_reg0(dep, DP_RCR, RCR_MON);
-		outb_reg0(dep, DP_TCR, TCR_NORMAL);
-		if (dep->de_16bit)
-		{
-			outb_reg0(dep, DP_DCR, DCR_WORDWIDE | DCR_8BYTES |
-				DCR_BMS);
-		}
-		else
-		{
-			outb_reg0(dep, DP_DCR, DCR_BYTEWIDE | DCR_8BYTES |
-				DCR_BMS);
-		}
-
-		if (dep->de_16bit)
-		{
-			loc1= NE2000_START;
-			loc2= NE2000_START + NE2000_SIZE - 4;
-			f= test_16;
-		}
-		else
-		{
-			loc1= NE1000_START;
-			loc2= NE1000_START + NE1000_SIZE - 4;
-			f= test_8;
-		}
-		if (f(dep, loc1, pat0) && f(dep, loc1, pat1) && 
-			f(dep, loc1, pat2) && f(dep, loc1, pat3) && 
-			f(dep, loc2, pat0) && f(dep, loc2, pat1) && 
-			f(dep, loc2, pat2) && f(dep, loc2, pat3))
-		{
-			/* We don't need a memory segment */
-			dep->de_linmem= 0;
-			if (!dep->de_pci)
-				dep->de_initf= ne_init;
-			dep->de_stopf= ne_stop;
-			dep->de_prog_IO= 1;
-			return 1;
-		}
-	}
-	return 0;
-}
-
-/*===========================================================================*
- *				ne_init					     *
- *===========================================================================*/
-void ne_init(dep)
-dpeth_t *dep;
-{
-	int i;
-	int word, sendq_nr;
-
-	/* Setup a transfer to get the ethernet address. */
-	if (dep->de_16bit)
-		outb_reg0(dep, DP_RBCR0, 6*2);
-	else
-		outb_reg0(dep, DP_RBCR0, 6);
-	outb_reg0(dep, DP_RBCR1, 0);
-	outb_reg0(dep, DP_RSAR0, 0);
-	outb_reg0(dep, DP_RSAR1, 0);
-	outb_reg0(dep, DP_CR, CR_DM_RR | CR_PS_P0 | CR_STA);
-
-	for (i= 0; i<6; i++)
-	{
-		if (dep->de_16bit)
-		{
-			word= inw_ne(dep, NE_DATA);
-			dep->de_address.ea_addr[i]= word;
-		}
-		else
-		{
-			dep->de_address.ea_addr[i] = inb_ne(dep, NE_DATA);
-		}
-	}
-	dep->de_data_port= dep->de_base_port + NE_DATA;
-	if (dep->de_16bit)
-	{
-		dep->de_ramsize= NE2000_SIZE;
-		dep->de_offset_page= NE2000_START / DP_PAGESIZE;
-	}
-	else
-	{
-		dep->de_ramsize= NE1000_SIZE;
-		dep->de_offset_page= NE1000_START / DP_PAGESIZE;
-	}
-
-	/* Allocate one send buffer (1.5KB) per 8KB of on board memory. */
-	sendq_nr= dep->de_ramsize / 0x2000;
-	if (sendq_nr < 1)
-		sendq_nr= 1;
-	else if (sendq_nr > SENDQ_NR)
-		sendq_nr= SENDQ_NR;
-	dep->de_sendq_nr= sendq_nr;
-	for (i= 0; i<sendq_nr; i++)
-	{
-		dep->de_sendq[i].sq_sendpage= dep->de_offset_page +
-			i*SENDQ_PAGES;	
-	}
-
-	dep->de_startpage= dep->de_offset_page + i*SENDQ_PAGES;
-	dep->de_stoppage= dep->de_offset_page + dep->de_ramsize / DP_PAGESIZE;
-
-	/* Can't override the default IRQ. */
-	dep->de_irq &= ~DEI_DEFAULT;
-
-	if (!debug)
-	{
-		printf("%s: NE%d000 at %X:%d\n",
-			dep->de_name, dep->de_16bit ? 2 : 1,
-			dep->de_base_port, dep->de_irq);
-	}
-	else
-	{
-		printf("%s: Novell NE%d000 ethernet card at I/O address "
-			"0x%X, memory size 0x%X, irq %d\n",
-			dep->de_name, dep->de_16bit ? 2 : 1,
-			dep->de_base_port, dep->de_ramsize, dep->de_irq);
-	}
-}
-
-/*===========================================================================*
- *				test_8					     *
- *===========================================================================*/
-static int test_8(dep, pos, pat)
-dpeth_t *dep;
-int pos;
-u8_t *pat;
-{
-	u8_t buf[4];
-	int i;
-	int r;
-
-	outb_reg0(dep, DP_ISR, 0xFF);
-
-	/* Setup a transfer to put the pattern. */
-	outb_reg0(dep, DP_RBCR0, 4);
-	outb_reg0(dep, DP_RBCR1, 0);
-	outb_reg0(dep, DP_RSAR0, pos &0xFF);
-	outb_reg0(dep, DP_RSAR1, pos >> 8);
-	outb_reg0(dep, DP_CR, CR_DM_RW | CR_PS_P0 | CR_STA);
-
-	for (i= 0; i<4; i++)
-		outb_ne(dep, NE_DATA, pat[i]);
-
-	for (i= 0; i<N; i++)
-	{
-		if (inb_reg0(dep, DP_ISR) &ISR_RDC)
-			break;
-	}
-	if (i == N)
-	{
-		if (debug)
-		{
-			printf("%s: NE1000 remote DMA test failed\n",
-				dep->de_name);
-		}
-		return 0;
-	}
-
-	outb_reg0(dep, DP_RBCR0, 4);
-	outb_reg0(dep, DP_RBCR1, 0);
-	outb_reg0(dep, DP_RSAR0, pos &0xFF);
-	outb_reg0(dep, DP_RSAR1, pos >> 8);
-	outb_reg0(dep, DP_CR, CR_DM_RR | CR_PS_P0 | CR_STA);
-
-	for (i= 0; i<4; i++)
-		buf[i]= inb_ne(dep, NE_DATA);
-
-	r= (memcmp(buf, pat, 4) == 0);
-	return r;
-}
-
-/*===========================================================================*
- *				test_16					     *
- *===========================================================================*/
-static int test_16(dep, pos, pat)
-dpeth_t *dep;
-int pos;
-u8_t *pat;
-{
-	u8_t buf[4];
-	int i;
-	int r;
-
-	outb_reg0(dep, DP_ISR, 0xFF);
-
-	/* Setup a transfer to put the pattern. */
-	outb_reg0(dep, DP_RBCR0, 4);
-	outb_reg0(dep, DP_RBCR1, 0);
-	outb_reg0(dep, DP_RSAR0, pos &0xFF);
-	outb_reg0(dep, DP_RSAR1, pos >> 8);
-	outb_reg0(dep, DP_CR, CR_DM_RW | CR_PS_P0 | CR_STA);
-
-	for (i= 0; i<4; i += 2)
-	{
-		outw_ne(dep, NE_DATA, *(u16_t *)(pat+i));
-	}
-
-	for (i= 0; i<N; i++)
-	{
-		if (inb_reg0(dep, DP_ISR) &ISR_RDC)
-			break;
-	}
-	if (i == N)
-	{
-		if (debug)
-		{
-			printf("%s: NE2000 remote DMA test failed\n",
-				dep->de_name);
-		}
-		return 0;
-	}
-
-	outb_reg0(dep, DP_RBCR0, 4);
-	outb_reg0(dep, DP_RBCR1, 0);
-	outb_reg0(dep, DP_RSAR0, pos &0xFF);
-	outb_reg0(dep, DP_RSAR1, pos >> 8);
-	outb_reg0(dep, DP_CR, CR_DM_RR | CR_PS_P0 | CR_STA);
-
-	for (i= 0; i<4; i += 2)
-	{
-		*(u16_t *)(buf+i)= inw_ne(dep, NE_DATA);
-	}
-
-	r= (memcmp(buf, pat, 4) == 0);
-	return r;
-}
-
-/*===========================================================================*
- *				ne_stop					     *
- *===========================================================================*/
-static void ne_stop(dep)
-dpeth_t *dep;
-{
-	int byte;
-
-	/* Reset the ethernet card */
-	byte= inb_ne(dep, NE_RESET);
-	milli_delay(2);
-	outb_ne(dep, NE_RESET, byte);
-}
-/*
-static void milli_delay(unsigned long millis)
-{
-	tickdelay(MILLIS_TO_TICKS(millis));
-}
-*/
-#endif /* ENABLE_NE2000 */
-
-/*
- * $PchId: ne2000.c,v 1.10 2004/08/03 12:03:00 philip Exp $
- */
-
-/** @}
- */
Index: uspace/srv/net/netif/dp8390/ne2000.h
===================================================================
--- uspace/srv/net/netif/dp8390/ne2000.h	(revision e417b961e64a18ae1b50d3898c8108c524af1400)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/*
- * Copyright (c) 1987,1997, 2006, Vrije Universiteit, Amsterdam, The Netherlands All rights reserved. Redistribution and use of the MINIX 3 operating system in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of the Vrije Universiteit nor the names of the software authors or contributors may be used to endorse or promote products derived from this software without specific prior written permission.
- * * Any deviations from these conditions require written permission from the copyright holder in advance
- *
- *
- * Disclaimer
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, 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 COPYRIGHT HOLDER OR ANY AUTHORS 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.
- *
- * Changes:
- *  2009 ported to HelenOS, Lukas Mejdrech
- */
-
-/*
-ne2000.h
-
-Created:	March 15, 1994 by Philip Homburg <philip@f-mnx.phicoh.com>
-*/
-
-/** @addtogroup ne2k
- *  @{
- */
-
-/** @file
- *  NE1000 and NE2000 network interface definitions.
- */
-
-#ifndef __NET_NETIF_NE2000_H__
-#define __NET_NETIF_NE2000_H__
-
-#include <libarch/ddi.h>
-
-#include "dp8390_port.h"
-
-/** DP8390 register offset.
- */
-#define NE_DP8390	0x00
-
-/** Data register.
- */
-#define NE_DATA		0x10
-
-/** Reset register.
- */
-#define NE_RESET	0x1F
-
-/** NE1000 data start.
- */
-#define NE1000_START	0x2000
-
-/** NE1000 data size.
- */
-#define NE1000_SIZE	0x2000
-
-/** NE2000 data start.
- */
-#define NE2000_START	0x4000
-
-/** NE2000 data size.
- */
-#define NE2000_SIZE	0x4000
-
-/** Reads 1 byte register.
- *  @param[in] dep The network interface structure.
- *  @param[in] reg The register offset.
- *  @returns The read value.
- */
-#define inb_ne(dep, reg)	(inb(dep->de_base_port+reg))
-
-/** Writes 1 byte register.
- *  @param[in] dep The network interface structure.
- *  @param[in] reg The register offset.
- *  @param[in] data The value to be written.
- */
-#define outb_ne(dep, reg, data)	(outb(dep->de_base_port+reg, data))
-
-/** Reads 1 word (2 bytes) register.
- *  @param[in] dep The network interface structure.
- *  @param[in] reg The register offset.
- *  @returns The read value.
- */
-#define inw_ne(dep, reg)	(inw(dep->de_base_port+reg))
-
-/** Writes 1 word (2 bytes) register.
- *  @param[in] dep The network interface structure.
- *  @param[in] reg The register offset.
- *  @param[in] data The value to be written.
- */
-#define outw_ne(dep, reg, data)	(outw(dep->de_base_port+reg, data))
-
-#endif /* __NET_NETIF_NE2000_H__ */
-
-/*
- * $PchId: ne2000.h,v 1.4 2004/08/03 12:03:20 philip Exp $
- */
-
-/** @}
- */
Index: uspace/srv/net/netif/lo/Makefile
===================================================================
--- uspace/srv/net/netif/lo/Makefile	(revision e417b961e64a18ae1b50d3898c8108c524af1400)
+++ uspace/srv/net/netif/lo/Makefile	(revision 849ed54afbef3ad0ec3af831e93a1353f9eaaf0f)
@@ -28,38 +28,25 @@
 #
 
-NET_BASE = ../..
 USPACE_PREFIX = ../../../..
 ROOT_PATH = $(USPACE_PREFIX)/..
+LIBS = $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a
+EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include
 
 COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
 CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
 
-BINARY = lo
-
 -include $(COMMON_MAKEFILE)
 -include $(CONFIG_MAKEFILE)
 
-SOURCES = \
-	lo.c \
-	$(NET_BASE)/module.c \
-	$(NET_BASE)/modules.c \
-	$(NET_BASE)/net/net_remote.c \
-	$(NET_BASE)/netif/netif.c \
-	$(NET_BASE)/structures/measured_strings.c \
-	$(NET_BASE)/structures/packet/packet.c \
-	$(NET_BASE)/structures/packet/packet_client.c \
-	$(NET_BASE)/structures/packet/packet_remote.c
+ifeq ($(CONFIG_NETWORKING),modular)
+	BINARY = lo
+endif
 
 ifeq ($(CONFIG_NETWORKING),module)
-	SOURCES += \
-		$(NET_BASE)/nil/nildummy/nildummy.c \
-		$(NET_BASE)/netif/netif_nil_bundle.c
+	LIBRARY = liblo
 endif
 
-ifeq ($(CONFIG_NETWORKING),modular)
-	SOURCES += \
-		$(NET_BASE)/nil/nil_remote.c \
-		$(NET_BASE)/netif/netif_standalone.c
-endif
+SOURCES = \
+	lo.c
 
 include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/net/netif/lo/lo.c
===================================================================
--- uspace/srv/net/netif/lo/lo.c	(revision e417b961e64a18ae1b50d3898c8108c524af1400)
+++ uspace/srv/net/netif/lo/lo.c	(revision 849ed54afbef3ad0ec3af831e93a1353f9eaaf0f)
@@ -43,18 +43,14 @@
 #include <ipc/services.h>
 
-#include "../../err.h"
-#include "../../messages.h"
-#include "../../modules.h"
-
-#include "../../structures/measured_strings.h"
-#include "../../structures/packet/packet_client.h"
-
-#include "../../include/device.h"
-#include "../../include/nil_interface.h"
-
-#include "../../nil/nil_messages.h"
-
-#include "../netif.h"
-#include "../netif_module.h"
+#include <net_err.h>
+#include <net_messages.h>
+#include <net_modules.h>
+#include <adt/measured_strings.h>
+#include <packet/packet_client.h>
+#include <net_device.h>
+#include <nil_interface.h>
+#include <nil_messages.h>
+#include <netif.h>
+#include <netif_module.h>
 
 /** Default hardware address.
@@ -90,9 +86,4 @@
  */
 int create(device_id_t device_id, device_ref * device);
-
-/** Prints the module name.
- *  @see NAME
- */
-void module_print_name(void);
 
 int netif_specific_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
@@ -167,8 +158,4 @@
 }
 
-void module_print_name(void){
-	printf("%s", NAME);
-}
-
 int netif_probe_message(device_id_t device_id, int irq, uintptr_t io){
 	ERROR_DECLARE;
@@ -220,4 +207,72 @@
 }
 
+#ifdef CONFIG_NETWORKING_modular
+
+#include <netif_standalone.h>
+
+/** Default thread for new connections.
+ *
+ *  @param[in] iid The initial message identifier.
+ *  @param[in] icall The initial message call structure.
+ *
+ */
+static void netif_client_connection(ipc_callid_t iid, ipc_call_t * icall)
+{
+	/*
+	 * Accept the connection
+	 *  - Answer the first IPC_M_CONNECT_ME_TO call.
+	 */
+	ipc_answer_0(iid, EOK);
+	
+	while(true) {
+		ipc_call_t answer;
+		int answer_count;
+		
+		/* Clear the answer structure */
+		refresh_answer(&answer, &answer_count);
+		
+		/* Fetch the next message */
+		ipc_call_t call;
+		ipc_callid_t callid = async_get_call(&call);
+		
+		/* Process the message */
+		int res = netif_module_message(callid, &call, &answer, &answer_count);
+		
+		/* End if said to either by the message or the processing result */
+		if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP))
+			return;
+		
+		/* Answer the message */
+		answer_call(callid, res, &answer, answer_count);
+	}
+}
+
+/** Starts the module.
+ *
+ *  @param argc The count of the command line arguments. Ignored parameter.
+ *  @param argv The command line parameters. Ignored parameter.
+ *
+ *  @returns EOK on success.
+ *  @returns Other error codes as defined for each specific module start function.
+ *
+ */
+int main(int argc, char *argv[])
+{
+	ERROR_DECLARE;
+	
+	/* Print the module label */
+	printf("Task %d - %s\n", task_get_id(), NAME);
+	
+	/* Start the module */
+	if (ERROR_OCCURRED(netif_module_start(netif_client_connection))) {
+		printf(" - ERROR %i\n", ERROR_CODE);
+		return ERROR_CODE;
+	}
+	
+	return EOK;
+}
+
+#endif /* CONFIG_NETWORKING_modular */
+
 /** @}
  */
Index: uspace/srv/net/netif/netif.c
===================================================================
--- uspace/srv/net/netif/netif.c	(revision e417b961e64a18ae1b50d3898c8108c524af1400)
+++ 	(revision )
@@ -1,292 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - 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.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
- */
-
-/** @addtogroup netif
- *  @{
- */
-
-/** @file
- *  Network interface module skeleton implementation.
- *  @see netif.h
- */
-
-#include <async.h>
-#include <mem.h>
-#include <fibril_synch.h>
-#include <stdio.h>
-
-#include <ipc/ipc.h>
-#include <ipc/services.h>
-
-#include "../err.h"
-#include "../messages.h"
-#include "../modules.h"
-
-#include "../structures/packet/packet.h"
-#include "../structures/packet/packet_client.h"
-#include "../structures/measured_strings.h"
-
-#include "../include/device.h"
-#include "../include/netif_interface.h"
-#include "../include/nil_interface.h"
-
-#include "netif.h"
-#include "netif_messages.h"
-#include "netif_module.h"
-
-/** Network interface module global data.
- */
-extern netif_globals_t netif_globals;
-
-DEVICE_MAP_IMPLEMENT(device_map, device_t)
-
-/** @name Message processing functions
- */
-/*@{*/
-
-/** Registers the device notification receiver, the network interface layer module.
- *  @param[in] device_id The device identifier.
- *  @param[in] phone The network interface layer module phone.
- *  @returns EOK on success.
- *  @returns ENOENT if there is no such device.
- *  @returns ELIMIT if there is another module registered.
- */
-int register_message(device_id_t device_id, int phone);
-
-/*@}*/
-
-int netif_probe_req(int netif_phone, device_id_t device_id, int irq, int io){
-	int result;
-
-	fibril_rwlock_write_lock(&netif_globals.lock);
-	result = netif_probe_message(device_id, irq, io);
-	fibril_rwlock_write_unlock(&netif_globals.lock);
-	return result;
-}
-
-int netif_send_msg(int netif_phone, device_id_t device_id, packet_t packet, services_t sender){
-	int result;
-
-	fibril_rwlock_write_lock(&netif_globals.lock);
-	result = netif_send_message(device_id, packet, sender);
-	fibril_rwlock_write_unlock(&netif_globals.lock);
-	return result;
-}
-
-int netif_start_req(int netif_phone, device_id_t device_id){
-	ERROR_DECLARE;
-
-	device_ref device;
-	int result;
-	int phone;
-
-	fibril_rwlock_write_lock(&netif_globals.lock);
-	if(ERROR_OCCURRED(find_device(device_id, &device))){
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-		return ERROR_CODE;
-	}
-	result = netif_start_message(device);
-	if(result > NETIF_NULL){
-		phone = device->nil_phone;
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-		nil_device_state_msg(phone, device_id, result);
-		return EOK;
-	}else{
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-	}
-	return result;
-}
-
-int netif_stop_req(int netif_phone, device_id_t device_id){
-	ERROR_DECLARE;
-
-	device_ref device;
-	int result;
-	int phone;
-
-	fibril_rwlock_write_lock(&netif_globals.lock);
-	if(ERROR_OCCURRED(find_device(device_id, &device))){
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-		return ERROR_CODE;
-	}
-	result = netif_stop_message(device);
-	if(result > NETIF_NULL){
-		phone = device->nil_phone;
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-		nil_device_state_msg(phone, device_id, result);
-		return EOK;
-	}else{
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-	}
-	return result;
-}
-
-int netif_stats_req(int netif_phone, device_id_t device_id, device_stats_ref stats){
-	int res;
-
-	fibril_rwlock_read_lock(&netif_globals.lock);
-	res = netif_get_device_stats(device_id, stats);
-	fibril_rwlock_read_unlock(&netif_globals.lock);
-	return res;
-}
-
-int netif_get_addr_req(int netif_phone, device_id_t device_id, measured_string_ref * address, char ** data){
-	ERROR_DECLARE;
-
-	measured_string_t translation;
-
-	if(!(address && data)){
-		return EBADMEM;
-	}
-	fibril_rwlock_read_lock(&netif_globals.lock);
-	if(! ERROR_OCCURRED(netif_get_addr_message(device_id, &translation))){
-		*address = measured_string_copy(&translation);
-		ERROR_CODE = (*address) ? EOK : ENOMEM;
-	}
-	fibril_rwlock_read_unlock(&netif_globals.lock);
-	*data = (** address).value;
-	return ERROR_CODE;
-}
-
-int netif_bind_service(services_t service, device_id_t device_id, services_t me, async_client_conn_t receiver){
-	return EOK;
-}
-
-int find_device(device_id_t device_id, device_ref * device){
-	if(! device){
-		return EBADMEM;
-	}
-	*device = device_map_find(&netif_globals.device_map, device_id);
-	if(! * device){
-		return ENOENT;
-	}
-	if((** device).state == NETIF_NULL) return EPERM;
-	return EOK;
-}
-
-void null_device_stats(device_stats_ref stats){
-	bzero(stats, sizeof(device_stats_t));
-}
-
-int register_message(device_id_t device_id, int phone){
-	ERROR_DECLARE;
-
-	device_ref device;
-
-	ERROR_PROPAGATE(find_device(device_id, &device));
-	if(device->nil_phone > 0){
-		return ELIMIT;
-	}
-	device->nil_phone = phone;
-	printf("New receiver of the device %d registered:\n\tphone\t= %d\n", device->device_id, device->nil_phone);
-	return EOK;
-}
-
-int netif_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
-	ERROR_DECLARE;
-
-	size_t length;
-	device_stats_t stats;
-	packet_t packet;
-	measured_string_t address;
-
-//	printf("message %d - %d\n", IPC_GET_METHOD(*call), NET_NETIF_FIRST);
-	*answer_count = 0;
-	switch(IPC_GET_METHOD(*call)){
-		case IPC_M_PHONE_HUNGUP:
-			return EOK;
-		case NET_NETIF_PROBE:
-			return netif_probe_req(0, IPC_GET_DEVICE(call), NETIF_GET_IRQ(call), NETIF_GET_IO(call));
-		case IPC_M_CONNECT_TO_ME:
-			fibril_rwlock_write_lock(&netif_globals.lock);
-			ERROR_CODE = register_message(IPC_GET_DEVICE(call), IPC_GET_PHONE(call));
-			fibril_rwlock_write_unlock(&netif_globals.lock);
-			return ERROR_CODE;
-		case NET_NETIF_SEND:
-			ERROR_PROPAGATE(packet_translate(netif_globals.net_phone, &packet, IPC_GET_PACKET(call)));
-			return netif_send_msg(0, IPC_GET_DEVICE(call), packet, IPC_GET_SENDER(call));
-		case NET_NETIF_START:
-			return netif_start_req(0, IPC_GET_DEVICE(call));
-		case NET_NETIF_STATS:
-			fibril_rwlock_read_lock(&netif_globals.lock);
-			if(! ERROR_OCCURRED(async_data_read_receive(&callid, &length))){
-				if(length < sizeof(device_stats_t)){
-					ERROR_CODE = EOVERFLOW;
-				}else{
-					if(! ERROR_OCCURRED(netif_get_device_stats(IPC_GET_DEVICE(call), &stats))){
-						ERROR_CODE = async_data_read_finalize(callid, &stats, sizeof(device_stats_t));
-					}
-				}
-			}
-			fibril_rwlock_read_unlock(&netif_globals.lock);
-			return ERROR_CODE;
-		case NET_NETIF_STOP:
-			return netif_stop_req(0, IPC_GET_DEVICE(call));
-		case NET_NETIF_GET_ADDR:
-			fibril_rwlock_read_lock(&netif_globals.lock);
-			if(! ERROR_OCCURRED(netif_get_addr_message(IPC_GET_DEVICE(call), &address))){
-				ERROR_CODE = measured_strings_reply(&address, 1);
-			}
-			fibril_rwlock_read_unlock(&netif_globals.lock);
-			return ERROR_CODE;
-	}
-	return netif_specific_message(callid, call, answer, answer_count);
-}
-
-int netif_init_module(async_client_conn_t client_connection){
-	ERROR_DECLARE;
-
-	async_set_client_connection(client_connection);
-	netif_globals.net_phone = connect_to_service(SERVICE_NETWORKING);
-	device_map_initialize(&netif_globals.device_map);
-	ERROR_PROPAGATE(pm_init());
-	fibril_rwlock_initialize(&netif_globals.lock);
-	if(ERROR_OCCURRED(netif_initialize())){
-		pm_destroy();
-		return ERROR_CODE;
-	}
-	return EOK;
-}
-
-int netif_run_module(void){
-	async_manager();
-
-	pm_destroy();
-	return EOK;
-}
-
-void netif_pq_release(packet_id_t packet_id){
-	pq_release(netif_globals.net_phone, packet_id);
-}
-
-packet_t netif_packet_get_1(size_t content){
-	return packet_get_1(netif_globals.net_phone, content);
-}
-
-/** @}
- */
Index: uspace/srv/net/netif/netif.h
===================================================================
--- uspace/srv/net/netif/netif.h	(revision e417b961e64a18ae1b50d3898c8108c524af1400)
+++ 	(revision )
@@ -1,161 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - 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.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
- */
-
-/** @addtogroup netif
- *  @{
- */
-
-/** @file
- *  Network interface module skeleton.
- *  The skeleton has to be part of each network interface module.
- *  The skeleton can be also part of the module bundled with the network interface layer.
- */
-
-#ifndef __NET_NETIF_H__
-#define __NET_NETIF_H__
-
-#include <async.h>
-#include <fibril_synch.h>
-
-#include <ipc/ipc.h>
-
-#include "../err.h"
-
-#include "../include/device.h"
-
-#include "../structures/packet/packet.h"
-
-/** Network interface module skeleton global data.
- */
-typedef struct netif_globals	netif_globals_t;
-
-/** Type definition of the device specific data.
- *  @see netif_device
- */
-typedef struct netif_device	device_t;
-
-/** Type definition of the device specific data pointer.
- *  @see netif_device
- */
-typedef device_t *			device_ref;
-
-/** Device map.
- *  Maps device identifiers to the network interface device specific data.
- *  @see device.h
- */
-DEVICE_MAP_DECLARE(device_map, device_t);
-
-/** Network interface device specific data.
- */
-struct	netif_device{
-	/** Device identifier.
-	 */
-	device_id_t device_id;
-	/** Receiving network interface layer phone.
-	 */
-	int nil_phone;
-	/** Actual device state.
-	 */
-	device_state_t state;
-	/** Driver specific data.
-	 */
-	void * specific;
-};
-
-/** Network interface module skeleton global data.
- */
-struct	netif_globals{
-	/** Networking module phone.
-	 */
-	int net_phone;
-	/**	Device map.
-	 */
-	device_map_t device_map;
-	/** Safety lock.
-	 */
-	fibril_rwlock_t lock;
-};
-
-/**	Finds the device specific data.
- *  @param[in] device_id The device identifier.
- *  @param[out] device The device specific data.
- *  @returns EOK on success.
- *  @returns ENOENT if device is not found.
- *  @returns EPERM if the device is not initialized.
- */
-int find_device(device_id_t device_id, device_ref * device);
-
-/** Clears the usage statistics.
- *  @param[in] stats The usage statistics.
- */
-void null_device_stats(device_stats_ref stats);
-
-// prepared for future optimalizations
-/** Releases the given packet.
- *  @param[in] packet_id The packet identifier.
- */
-void netif_pq_release(packet_id_t packet_id);
-
-/** Allocates new packet to handle the given content size.
- *  @param[in] content The minimum content size.
- *  @returns The allocated packet.
- *  @returns NULL if there is an error.
- */
-packet_t netif_packet_get_1(size_t content);
-
-/** Processes the netif module messages.
- *  @param[in] callid The message identifier.
- *  @param[in] call The message parameters.
- *  @param[out] answer The message answer parameters.
- *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
- *  @returns EOK on success.
- *  @returns ENOTSUP if the message is not known.
- *  @returns Other error codes as defined for each specific module message function.
- *  @see netif_interface.h
- *  @see IS_NET_NETIF_MESSAGE()
- */
-int netif_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
-
-/** Initializes the netif module.
- *  The function has to be defined in each module.
- *  @param[in] client_connection The client connection functio to be registered.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for each specific module message function.
- */
-int netif_init_module(async_client_conn_t client_connection);
-
-/** Starts and maintains the netif module until terminated.
- *  @returns EOK after the module is terminated.
- */
-int netif_run_module(void);
-
-#endif
-
-/** @}
- */
-
Index: uspace/srv/net/netif/netif_messages.h
===================================================================
--- uspace/srv/net/netif/netif_messages.h	(revision e417b961e64a18ae1b50d3898c8108c524af1400)
+++ 	(revision )
@@ -1,95 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - 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.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
- */
-
-/** @addtogroup netif
- *  @{
- */
-
-/** @file
- *  Network interface common module messages.
- *  @see netif_interface.h
- */
-
-#ifndef __NET_NETIF_MESSAGES_H__
-#define __NET_NETIF_MESSAGES_H__
-
-#include <ipc/ipc.h>
-
-#include "../messages.h"
-
-/** Network interface common module messages.
- */
-typedef enum {
-	/** Probe device message.
-	 *  @see netif_probe_req()
-	 */
-	NET_NETIF_PROBE = NET_NETIF_FIRST,
-	/** Send packet message.
-	 *  @see netif_send_msg()
-	 */
-	NET_NETIF_SEND,
-	/** Start device message.
-	 *  @see netif_start_req()
-	 */
-	NET_NETIF_START,
-	/** Get device usage statistics message.
-	 *  @see netif_stats_req()
-	 */
-	NET_NETIF_STATS,
-	/** Stop device message.
-	 *  @see netif_stop_req()
-	 */
-	NET_NETIF_STOP,
-	/** Get device address message.
-	 *  @see netif_get_addr_req()
-	 */
-	NET_NETIF_GET_ADDR,
-} netif_messages;
-
-/** @name Network interface specific message parameters definitions
- */
-/*@{*/
-
-/** Returns the interrupt number message parameter.
- *  @param[in] call The message call structure.
- */
-#define NETIF_GET_IRQ(call) \
-	({int irq = (int) IPC_GET_ARG2(*call); irq;})
-
-/** Returns the input/output address message parameter.
- *  @param[in] call The message call structure.
- */
-#define NETIF_GET_IO(call) \
-	({int io = (int) IPC_GET_ARG3(*call); io;})
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/srv/net/netif/netif_module.h
===================================================================
--- uspace/srv/net/netif/netif_module.h	(revision e417b961e64a18ae1b50d3898c8108c524af1400)
+++ 	(revision )
@@ -1,126 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - 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.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
- */
-
-/** @addtogroup netif
- *  @{
- */
-
-/** @file
- *  Network interface module interface.
- *  The interface has to be implemented by each network interface module.
- *  The interface is used by the network interface module skeleton.
- */
-
-#ifndef __NET_NETIF_MODULE_H__
-#define __NET_NETIF_MODULE_H__
-
-#include <ipc/ipc.h>
-#include <ipc/services.h>
-
-#include "../structures/measured_strings.h"
-#include "../structures/packet/packet.h"
-
-#include "../include/device.h"
-
-/** Initializes the specific module.
- */
-int netif_initialize(void);
-
-/** Probes the existence of the device.
- *  @param[in] device_id The device identifier.
- *  @param[in] irq The device interrupt number.
- *  @param[in] io The device input/output address.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-int netif_probe_message(device_id_t device_id, int irq, uintptr_t io);
-
-/** Sends the packet queue.
- *  @param[in] device_id The device identifier.
- *  @param[in] packet The packet queue.
- *  @param[in] sender The sending module service.
- *  @returns EOK on success.
- *  @returns EFORWARD if the device is not active (in the NETIF_ACTIVE state).
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-int netif_send_message(device_id_t device_id, packet_t packet, services_t sender);
-
-/** Starts the device.
- *  @param[in] device The device structure.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-int netif_start_message(device_ref device);
-
-/** Stops the device.
- *  @param[in] device The device structure.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-int netif_stop_message(device_ref device);
-
-/** Returns the device local hardware address.
- *  @param[in] device_id The device identifier.
- *  @param[out] address The device local hardware address.
- *  @returns EOK on success.
- *  @returns EBADMEM if the address parameter is NULL.
- *  @returns ENOENT if there no such device.
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-int netif_get_addr_message(device_id_t device_id, measured_string_ref address);
-
-/** Processes the netif driver specific message.
- *  This function is called for uncommon messages received by the netif skeleton.
- *  @param[in] callid The message identifier.
- *  @param[in] call The message parameters.
- *  @param[out] answer The message answer parameters.
- *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
- *  @returns EOK on success.
- *  @returns ENOTSUP if the message is not known.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-int netif_specific_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
-
-/** Returns the device usage statistics.
- *  @param[in] device_id The device identifier.
- *  @param[out] stats The device usage statistics.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-int netif_get_device_stats(device_id_t device_id, device_stats_ref stats);
-
-#endif
-
-/** @}
- */
Index: uspace/srv/net/netif/netif_nil_bundle.c
===================================================================
--- uspace/srv/net/netif/netif_nil_bundle.c	(revision e417b961e64a18ae1b50d3898c8108c524af1400)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - 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.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
- */
-
-/** @addtogroup netif
- *  @{
- */
-
-/** @file
- *  Wrapper for the bundled network interface and network interface layer module.
- *  Distributes messages and initializes both module parts.
- */
-
-#include <async.h>
-
-#include <ipc/ipc.h>
-
-#include "../messages.h"
-
-#include "../structures/packet/packet.h"
-
-#include "../nil/nil_module.h"
-
-#include "netif.h"
-
-/** Network interface module global data.
- */
-extern netif_globals_t netif_globals;
-
-/** Distributes the messages between the module parts.
- *  @param[in] callid The message identifier.
- *  @param[in] call The message parameters.
- *  @param[out] answer The message answer parameters.
- *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
- *  @returns EOK on success.
- *  @returns ENOTSUP if the message is not known.
- *  @returns Other error codes as defined for each specific module message function.
- */
-int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
-
-/** Starts the bundle network interface module.
- *  Initializes the client connection serving function, initializes both module parts, registers the module service and starts the async manager, processing IPC messages in an infinite loop.
- *  @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for each specific module message function.
- */
-int module_start(async_client_conn_t client_connection);
-
-int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
-	if(IS_NET_NIL_MESSAGE(call) || (IPC_GET_METHOD(*call) == IPC_M_CONNECT_TO_ME)){
-		return nil_message(callid, call, answer, answer_count);
-	}else{
-		return netif_message(callid, call, answer, answer_count);
-	}
-}
-
-int module_start(async_client_conn_t client_connection){
-	ERROR_DECLARE;
-
-	ERROR_PROPAGATE(netif_init_module(client_connection));
-	if(ERROR_OCCURRED(nil_initialize(netif_globals.net_phone))){
-		pm_destroy();
-		return ERROR_CODE;
-	}
-	return netif_run_module();
-}
-
-/** @}
- */
Index: uspace/srv/net/netif/netif_remote.c
===================================================================
--- uspace/srv/net/netif/netif_remote.c	(revision e417b961e64a18ae1b50d3898c8108c524af1400)
+++ 	(revision )
@@ -1,89 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - 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.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
- */
-
-/** @addtogroup netif
- *  @{
- */
-
-/** @file
- *  Network interface module interface implementation for standalone remote modules.
- *  @see netif_interface.h
- */
-
-#include <ipc/services.h>
-
-#include "../modules.h"
-
-#include "../structures/measured_strings.h"
-#include "../structures/packet/packet.h"
-#include "../structures/packet/packet_client.h"
-
-#include "../include/device.h"
-#include "../include/netif_interface.h"
-
-#include "netif_messages.h"
-
-int netif_get_addr_req(int netif_phone, device_id_t device_id, measured_string_ref * address, char ** data){
-	return generic_get_addr_req(netif_phone, NET_NETIF_GET_ADDR, device_id, address, data);
-}
-
-int netif_probe_req(int netif_phone, device_id_t device_id, int irq, int io){
-	return async_req_3_0(netif_phone, NET_NETIF_PROBE, device_id, irq, io);
-}
-
-int netif_send_msg(int netif_phone, device_id_t device_id, packet_t packet, services_t sender){
-	return generic_send_msg(netif_phone, NET_NETIF_SEND, device_id, packet_get_id(packet), sender, 0);
-}
-
-int netif_start_req(int netif_phone, device_id_t device_id){
-	return async_req_1_0(netif_phone, NET_NETIF_START, device_id);
-}
-
-int netif_stop_req(int netif_phone, device_id_t device_id){
-	return async_req_1_0(netif_phone, NET_NETIF_STOP, device_id);
-}
-
-int netif_stats_req(int netif_phone, device_id_t device_id, device_stats_ref stats){
-	aid_t message_id;
-	ipcarg_t result;
-
-	if(! stats){
-		return EBADMEM;
-	}
-	message_id = async_send_1(netif_phone, NET_NETIF_STATS, (ipcarg_t) device_id, NULL);
-	async_data_read_start(netif_phone, stats, sizeof(*stats));
-	async_wait_for(message_id, &result);
-	return (int) result;
-}
-
-int netif_bind_service(services_t service, device_id_t device_id, services_t me, async_client_conn_t receiver){
-	return bind_service(service, device_id, me, 0, receiver);
-}
-
-/** @}
- */
Index: uspace/srv/net/netif/netif_standalone.c
===================================================================
--- uspace/srv/net/netif/netif_standalone.c	(revision e417b961e64a18ae1b50d3898c8108c524af1400)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - 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.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
- */
-
-/** @addtogroup netif
- *  @{
- */
-
-/** @file
- *  Wrapper for the standalone network interface module.
- */
-
-#include <async.h>
-
-#include <ipc/ipc.h>
-
-#include "netif.h"
-
-/** Delegates the messages to the netif_message() function.
- *  @param[in] callid The message identifier.
- *  @param[in] call The message parameters.
- *  @param[out] answer The message answer parameters.
- *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
- *  @returns EOK on success.
- *  @returns ENOTSUP if the message is not known.
- *  @returns Other error codes as defined for each specific module message function.
- */
-int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
-
-/** Starts the network interface module.
- *  Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop.
- *  @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for each specific module message function.
- */
-int module_start(async_client_conn_t client_connection);
-
-int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
-	return netif_message(callid, call, answer, answer_count);
-}
-
-int module_start(async_client_conn_t client_connection){
-	ERROR_DECLARE;
-
-	ERROR_PROPAGATE(netif_init_module(client_connection));
-	return netif_run_module();
-}
-
-/** @}
- */
