diff --git a/bochs/iodev/ne2k.cc b/bochs/iodev/ne2k.cc index 2987f08cb..d6d9f30b4 100644 --- a/bochs/iodev/ne2k.cc +++ b/bochs/iodev/ne2k.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: ne2k.cc,v 1.32 2002-03-09 01:05:41 bdenney Exp $ +// $Id: ne2k.cc,v 1.33 2002-04-18 00:37:09 bdenney Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -41,7 +41,7 @@ bx_ne2k_c::bx_ne2k_c(void) { put("NE2K"); settype(NE2KLOG); - BX_DEBUG(("Init $Id: ne2k.cc,v 1.32 2002-03-09 01:05:41 bdenney Exp $")); + BX_DEBUG(("Init $Id: ne2k.cc,v 1.33 2002-04-18 00:37:09 bdenney Exp $")); // nothing for now } @@ -287,8 +287,9 @@ bx_ne2k_c::asic_read(Bit32u offset, unsigned int io_len) // have been initialised. // if (io_len > BX_NE2K_THIS s.remote_bytes) - BX_PANIC(("ne2K: dma read underrun")); - + BX_PANIC(("ne2K: dma read underrun iolen=%d remote_bytes=%d",io_len,BX_NE2K_THIS s.remote_bytes)); + + //BX_INFO(("ne2k read DMA: addr=%4x remote_bytes=%d",BX_NE2K_THIS s.remote_dma,BX_NE2K_THIS s.remote_bytes)); retval = chipmem_read(BX_NE2K_THIS s.remote_dma, io_len); // // The 8390 bumps the address and decreases the byte count @@ -296,6 +297,9 @@ bx_ne2k_c::asic_read(Bit32u offset, unsigned int io_len) // the amount of data requested by the host (io_len). // BX_NE2K_THIS s.remote_dma += (BX_NE2K_THIS s.DCR.wdsize + 1); + if (BX_NE2K_THIS s.remote_dma == BX_NE2K_THIS s.page_stop << 8) { + BX_NE2K_THIS s.remote_dma = BX_NE2K_THIS s.page_start << 8; + } // keep s.remote_bytes from underflowing if (BX_NE2K_THIS s.remote_bytes > 1) BX_NE2K_THIS s.remote_bytes -= (BX_NE2K_THIS s.DCR.wdsize + 1); @@ -337,9 +341,13 @@ bx_ne2k_c::asic_write(Bit32u offset, Bit32u value, unsigned io_len) if (BX_NE2K_THIS s.remote_bytes == 0) BX_PANIC(("ne2K: dma write, byte count 0")); - + chipmem_write(BX_NE2K_THIS s.remote_dma, value, io_len); + // is this right ??? asic_read uses DCR.wordsize BX_NE2K_THIS s.remote_dma += io_len; + if (BX_NE2K_THIS s.remote_dma == BX_NE2K_THIS s.page_stop << 8) { + BX_NE2K_THIS s.remote_dma = BX_NE2K_THIS s.page_start << 8; + } BX_NE2K_THIS s.remote_bytes -= io_len; if (BX_NE2K_THIS s.remote_bytes > BX_NE2K_MEMSIZ) @@ -414,7 +422,7 @@ bx_ne2k_c::page0_read(Bit32u offset, unsigned int io_len) case 0x6: // FIFO return (BX_NE2K_THIS s.fifo); break; - + case 0x7: // ISR return ((BX_NE2K_THIS s.ISR.reset << 7) | (BX_NE2K_THIS s.ISR.rdma_done << 6) | @@ -1135,7 +1143,7 @@ bx_ne2k_c::rx_frame(const void *buf, unsigned io_len) // Add the pkt header + CRC to the length, and work // out how many 256-byte pages the frame would occupy - pages = (io_len + 4 + 4)/256 + 1; + pages = (io_len + 4 + 4 + 255)/256; if (BX_NE2K_THIS s.curr_page < BX_NE2K_THIS s.bound_ptr) { avail = BX_NE2K_THIS s.bound_ptr - BX_NE2K_THIS s.curr_page; @@ -1235,7 +1243,7 @@ bx_ne2k_c::rx_frame(const void *buf, unsigned io_len) void bx_ne2k_c::init(bx_devices_c *d) { - BX_DEBUG(("Init $Id: ne2k.cc,v 1.32 2002-03-09 01:05:41 bdenney Exp $")); + BX_DEBUG(("Init $Id: ne2k.cc,v 1.33 2002-04-18 00:37:09 bdenney Exp $")); BX_NE2K_THIS devices = d; diff --git a/bochs/patches/patch.ne2k-dmabug b/bochs/patches/patch.ne2k-dmabug deleted file mode 100644 index b62364b63..000000000 --- a/bochs/patches/patch.ne2k-dmabug +++ /dev/null @@ -1,69 +0,0 @@ -From peter@jazz-1.trumpet.com.au Fri Apr 5 11:11:38 2002 -Date: Fri, 5 Apr 2002 20:29:27 +1000 (EST) -From: Peter Tattam -To: Bryce Denney -Subject: ne2k patch - -[Bryce turned this patch into a unified diff style thing.] - - -RCS file: /cvsroot/bochs/bochs/iodev/ne2k.cc,v -retrieving revision 1.32 -diff -u -r1.32 ne2k.cc ---- iodev/ne2k.cc 9 Mar 2002 01:05:41 -0000 1.32 -+++ iodev/ne2k.cc 5 Apr 2002 16:15:00 -0000 -@@ -287,8 +287,9 @@ - // have been initialised. - // - if (io_len > BX_NE2K_THIS s.remote_bytes) -- BX_PANIC(("ne2K: dma read underrun")); -- -+ BX_PANIC(("ne2K: dma read underrun iolen=%d remote_bytes=%d",io_len,BX_NE2K_THIS s.remote_bytes)); -+ -+ //BX_INFO(("ne2k read DMA: addr=%4x remote_bytes=%d",BX_NE2K_THIS s.remote_dma,BX_NE2K_THIS s.remote_bytes)); - retval = chipmem_read(BX_NE2K_THIS s.remote_dma, io_len); - // - // The 8390 bumps the address and decreases the byte count -@@ -296,6 +297,9 @@ - // the amount of data requested by the host (io_len). - // - BX_NE2K_THIS s.remote_dma += (BX_NE2K_THIS s.DCR.wdsize + 1); -+ if (BX_NE2K_THIS s.remote_dma == BX_NE2K_THIS s.page_stop << 8) { -+ BX_NE2K_THIS s.remote_dma = BX_NE2K_THIS s.page_start << 8; -+ } - // keep s.remote_bytes from underflowing - if (BX_NE2K_THIS s.remote_bytes > 1) - BX_NE2K_THIS s.remote_bytes -= (BX_NE2K_THIS s.DCR.wdsize + 1); -@@ -337,9 +341,13 @@ - - if (BX_NE2K_THIS s.remote_bytes == 0) - BX_PANIC(("ne2K: dma write, byte count 0")); -- -+ - chipmem_write(BX_NE2K_THIS s.remote_dma, value, io_len); -+ // is this right ??? asic_read uses DCR.wordsize - BX_NE2K_THIS s.remote_dma += io_len; -+ if (BX_NE2K_THIS s.remote_dma == BX_NE2K_THIS s.page_stop << 8) { -+ BX_NE2K_THIS s.remote_dma = BX_NE2K_THIS s.page_start << 8; -+ } - - BX_NE2K_THIS s.remote_bytes -= io_len; - if (BX_NE2K_THIS s.remote_bytes > BX_NE2K_MEMSIZ) -@@ -414,7 +422,7 @@ - case 0x6: // FIFO - return (BX_NE2K_THIS s.fifo); - break; -- -+ - case 0x7: // ISR - return ((BX_NE2K_THIS s.ISR.reset << 7) | - (BX_NE2K_THIS s.ISR.rdma_done << 6) | -@@ -1135,7 +1143,7 @@ - - // Add the pkt header + CRC to the length, and work - // out how many 256-byte pages the frame would occupy -- pages = (io_len + 4 + 4)/256 + 1; -+ pages = (io_len + 4 + 4 + 255)/256; - - if (BX_NE2K_THIS s.curr_page < BX_NE2K_THIS s.bound_ptr) { - avail = BX_NE2K_THIS s.bound_ptr - BX_NE2K_THIS s.curr_page;