- apply Peter Tattam's patch to fix a DMA bug.
This commit is contained in:
parent
91cc6590b2
commit
d85b0c113f
@ -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.
|
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||||
@ -41,7 +41,7 @@ bx_ne2k_c::bx_ne2k_c(void)
|
|||||||
{
|
{
|
||||||
put("NE2K");
|
put("NE2K");
|
||||||
settype(NE2KLOG);
|
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
|
// nothing for now
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,8 +287,9 @@ bx_ne2k_c::asic_read(Bit32u offset, unsigned int io_len)
|
|||||||
// have been initialised.
|
// have been initialised.
|
||||||
//
|
//
|
||||||
if (io_len > BX_NE2K_THIS s.remote_bytes)
|
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);
|
retval = chipmem_read(BX_NE2K_THIS s.remote_dma, io_len);
|
||||||
//
|
//
|
||||||
// The 8390 bumps the address and decreases the byte count
|
// 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).
|
// the amount of data requested by the host (io_len).
|
||||||
//
|
//
|
||||||
BX_NE2K_THIS s.remote_dma += (BX_NE2K_THIS s.DCR.wdsize + 1);
|
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
|
// keep s.remote_bytes from underflowing
|
||||||
if (BX_NE2K_THIS s.remote_bytes > 1)
|
if (BX_NE2K_THIS s.remote_bytes > 1)
|
||||||
BX_NE2K_THIS s.remote_bytes -= (BX_NE2K_THIS s.DCR.wdsize + 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)
|
if (BX_NE2K_THIS s.remote_bytes == 0)
|
||||||
BX_PANIC(("ne2K: dma write, byte count 0"));
|
BX_PANIC(("ne2K: dma write, byte count 0"));
|
||||||
|
|
||||||
chipmem_write(BX_NE2K_THIS s.remote_dma, value, io_len);
|
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;
|
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;
|
BX_NE2K_THIS s.remote_bytes -= io_len;
|
||||||
if (BX_NE2K_THIS s.remote_bytes > BX_NE2K_MEMSIZ)
|
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
|
case 0x6: // FIFO
|
||||||
return (BX_NE2K_THIS s.fifo);
|
return (BX_NE2K_THIS s.fifo);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x7: // ISR
|
case 0x7: // ISR
|
||||||
return ((BX_NE2K_THIS s.ISR.reset << 7) |
|
return ((BX_NE2K_THIS s.ISR.reset << 7) |
|
||||||
(BX_NE2K_THIS s.ISR.rdma_done << 6) |
|
(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
|
// Add the pkt header + CRC to the length, and work
|
||||||
// out how many 256-byte pages the frame would occupy
|
// 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) {
|
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;
|
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
|
void
|
||||||
bx_ne2k_c::init(bx_devices_c *d)
|
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;
|
BX_NE2K_THIS devices = d;
|
||||||
|
|
||||||
|
|
||||||
|
@ -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 <peter@jazz-1.trumpet.com.au>
|
|
||||||
To: Bryce Denney <bryce@tlw.com>
|
|
||||||
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;
|
|
Loading…
Reference in New Issue
Block a user