From 2528a0695405dacd515cc1e61066b52fc3bdf891 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Wed, 17 Dec 2008 01:20:15 +0000 Subject: [PATCH] bugfix for lance. works in vmware now. --- drivers/lance/lance.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/lance/lance.c b/drivers/lance/lance.c index 72401f0b1..c1aaf40b8 100644 --- a/drivers/lance/lance.c +++ b/drivers/lance/lance.c @@ -193,8 +193,10 @@ unsigned long vir2phys( unsigned long x ) int r; unsigned long value; - if ( (r=sys_umap( SELF, VM_D, x, 4, &value )) != OK ) + if ( (r=sys_umap( SELF, VM_D, x, 4, &value )) != OK ) { + printf("lance: umap of 0x%lx failed\n",x ); panic( "lance", "sys_umap failed", r ); + } return value; } @@ -305,7 +307,8 @@ static int cur_tx_slot_nr = 0; /* Tx-slot number */ static char isstored[TX_RING_SIZE]; /* Tx-slot in-use */ static char *progname; - +phys_bytes lance_buf_phys; + /*===========================================================================* * lance_task * *===========================================================================*/ @@ -494,6 +497,11 @@ message *mp; pci_init(); + if(!lance_buf && !(lance_buf = alloc_contig(LANCE_BUF_SIZE, AC_ALIGN4K|AC_LOWER16M, &lance_buf_phys))) { + panic( "lance", "alloc_contig failed", LANCE_BUF_SIZE); + } + printf("lance buf: v 0x%lx ph 0x%lx\n", lance_buf, lance_buf_phys); + port = mp->DL_PORT; if (port < 0 || port >= EC_PORT_NR_MAX) { @@ -1679,15 +1687,12 @@ static void lance_init_card(ec) ether_card_t *ec; { int i; - Address l; + Address l = lance_buf; unsigned short ioaddr = ec->ec_port; /* ============= setup init_block(cf. lance_probe1) ================ */ /* make sure data structure is 8-byte aligned and below 16MB (for DMA) */ - assert(!lance_buf); - if(!(lance_buf = alloc_contig(LANCE_BUF_SIZE, AC_ALIGN4K|AC_LOWER16M, &l))) { - panic( "lance", "alloc_contig failed", LANCE_BUF_SIZE); - } + lp = (struct lance_interface *)l; lp->init_block.mode = 0x3; /* disable Rx and Tx */ lp->init_block.filter[0] = lp->init_block.filter[1] = 0x0; -- 2.44.0