- pci irq routing implemented (used by ne2k-pci)
- ne2k: fixed word writes to page 0 reg 0x0f
This commit is contained in:
parent
ae180cc46a
commit
8edad22893
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: devices.cc,v 1.72 2004-06-27 18:23:00 vruppert Exp $
|
||||
// $Id: devices.cc,v 1.73 2004-07-01 22:18:20 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -54,7 +54,7 @@ bx_devices_c::bx_devices_c(void)
|
||||
write_port_to_handler = NULL;
|
||||
#if BX_PCI_SUPPORT
|
||||
pluginPciBridge = &stubPci;
|
||||
pluginPci2IsaBridge = NULL;
|
||||
pluginPci2IsaBridge = &stubPci2Isa;
|
||||
pluginPciIdeController = NULL;
|
||||
#if BX_PCI_VGA_SUPPORT
|
||||
pluginPciVgaAdapter = NULL;
|
||||
@ -106,7 +106,7 @@ bx_devices_c::init(BX_MEM_C *newmem)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
BX_DEBUG(("Init $Id: devices.cc,v 1.72 2004-06-27 18:23:00 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: devices.cc,v 1.73 2004-07-01 22:18:20 vruppert Exp $"));
|
||||
mem = newmem;
|
||||
|
||||
/* set no-default handlers, will be overwritten by the real default handler */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: iodev.h,v 1.44 2004-06-29 19:24:31 vruppert Exp $
|
||||
// $Id: iodev.h,v 1.45 2004-07-01 22:18:20 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -271,6 +271,13 @@ class BOCHSAPI bx_pci_stub_c : public bx_devmodel_c {
|
||||
virtual void print_i440fx_state(void) {}
|
||||
};
|
||||
|
||||
class BOCHSAPI bx_pci2isa_stub_c : public bx_devmodel_c {
|
||||
public:
|
||||
virtual void pci_set_irq (unsigned line, bx_bool level) {
|
||||
STUBFUNC(pci2isa, pci_set_irq);
|
||||
}
|
||||
};
|
||||
|
||||
class BOCHSAPI bx_ne2k_stub_c : public bx_devmodel_c {
|
||||
public:
|
||||
virtual void print_info(FILE *file, int page, int reg, int nodups) {}
|
||||
@ -326,7 +333,7 @@ public:
|
||||
bx_devmodel_c *pluginBiosDevice;
|
||||
bx_ioapic_c *ioapic;
|
||||
bx_pci_stub_c *pluginPciBridge;
|
||||
bx_devmodel_c *pluginPci2IsaBridge;
|
||||
bx_pci2isa_stub_c *pluginPci2IsaBridge;
|
||||
bx_devmodel_c *pluginPciIdeController;
|
||||
bx_devmodel_c *pluginPciVgaAdapter;
|
||||
bx_devmodel_c *pluginPciDevAdapter;
|
||||
@ -363,6 +370,7 @@ public:
|
||||
bx_floppy_stub_c stubFloppy;
|
||||
bx_vga_stub_c stubVga;
|
||||
bx_pci_stub_c stubPci;
|
||||
bx_pci2isa_stub_c stubPci2Isa;
|
||||
bx_ne2k_stub_c stubNE2k;
|
||||
bx_speaker_stub_c stubSpeaker;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: ne2k.cc,v 1.61 2004-06-29 19:24:32 vruppert Exp $
|
||||
// $Id: ne2k.cc,v 1.62 2004-07-01 22:18:20 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -116,7 +116,8 @@ bx_ne2k_c::reset(unsigned type)
|
||||
BX_NE2K_THIS s.CR.rdma_cmd = 4;
|
||||
BX_NE2K_THIS s.ISR.reset = 1;
|
||||
BX_NE2K_THIS s.DCR.longaddr = 1;
|
||||
DEV_pic_lower_irq(BX_NE2K_THIS s.base_irq);
|
||||
|
||||
set_irq_level(0);
|
||||
}
|
||||
|
||||
//
|
||||
@ -544,7 +545,9 @@ bx_ne2k_c::page0_write(Bit32u offset, Bit32u value, unsigned io_len)
|
||||
// break up outw into two outb's
|
||||
if (io_len == 2) {
|
||||
page0_write(offset, (value & 0xff), 1);
|
||||
page0_write(offset + 1, ((value >> 8) & 0xff), 1);
|
||||
if (offset < 0x0f) {
|
||||
page0_write(offset + 1, ((value >> 8) & 0xff), 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1285,7 +1288,7 @@ bx_ne2k_c::init(void)
|
||||
{
|
||||
char devname[16];
|
||||
|
||||
BX_DEBUG(("Init $Id: ne2k.cc,v 1.61 2004-06-29 19:24:32 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: ne2k.cc,v 1.62 2004-07-01 22:18:20 vruppert Exp $"));
|
||||
|
||||
// Read in values from config file
|
||||
BX_NE2K_THIS s.base_address = bx_options.ne2k.Oioaddr->get ();
|
||||
@ -1317,7 +1320,7 @@ bx_ne2k_c::init(void)
|
||||
BX_NE2K_THIS s.pci_conf[0x10] = (BX_NE2K_THIS s.base_address & 0xe0) | 0x01;
|
||||
BX_NE2K_THIS s.pci_conf[0x11] = BX_NE2K_THIS s.base_address >> 8;
|
||||
BX_NE2K_THIS s.pci_conf[0x3c] = BX_NE2K_THIS s.base_irq;
|
||||
BX_NE2K_THIS s.pci_conf[0x3d] = 0x01;
|
||||
BX_NE2K_THIS s.pci_conf[0x3d] = BX_PCI_PIRQD;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1327,7 +1330,9 @@ bx_ne2k_c::init(void)
|
||||
0,0, "ne2k"); // one-shot, inactive
|
||||
}
|
||||
// Register the IRQ and i/o port addresses
|
||||
DEV_register_irq(BX_NE2K_THIS s.base_irq, "NE2000 ethernet NIC");
|
||||
if (!BX_NE2K_THIS s.pci_enabled) {
|
||||
DEV_register_irq(BX_NE2K_THIS s.base_irq, "NE2000 ethernet NIC");
|
||||
}
|
||||
|
||||
DEV_register_ioread_handler_range(BX_NE2K_THIS_PTR, read_handler,
|
||||
BX_NE2K_THIS s.base_address,
|
||||
@ -1403,6 +1408,20 @@ bx_ne2k_c::init(void)
|
||||
theNE2kDevice->reset(BX_RESET_HARDWARE);
|
||||
}
|
||||
|
||||
void
|
||||
bx_ne2k_c::set_irq_level(bx_bool level)
|
||||
{
|
||||
if (BX_NE2K_THIS s.pci_enabled) {
|
||||
DEV_pci_set_irq(BX_NE2K_THIS s.pci_conf[0x3d], level);
|
||||
} else {
|
||||
if (level) {
|
||||
DEV_pic_raise_irq(BX_NE2K_THIS s.base_irq);
|
||||
} else {
|
||||
DEV_pic_lower_irq(BX_NE2K_THIS s.base_irq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if BX_PCI_SUPPORT
|
||||
|
||||
// static pci configuration space read callback handler
|
||||
@ -1483,16 +1502,6 @@ bx_ne2k_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
|
||||
baseaddr_change = (value8 != oldval);
|
||||
case 0x3c:
|
||||
value &= 0x0f;
|
||||
if (BX_NE2K_THIS s.base_irq > 0) {
|
||||
DEV_unregister_irq(BX_NE2K_THIS s.base_irq, "NE2000 ethernet NIC");
|
||||
}
|
||||
if ((value > 2) && (value < 12)) {
|
||||
BX_NE2K_THIS s.base_irq = value;
|
||||
BX_INFO(("new irq: %d", BX_NE2K_THIS s.base_irq));
|
||||
DEV_register_irq(BX_NE2K_THIS s.base_irq, "NE2000 ethernet NIC");
|
||||
} else {
|
||||
BX_NE2K_THIS s.base_irq = 0;
|
||||
}
|
||||
default:
|
||||
BX_NE2K_THIS s.pci_conf[address+i] = value8;
|
||||
BX_DEBUG(("NE2000 PCI NIC write register 0x%02x value 0x%02x", address,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: ne2k.h,v 1.12 2004-06-27 18:23:00 vruppert Exp $
|
||||
// $Id: ne2k.h,v 1.13 2004-07-01 22:18:20 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -215,6 +215,7 @@ private:
|
||||
|
||||
BX_NE2K_SMF Bit32u read_cr(void);
|
||||
BX_NE2K_SMF void write_cr(Bit32u value);
|
||||
BX_NE2K_SMF void set_irq_level(bx_bool level);
|
||||
|
||||
BX_NE2K_SMF Bit32u chipmem_read(Bit32u address, unsigned io_len) BX_CPP_AttrRegparmN(2);
|
||||
BX_NE2K_SMF Bit32u asic_read(Bit32u offset, unsigned io_len) BX_CPP_AttrRegparmN(2);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pci.h,v 1.16 2004-06-29 19:24:34 vruppert Exp $
|
||||
// $Id: pci.h,v 1.17 2004-07-01 22:18:20 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -41,6 +41,11 @@ typedef void (*bx_pci_write_handler_t)(void *, Bit8u, Bit32u, unsigned);
|
||||
#endif
|
||||
|
||||
|
||||
#define BX_PCI_PIRQA 1
|
||||
#define BX_PCI_PIRQB 2
|
||||
#define BX_PCI_PIRQC 3
|
||||
#define BX_PCI_PIRQD 4
|
||||
|
||||
typedef struct {
|
||||
Bit32u confAddr;
|
||||
Bit32u confData;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pci2isa.cc,v 1.13 2004-06-29 19:24:34 vruppert Exp $
|
||||
// $Id: pci2isa.cc,v 1.14 2004-07-01 22:18:20 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -140,6 +140,18 @@ bx_pci2isa_c::reset(unsigned type)
|
||||
BX_P2I_THIS s.elcr2 = 0x00;
|
||||
}
|
||||
|
||||
void
|
||||
bx_pci2isa_c::pci_set_irq(unsigned line, bx_bool level)
|
||||
{
|
||||
Bit8u isa_irq =BX_P2I_THIS s.pci_conf[0x60+line-1];
|
||||
if (isa_irq < 16) {
|
||||
if (level == 1) {
|
||||
DEV_pic_raise_irq(isa_irq);
|
||||
} else {
|
||||
DEV_pic_lower_irq(isa_irq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// static IO port read callback handler
|
||||
@ -286,6 +298,20 @@ bx_pci2isa_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
|
||||
switch (address+i) {
|
||||
case 0x06:
|
||||
break;
|
||||
case 0x60:
|
||||
case 0x61:
|
||||
case 0x62:
|
||||
case 0x63:
|
||||
if (value8 != BX_P2I_THIS s.pci_conf[address+i]) {
|
||||
if (BX_P2I_THIS s.pci_conf[address+i] < 16) {
|
||||
DEV_unregister_irq(BX_P2I_THIS s.pci_conf[address+i], "PIIX3 IRQ routing");
|
||||
}
|
||||
if (value8 < 16) {
|
||||
DEV_register_irq(value8, "PIIX3 IRQ routing");
|
||||
}
|
||||
BX_INFO(("PCI IRQ routing: PIRQ%c# set to 0x%02x", address+i-31,
|
||||
value8));
|
||||
}
|
||||
default:
|
||||
BX_P2I_THIS s.pci_conf[address+i] = value8;
|
||||
BX_DEBUG(("PIIX3 PCI-to-ISA write register 0x%02x value 0x%02x", address,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pci2isa.h,v 1.4 2002-11-09 20:51:40 vruppert Exp $
|
||||
// $Id: pci2isa.h,v 1.5 2004-07-01 22:18:20 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -34,13 +34,14 @@
|
||||
#endif
|
||||
|
||||
|
||||
class bx_pci2isa_c : public bx_devmodel_c {
|
||||
class bx_pci2isa_c : public bx_pci2isa_stub_c {
|
||||
|
||||
public:
|
||||
bx_pci2isa_c(void);
|
||||
~bx_pci2isa_c(void);
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
virtual void pci_set_irq(unsigned line, bx_bool level);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pciusb.cc,v 1.5 2004-06-29 19:24:34 vruppert Exp $
|
||||
// $Id: pciusb.cc,v 1.6 2004-07-01 22:18:20 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2003 MandrakeSoft S.A.
|
||||
@ -133,7 +133,7 @@ bx_pciusb_c::reset(unsigned type)
|
||||
{ 0x21, (bx_options.usb[0].Oioaddr->get() >> 8) },
|
||||
{ 0x22, 0x00 }, { 0x23, 0x00 },
|
||||
{ 0x3c, bx_options.usb[0].Oirq->get() }, // IRQ
|
||||
{ 0x3d, 0x04 }, // INT
|
||||
{ 0x3d, BX_PCI_PIRQD }, // INT
|
||||
{ 0x6a, 0x01 }, // USB clock
|
||||
{ 0xc1, 0x20 } // PIRQ enable
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: plugin.h,v 1.26 2004-06-29 19:24:28 vruppert Exp $
|
||||
// $Id: plugin.h,v 1.27 2004-07-01 22:18:20 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This file provides macros and types needed for plugins. It is based on
|
||||
@ -175,6 +175,7 @@ extern "C" {
|
||||
#define DEV_register_pci_handlers(b,c,d,e,f,g) \
|
||||
(bx_devices.pluginPciBridge->register_pci_handlers(b,c,d,e,f,g))
|
||||
#define DEV_is_pci_device(name) bx_devices.pluginPciBridge->is_pci_device(name)
|
||||
#define DEV_pci_set_irq(a,b) (bx_devices.pluginPci2IsaBridge->pci_set_irq(a,b))
|
||||
#define DEV_pci_rd_memtype(addr) bx_devices.pluginPciBridge->rd_memType(addr)
|
||||
#define DEV_pci_wr_memtype(addr) bx_devices.pluginPciBridge->wr_memType(addr)
|
||||
#define DEV_pci_print_i440fx_state() bx_devices.pluginPciBridge->print_i440fx_state()
|
||||
|
Loading…
Reference in New Issue
Block a user