923f7975fe
o too many changes to mention specifically, but amongst them: - better error reporting - openbsd boots, freebsd boots - new 'term' flavor, I added a textmode interface, the only drawback is that control-c is intercepted, and you must kill -9 it from another tty if it doesn't exit normally - new flavors: - debugger -> debug (for shortness) - i386 - pci - smp - net (compiles, does not yet provide networking, if anyone wants to help, I'd be ELATED to have this fixed!) - no_x11 (made it actually work) - term (make sure to use 'log: /dev/null' or something else on the cmdline, otherwise, debugging and the screen will start getting quite confusing!) - better error reporting (and no error reporting where it is not necessary; a typicall boot of cdrom28.fs is a screenful of output now) - in general, if the hardware reaches an unknown state, fail gracefully instead of calling exit(1) .. are we trying to work or are we trying to .. fail? I like working myself.
395 lines
13 KiB
Plaintext
395 lines
13 KiB
Plaintext
$OpenBSD: patch-iodev_ne2k_cc,v 1.1 2001/02/02 16:59:11 todd Exp $
|
|
--- iodev/ne2k.cc.orig Sat Mar 25 21:33:09 2000
|
|
+++ iodev/ne2k.cc Fri Oct 20 15:29:11 2000
|
|
@@ -108,7 +108,7 @@ bx_ne2k_c::write_cr(Bit32u value)
|
|
{
|
|
// Validate remote-DMA
|
|
if ((value & 0x38) == 0x00)
|
|
- bx_panic("ne2k: CR write - invalide rDMA value 0");
|
|
+ bio->printf("ne2k: CR write - invalide rDMA value 0");
|
|
|
|
// Check for s/w reset
|
|
if (value & 0x01) {
|
|
@@ -132,10 +132,10 @@ bx_ne2k_c::write_cr(Bit32u value)
|
|
// Check for start-tx
|
|
if (value & 0x04) {
|
|
if (BX_NE2K_THIS s.CR.stop || !BX_NE2K_THIS s.CR.start)
|
|
- bx_panic("ne2k: CR write - tx start, dev in reset");
|
|
+ bio->panic("ne2k: CR write - tx start, dev in reset");
|
|
|
|
if (BX_NE2K_THIS s.tx_bytes == 0)
|
|
- bx_panic("ne2k: CR write - tx start, tx bytes == 0");
|
|
+ bio->panic("ne2k: CR write - tx start, tx bytes == 0");
|
|
|
|
#ifdef notdef
|
|
// XXX debug stuff
|
|
@@ -156,7 +156,7 @@ bx_ne2k_c::write_cr(Bit32u value)
|
|
|
|
// some more debug
|
|
if (BX_NE2K_THIS s.tx_timer_active)
|
|
- bx_panic("ne2k: CR write, tx timer still active");
|
|
+ bio->panic("ne2k: CR write, tx timer still active");
|
|
|
|
// Schedule a timer to trigger a tx-complete interrupt
|
|
// The number of microseconds is the bit-time / 10.
|
|
@@ -196,7 +196,7 @@ bx_ne2k_c::chipmem_read(Bit32u address,
|
|
Bit32u retval = 0;
|
|
|
|
if ((io_len == 2) && (address & 0x1))
|
|
- bx_panic("ne2k: unaligned chipmem word read");
|
|
+ bio->panic("ne2k: unaligned chipmem word read");
|
|
|
|
// ROM'd MAC address
|
|
if ((address >=0) && (address <= 31)) {
|
|
@@ -215,7 +215,7 @@ bx_ne2k_c::chipmem_read(Bit32u address,
|
|
return (retval);
|
|
}
|
|
|
|
- bx_printf("ne2k: out-of-bounds chipmem read, %04X\n", address);
|
|
+ bio->printf("ne2k: out-of-bounds chipmem read, %04X\n", address);
|
|
|
|
return (0xff);
|
|
}
|
|
@@ -224,14 +224,14 @@ void
|
|
bx_ne2k_c::chipmem_write(Bit32u address, Bit32u value, unsigned io_len)
|
|
{
|
|
if ((io_len == 2) && (address & 0x1))
|
|
- bx_panic("ne2k: unaligned chipmem word write");
|
|
+ bio->panic("ne2k: unaligned chipmem word write");
|
|
|
|
if ((address >= BX_NE2K_MEMSTART) && (address <= BX_NE2K_MEMEND)) {
|
|
BX_NE2K_THIS s.mem[address - BX_NE2K_MEMSTART] = value & 0xff;
|
|
if (io_len == 2)
|
|
BX_NE2K_THIS s.mem[address - BX_NE2K_MEMSTART + 1] = value >> 8;
|
|
} else
|
|
- bx_printf("ne2k: out-of-bounds chipmem read, %04X\n", address);
|
|
+ bio->printf("ne2k: out-of-bounds chipmem read, %04X\n", address);
|
|
}
|
|
|
|
//
|
|
@@ -259,10 +259,10 @@ bx_ne2k_c::asic_read(Bit32u offset, unsi
|
|
// registers must have been initialised.
|
|
//
|
|
if (io_len != (1 + BX_NE2K_THIS s.DCR.wdsize))
|
|
- bx_panic("ne2k: dma read, wrong size %d", io_len);
|
|
+ bio->panic("ne2k: dma read, wrong size %d", io_len);
|
|
|
|
if (BX_NE2K_THIS s.remote_bytes == 0)
|
|
- bx_panic("ne2K: dma read, byte count 0");
|
|
+ bio->panic("ne2K: dma read, byte count 0");
|
|
|
|
retval = chipmem_read(BX_NE2K_THIS s.remote_dma, io_len);
|
|
BX_NE2K_THIS s.remote_dma += io_len;
|
|
@@ -274,7 +274,7 @@ bx_ne2k_c::asic_read(Bit32u offset, unsi
|
|
break;
|
|
|
|
default:
|
|
- bx_printf("ne2k: asic read invalid address %04x", (unsigned) offset);
|
|
+ bio->printf("ne2k: asic read invalid address %04x", (unsigned) offset);
|
|
break;
|
|
}
|
|
|
|
@@ -288,10 +288,10 @@ bx_ne2k_c::asic_write(Bit32u offset, Bit
|
|
case 0x0: // Data register - see asic_read for a description
|
|
|
|
if (io_len != (1 + BX_NE2K_THIS s.DCR.wdsize))
|
|
- bx_panic("ne2k: dma write, wrong size %d", io_len);
|
|
+ bio->panic("ne2k: dma write, wrong size %d", io_len);
|
|
|
|
if (BX_NE2K_THIS s.remote_bytes == 0)
|
|
- bx_panic("ne2K: dma write, byte count 0");
|
|
+ bio->panic("ne2K: dma write, byte count 0");
|
|
|
|
chipmem_write(BX_NE2K_THIS s.remote_dma, value, io_len);
|
|
BX_NE2K_THIS s.remote_dma += io_len;
|
|
@@ -308,7 +308,7 @@ bx_ne2k_c::asic_write(Bit32u offset, Bit
|
|
break;
|
|
|
|
default:
|
|
- bx_panic("ne2k: asic write invalid address %04x", (unsigned) offset);
|
|
+ bio->panic("ne2k: asic write invalid address %04x", (unsigned) offset);
|
|
break ;
|
|
}
|
|
}
|
|
@@ -321,7 +321,7 @@ Bit32u
|
|
bx_ne2k_c::page0_read(Bit32u offset, unsigned int io_len)
|
|
{
|
|
if (io_len > 1)
|
|
- bx_panic("ne2k: page 0 read from port %04x, len=%u\n", (unsigned) offset,
|
|
+ bio->panic("ne2k: page 0 read from port %04x, len=%u\n", (unsigned) offset,
|
|
(unsigned) io_len);
|
|
|
|
switch (offset) {
|
|
@@ -379,12 +379,12 @@ bx_ne2k_c::page0_read(Bit32u offset, uns
|
|
break;
|
|
|
|
case 0xa: // reserved
|
|
- bx_printf("ne2k: reserved read - page 0, 0xa\n");
|
|
+ bio->printf("ne2k: reserved read - page 0, 0xa\n");
|
|
return (0xff);
|
|
break;
|
|
|
|
case 0xb: // reserved
|
|
- bx_printf("ne2k: reserved read - page 0, 0xb\n");
|
|
+ bio->printf("ne2k: reserved read - page 0, 0xb\n");
|
|
return (0xff);
|
|
break;
|
|
|
|
@@ -412,7 +412,7 @@ bx_ne2k_c::page0_read(Bit32u offset, uns
|
|
break;
|
|
|
|
default:
|
|
- bx_panic("ne2k: page 0 offset %04x out of range", (unsigned) offset);
|
|
+ bio->panic("ne2k: page 0 offset %04x out of range", (unsigned) offset);
|
|
}
|
|
|
|
return(0);
|
|
@@ -422,7 +422,7 @@ void
|
|
bx_ne2k_c::page0_write(Bit32u offset, Bit32u value, unsigned io_len)
|
|
{
|
|
if (io_len > 1)
|
|
- bx_panic("ne2k: page 0 write to port %04x, len=%u\n", (unsigned) offset,
|
|
+ bio->printf("ne2k: page 0 write to port %04x, len=%u\n", (unsigned) offset,
|
|
(unsigned) io_len);
|
|
|
|
switch (offset) {
|
|
@@ -499,7 +499,7 @@ bx_ne2k_c::page0_write(Bit32u offset, Bi
|
|
case 0xc: // RCR
|
|
// Check if the reserved bits are set
|
|
if (value & 0xc0)
|
|
- bx_printf("ne2k: RCR write, reserved bits set\n");
|
|
+ bio->printf("ne2k: RCR write, reserved bits set\n");
|
|
|
|
// Set all other bit-fields
|
|
BX_NE2K_THIS s.RCR.errors_ok = ((value & 0x01) == 0x01);
|
|
@@ -511,17 +511,17 @@ bx_ne2k_c::page0_write(Bit32u offset, Bi
|
|
|
|
// Monitor bit is a little suspicious...
|
|
if (value & 0x20)
|
|
- bx_printf("ne2k: RCR write, monitor bit set!\n");
|
|
+ bio->printf("ne2k: RCR write, monitor bit set!\n");
|
|
break;
|
|
|
|
case 0xd: // TCR
|
|
// Check reserved bits
|
|
if (value & 0xe0)
|
|
- bx_panic("ne2k: TCR write, reserved bits set");
|
|
+ bio->panic("ne2k: TCR write, reserved bits set");
|
|
|
|
// Test loop mode (not supported)
|
|
if (value & 0x06) {
|
|
- bx_printf("ne2k: TCR write, loop mode not supported");
|
|
+ bio->printf("ne2k: TCR write, loop mode not supported");
|
|
BX_NE2K_THIS s.TCR.loop_cntl = (value & 0x6) >> 1;
|
|
} else {
|
|
BX_NE2K_THIS s.TCR.loop_cntl = 0;
|
|
@@ -529,11 +529,11 @@ bx_ne2k_c::page0_write(Bit32u offset, Bi
|
|
|
|
// Inhibit-CRC not supported.
|
|
if (value & 0x01)
|
|
- bx_panic("ne2k: TCR write, inhibit-CRC not supported");
|
|
+ bio->panic("ne2k: TCR write, inhibit-CRC not supported");
|
|
|
|
// Auto-transmit disable very suspicious
|
|
if (value & 0x04)
|
|
- bx_panic("ne2k: TCR write, auto transmit disable not supported");
|
|
+ bio->panic("ne2k: TCR write, auto transmit disable not supported");
|
|
|
|
// Allow collision-offset to be set, although not used
|
|
BX_NE2K_THIS s.TCR.coll_prio = ((value & 0x08) == 0x08);
|
|
@@ -541,15 +541,17 @@ bx_ne2k_c::page0_write(Bit32u offset, Bi
|
|
|
|
case 0xe: // DCR
|
|
// Don't allow loopback mode to be set
|
|
- if (!(value & 0x08))
|
|
- bx_panic("ne2k: DCR write, loopback mode selected");
|
|
+ if (!(value & 0x08)) {
|
|
+ bio->printf("ne2k: DCR write, loopback mode selected\n");
|
|
+ value -= 8;
|
|
+ }
|
|
|
|
// It is questionable to set longaddr and auto_rx, since they
|
|
// aren't supported on the ne2000. Print a warning and continue
|
|
if (value & 0x04)
|
|
- bx_printf("ne2k: DCR write - LAS set ???\n");
|
|
+ bio->printf("ne2k: DCR write - LAS set ???\n");
|
|
if (value & 0x10)
|
|
- bx_printf("ne2k: DCR write - AR set ???\n");
|
|
+ bio->printf("ne2k: DCR write - AR set ???\n");
|
|
|
|
// Set other values.
|
|
BX_NE2K_THIS s.DCR.wdsize = ((value & 0x01) == 0x01);
|
|
@@ -562,7 +564,7 @@ bx_ne2k_c::page0_write(Bit32u offset, Bi
|
|
case 0xf: // IMR
|
|
// Check for reserved bit
|
|
if (value & 0x80)
|
|
- bx_panic("ne2k: IMR write, reserved bit set");
|
|
+ bio->panic("ne2k: IMR write, reserved bit set");
|
|
|
|
// Set other values
|
|
BX_NE2K_THIS s.IMR.rx_inte = ((value & 0x01) == 0x01);
|
|
@@ -575,7 +577,7 @@ bx_ne2k_c::page0_write(Bit32u offset, Bi
|
|
break;
|
|
|
|
default:
|
|
- bx_panic("ne2k: page 0 write, bad offset %0x", offset);
|
|
+ bio->printf("ne2k: page 0 write, bad offset %0x\n", offset);
|
|
}
|
|
}
|
|
|
|
@@ -588,7 +590,7 @@ Bit32u
|
|
bx_ne2k_c::page1_read(Bit32u offset, unsigned int io_len)
|
|
{
|
|
if (io_len > 1)
|
|
- bx_panic("ne2k: page 1 read from port %04x, len=%u\n", (unsigned) offset,
|
|
+ bio->panic("ne2k: page 1 read from port %04x, len=%u\n", (unsigned) offset,
|
|
(unsigned) io_len);
|
|
|
|
switch (offset) {
|
|
@@ -620,7 +622,7 @@ bx_ne2k_c::page1_read(Bit32u offset, uns
|
|
break;
|
|
|
|
default:
|
|
- bx_panic("ne2k: page 1 r offset %04x out of range", (unsigned) offset);
|
|
+ bio->panic("ne2k: page 1 r offset %04x out of range", (unsigned) offset);
|
|
}
|
|
|
|
return (0);
|
|
@@ -659,7 +661,7 @@ bx_ne2k_c::page1_write(Bit32u offset, Bi
|
|
break;
|
|
|
|
default:
|
|
- bx_panic("ne2k: page 1 w offset %04x out of range", (unsigned) offset);
|
|
+ bio->panic("ne2k: page 1 w offset %04x out of range", (unsigned) offset);
|
|
}
|
|
}
|
|
|
|
@@ -672,7 +674,7 @@ Bit32u
|
|
bx_ne2k_c::page2_read(Bit32u offset, unsigned int io_len)
|
|
{
|
|
if (io_len > 1)
|
|
- bx_panic("ne2k: page 2 read from port %04x, len=%u\n", (unsigned) offset,
|
|
+ bio->panic("ne2k: page 2 read from port %04x, len=%u\n", (unsigned) offset,
|
|
(unsigned) io_len);
|
|
|
|
switch (offset) {
|
|
@@ -712,7 +714,7 @@ bx_ne2k_c::page2_read(Bit32u offset, uns
|
|
case 0x9:
|
|
case 0xa:
|
|
case 0xb:
|
|
- bx_printf("ne2k: reserved read - page 2, 0x%02x\n", (unsigned) offset);
|
|
+ bio->printf("ne2k: reserved read - page 2, 0x%02x\n", (unsigned) offset);
|
|
return (0xff);
|
|
break;
|
|
|
|
@@ -752,7 +754,7 @@ bx_ne2k_c::page2_read(Bit32u offset, uns
|
|
break;
|
|
|
|
default:
|
|
- bx_panic("ne2k: page 2 offset %04x out of range", (unsigned) offset);
|
|
+ bio->panic("ne2k: page 2 offset %04x out of range", (unsigned) offset);
|
|
}
|
|
|
|
return (0);
|
|
@@ -761,11 +763,11 @@ bx_ne2k_c::page2_read(Bit32u offset, uns
|
|
void
|
|
bx_ne2k_c::page2_write(Bit32u offset, Bit32u value, unsigned io_len)
|
|
{
|
|
- // Maybe all writes here should be bx_panic'd, since they
|
|
+ // Maybe all writes here should be bio->panic'd, since they
|
|
// affect internal operation, but let them through for now
|
|
// and print a warning.
|
|
if (offset != 0)
|
|
- bx_printf("ne2k: page 2 write ?\n");
|
|
+ bio->printf("ne2k: page 2 write ?\n");
|
|
|
|
switch (offset) {
|
|
case 0x0: // CR
|
|
@@ -789,7 +791,7 @@ bx_ne2k_c::page2_write(Bit32u offset, Bi
|
|
break;
|
|
|
|
case 0x4:
|
|
- bx_panic("ne2k: page 2 write to reserved offset 4");
|
|
+ bio->panic("ne2k: page 2 write to reserved offset 4");
|
|
break;
|
|
|
|
case 0x5: // Local Next-packet pointer
|
|
@@ -816,11 +818,11 @@ bx_ne2k_c::page2_write(Bit32u offset, Bi
|
|
case 0xd:
|
|
case 0xe:
|
|
case 0xf:
|
|
- bx_panic("ne2k: page 2 write to reserved offset %0x", offset);
|
|
+ bio->panic("ne2k: page 2 write to reserved offset %0x", offset);
|
|
break;
|
|
|
|
default:
|
|
- bx_panic("ne2k: page 2 write, illegal offset %0x", offset);
|
|
+ bio->panic("ne2k: page 2 write, illegal offset %0x", offset);
|
|
break;
|
|
}
|
|
}
|
|
@@ -831,14 +833,14 @@ bx_ne2k_c::page2_write(Bit32u offset, Bi
|
|
Bit32u
|
|
bx_ne2k_c::page3_read(Bit32u offset, unsigned int io_len)
|
|
{
|
|
- bx_panic("ne2k: page 3 read attempted");
|
|
+ bio->panic("ne2k: page 3 read attempted");
|
|
return (0);
|
|
}
|
|
|
|
void
|
|
bx_ne2k_c::page3_write(Bit32u offset, Bit32u value, unsigned io_len)
|
|
{
|
|
- bx_panic("ne2k: page 3 write attempted");
|
|
+ bio->panic("ne2k: page 3 write attempted");
|
|
}
|
|
|
|
//
|
|
@@ -909,7 +911,7 @@ bx_ne2k_c::read(Bit32u address, unsigned
|
|
break;
|
|
|
|
default:
|
|
- bx_panic("ne2K: unknown value of pgsel in read - %d",
|
|
+ bio->panic("ne2K: unknown value of pgsel in read - %d",
|
|
BX_NE2K_THIS s.CR.pgsel);
|
|
}
|
|
}
|
|
@@ -967,7 +969,7 @@ bx_ne2k_c::write(Bit32u address, Bit32u
|
|
break;
|
|
|
|
default:
|
|
- bx_panic("ne2K: unknown value of pgsel in write - %d",
|
|
+ bio->panic("ne2K: unknown value of pgsel in write - %d",
|
|
BX_NE2K_THIS s.CR.pgsel);
|
|
}
|
|
}
|
|
@@ -1126,7 +1128,10 @@ bx_ne2k_c::init(bx_devices_c *d)
|
|
{
|
|
BX_NE2K_THIS devices = d;
|
|
|
|
+ if(bio->getdbg().network)
|
|
+ bio->printf("bx_ne2k_c::init(*d)\n");
|
|
if (bx_options.ne2k.valid) {
|
|
+ bio->printf("bx_ne2k_c::init(*d) ne2k.valid = 1\n");
|
|
// Bring the register state into power-up state
|
|
reset_device();
|
|
|
|
@@ -1182,7 +1187,7 @@ bx_ne2k_c::init(bx_devices_c *d)
|
|
this);
|
|
|
|
if (BX_NE2K_THIS ethdev == NULL) {
|
|
- bx_printf("ne2k: could not find eth module %s - using null instead\n",
|
|
+ bio->printf("ne2k: could not find eth module %s - using null instead\n",
|
|
bx_options.ne2k.ethmod);
|
|
|
|
BX_NE2K_THIS ethdev = eth_locator_c::create("null", NULL,
|
|
@@ -1190,7 +1195,7 @@ bx_ne2k_c::init(bx_devices_c *d)
|
|
rx_handler,
|
|
this);
|
|
if (BX_NE2K_THIS ethdev == NULL)
|
|
- bx_panic("ne2k: could not locate null module\n");
|
|
+ bio->panic("ne2k: could not locate null module\n");
|
|
}
|
|
}
|
|
}
|