- meaning of the memory type values changed (0 = ROM, 1 = Shadow RAM)
- the functions mapRead() and mapWrite() are no longer necessary
This commit is contained in:
parent
38666a2cfb
commit
e1d8d30e4c
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pci.cc,v 1.19 2002-08-31 12:24:39 vruppert Exp $
|
||||
// $Id: pci.cc,v 1.20 2002-08-31 15:35:51 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -328,73 +328,43 @@ bx_pci_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
|
||||
}
|
||||
|
||||
|
||||
Bit32u
|
||||
bx_pci_c::mapRead (Bit32u val)
|
||||
{
|
||||
switch (val) {
|
||||
case 0x0:
|
||||
case 0x2:
|
||||
return (1); // (0) Goto ROM
|
||||
|
||||
case 0x1:
|
||||
case 0x3:
|
||||
return (0); // (1) Goto Shadow
|
||||
}
|
||||
return (2);
|
||||
}
|
||||
|
||||
Bit32u
|
||||
bx_pci_c::mapWrite (Bit32u val)
|
||||
{
|
||||
switch (val) {
|
||||
case 0x0:
|
||||
case 0x1:
|
||||
return (1); // (0) Goto ROM
|
||||
|
||||
case 0x2:
|
||||
case 0x3:
|
||||
return (0); // (1) Goto Shadow
|
||||
}
|
||||
return (2);
|
||||
}
|
||||
|
||||
Bit32u
|
||||
Bit8u
|
||||
bx_pci_c::rd_memType (Bit32u addr)
|
||||
{
|
||||
switch ((addr & 0xFC000) >> 12) {
|
||||
case 0xC0:
|
||||
return (mapRead ( BX_PCI_THIS s.i440fx.pci_conf[0x5A] & 0x3));
|
||||
return (BX_PCI_THIS s.i440fx.pci_conf[0x5A] & 0x1);
|
||||
case 0xC4:
|
||||
return (mapRead ( (BX_PCI_THIS s.i440fx.pci_conf[0x5A] >> 4) & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x5A] >> 4) & 0x1);
|
||||
case 0xC8:
|
||||
return (mapRead ( BX_PCI_THIS s.i440fx.pci_conf[0x5B] & 0x3));
|
||||
return (BX_PCI_THIS s.i440fx.pci_conf[0x5B] & 0x1);
|
||||
case 0xCC:
|
||||
return (mapRead ( (BX_PCI_THIS s.i440fx.pci_conf[0x5B] >> 4) & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x5B] >> 4) & 0x1);
|
||||
|
||||
|
||||
case 0xD0:
|
||||
return (mapRead ( BX_PCI_THIS s.i440fx.pci_conf[0x5C] & 0x3));
|
||||
return (BX_PCI_THIS s.i440fx.pci_conf[0x5C] & 0x1);
|
||||
case 0xD4:
|
||||
return (mapRead ( (BX_PCI_THIS s.i440fx.pci_conf[0x5C] >> 4) & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x5C] >> 4) & 0x1);
|
||||
case 0xD8:
|
||||
return (mapRead ( BX_PCI_THIS s.i440fx.pci_conf[0x5D] & 0x3));
|
||||
return (BX_PCI_THIS s.i440fx.pci_conf[0x5D] & 0x1);
|
||||
case 0xDC:
|
||||
return (mapRead ( (BX_PCI_THIS s.i440fx.pci_conf[0x5D] >> 4) & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x5D] >> 4) & 0x1);
|
||||
|
||||
case 0xE0:
|
||||
return (mapRead ( BX_PCI_THIS s.i440fx.pci_conf[0x5E] & 0x3));
|
||||
return (BX_PCI_THIS s.i440fx.pci_conf[0x5E] & 0x1);
|
||||
case 0xE4:
|
||||
return (mapRead ( (BX_PCI_THIS s.i440fx.pci_conf[0x5E] >> 4) & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x5E] >> 4) & 0x1);
|
||||
case 0xE8:
|
||||
return (mapRead ( BX_PCI_THIS s.i440fx.pci_conf[0x5F] & 0x3));
|
||||
return (BX_PCI_THIS s.i440fx.pci_conf[0x5F] & 0x1);
|
||||
case 0xEC:
|
||||
return (mapRead ( (BX_PCI_THIS s.i440fx.pci_conf[0x5F] >> 4) & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x5F] >> 4) & 0x1);
|
||||
|
||||
case 0xF0:
|
||||
case 0xF4:
|
||||
case 0xF8:
|
||||
case 0xFC:
|
||||
return (mapRead ( (BX_PCI_THIS s.i440fx.pci_conf[0x59] >> 4) & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x59] >> 4) & 0x1);
|
||||
|
||||
default:
|
||||
BX_PANIC(("rd_memType () Error: Memory Type not known !"));
|
||||
@ -404,43 +374,43 @@ bx_pci_c::rd_memType (Bit32u addr)
|
||||
|
||||
}
|
||||
|
||||
Bit32u
|
||||
Bit8u
|
||||
bx_pci_c::wr_memType (Bit32u addr)
|
||||
{
|
||||
switch ((addr & 0xFC000) >> 12) {
|
||||
case 0xC0:
|
||||
return (mapWrite ( BX_PCI_THIS s.i440fx.pci_conf[0x5A] & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x5A] >> 1) & 0x1);
|
||||
case 0xC4:
|
||||
return (mapWrite ( (BX_PCI_THIS s.i440fx.pci_conf[0x5A] >> 4) & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x5A] >> 5) & 0x1);
|
||||
case 0xC8:
|
||||
return (mapWrite ( BX_PCI_THIS s.i440fx.pci_conf[0x5B] & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x5B] >> 1) & 0x1);
|
||||
case 0xCC:
|
||||
return (mapWrite ( (BX_PCI_THIS s.i440fx.pci_conf[0x5B] >> 4) & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x5B] >> 5) & 0x1);
|
||||
|
||||
|
||||
case 0xD0:
|
||||
return (mapWrite ( BX_PCI_THIS s.i440fx.pci_conf[0x5C] & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x5C] >> 1) & 0x1);
|
||||
case 0xD4:
|
||||
return (mapWrite ( (BX_PCI_THIS s.i440fx.pci_conf[0x5C] >> 4) & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x5C] >> 5) & 0x1);
|
||||
case 0xD8:
|
||||
return (mapWrite ( BX_PCI_THIS s.i440fx.pci_conf[0x5D] & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x5D] >> 1) & 0x1);
|
||||
case 0xDC:
|
||||
return (mapWrite ( (BX_PCI_THIS s.i440fx.pci_conf[0x5D] >> 4) & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x5D] >> 5) & 0x1);
|
||||
|
||||
case 0xE0:
|
||||
return (mapWrite ( BX_PCI_THIS s.i440fx.pci_conf[0x5E] & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x5E] >> 1) & 0x1);
|
||||
case 0xE4:
|
||||
return (mapWrite ( (BX_PCI_THIS s.i440fx.pci_conf[0x5E] >> 4) & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x5E] >> 5) & 0x1);
|
||||
case 0xE8:
|
||||
return (mapWrite ( BX_PCI_THIS s.i440fx.pci_conf[0x5F] & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x5F] >> 1) & 0x1);
|
||||
case 0xEC:
|
||||
return (mapWrite ( (BX_PCI_THIS s.i440fx.pci_conf[0x5F] >> 4) & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x5F] >> 5) & 0x1);
|
||||
|
||||
case 0xF0:
|
||||
case 0xF4:
|
||||
case 0xF8:
|
||||
case 0xFC:
|
||||
return (mapWrite ( (BX_PCI_THIS s.i440fx.pci_conf[0x59] >> 4) & 0x3));
|
||||
return ( (BX_PCI_THIS s.i440fx.pci_conf[0x59] >> 5) & 0x1);
|
||||
|
||||
default:
|
||||
BX_PANIC(("wr_memType () Error: Memory Type not known !"));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pci.h,v 1.9 2002-08-31 12:24:41 vruppert Exp $
|
||||
// $Id: pci.h,v 1.10 2002-08-31 15:35:51 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -60,8 +60,8 @@ public:
|
||||
bx_pci_write_handler_t f2, Bit8u devfunc,
|
||||
const char *name);
|
||||
BX_PCI_SMF void print_i440fx_state( );
|
||||
BX_PCI_SMF Bit32u rd_memType (Bit32u addr);
|
||||
BX_PCI_SMF Bit32u wr_memType (Bit32u addr);
|
||||
BX_PCI_SMF Bit8u rd_memType (Bit32u addr);
|
||||
BX_PCI_SMF Bit8u wr_memType (Bit32u addr);
|
||||
|
||||
private:
|
||||
bx_devices_c *devices;
|
||||
@ -88,8 +88,6 @@ private:
|
||||
Bit32u pci_read(Bit8u address, unsigned io_len);
|
||||
void pci_write(Bit8u address, Bit32u value, unsigned io_len);
|
||||
#endif
|
||||
BX_PCI_SMF Bit32u mapRead (Bit32u val);
|
||||
BX_PCI_SMF Bit32u mapWrite (Bit32u val);
|
||||
};
|
||||
|
||||
#if BX_USE_PCI_SMF
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: memory.cc,v 1.17 2002-08-31 12:24:41 vruppert Exp $
|
||||
// $Id: memory.cc,v 1.18 2002-08-31 15:35:51 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -237,14 +237,14 @@ inc_one:
|
||||
if (bx_options.Oi440FXSupport->get () &&
|
||||
((a20addr >= 0xC0000) && (a20addr <= 0xFFFFF))) {
|
||||
switch (bx_devices.pci->wr_memType(a20addr & 0xFC000)) {
|
||||
case 0x0: // Writes to ShadowRAM
|
||||
case 0x1: // Writes to ShadowRAM
|
||||
// BX_INFO(("Writing to ShadowRAM %08x, len %u ! ", (unsigned) a20addr, (unsigned) len));
|
||||
shadow[a20addr - 0xc0000] = *data_ptr;
|
||||
BX_DBG_DIRTY_PAGE(a20addr >> 12);
|
||||
BX_DYN_DIRTY_PAGE(a20addr >> 12);
|
||||
goto inc_one;
|
||||
|
||||
case 0x1: // Writes to ROM, Inhibit
|
||||
case 0x0: // Writes to ROM, Inhibit
|
||||
BX_DEBUG(("Write to ROM ignored: address %08x, data %02x", (unsigned) a20addr, *data_ptr));
|
||||
goto inc_one;
|
||||
default:
|
||||
@ -471,12 +471,12 @@ inc_one:
|
||||
}
|
||||
else {
|
||||
switch (bx_devices.pci->rd_memType(a20addr & 0xFC000)) {
|
||||
case 0x0: // Read from ShadowRAM
|
||||
case 0x1: // Read from ShadowRAM
|
||||
*data_ptr = shadow[a20addr - 0xc0000];
|
||||
BX_INFO(("Reading from ShadowRAM %08x, Data %02x ", (unsigned) a20addr, *data_ptr));
|
||||
goto inc_one;
|
||||
|
||||
case 0x1: // Read from ROM
|
||||
case 0x0: // Read from ROM
|
||||
*data_ptr = vector[a20addr];
|
||||
//BX_INFO(("Reading from ROM %08x, Data %02x ", (unsigned) a20addr, *data_ptr));
|
||||
goto inc_one;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: misc_mem.cc,v 1.24 2002-08-31 12:24:41 vruppert Exp $
|
||||
// $Id: misc_mem.cc,v 1.25 2002-08-31 15:35:51 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -90,7 +90,7 @@ BX_MEM_C::~BX_MEM_C(void)
|
||||
void
|
||||
BX_MEM_C::init_memory(int memsize)
|
||||
{
|
||||
BX_DEBUG(("Init $Id: misc_mem.cc,v 1.24 2002-08-31 12:24:41 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: misc_mem.cc,v 1.25 2002-08-31 15:35:51 vruppert Exp $"));
|
||||
// you can pass 0 if memory has been allocated already through
|
||||
// the constructor, or the desired size of memory if it hasn't
|
||||
|
||||
@ -183,10 +183,10 @@ BX_MEM_C::pci_fetch_ptr(Bit32u addr)
|
||||
{
|
||||
if (bx_options.Oi440FXSupport->get ()) {
|
||||
switch (bx_devices.pci->rd_memType (addr)) {
|
||||
case 0x0: // Read from ShadowRAM
|
||||
case 0x1: // Read from ShadowRAM
|
||||
return (&BX_MEM_THIS shadow[addr - 0xc0000]);
|
||||
|
||||
case 0x1: // Read from ROM
|
||||
case 0x0: // Read from ROM
|
||||
return (&BX_MEM_THIS vector[addr]);
|
||||
default:
|
||||
BX_PANIC(("pci_fetch_ptr(): default case"));
|
||||
@ -221,12 +221,12 @@ BX_MEM_C::dbg_fetch_mem(Bit32u addr, unsigned len, Bit8u *buf)
|
||||
if ( bx_options.Oi440FXSupport->get () &&
|
||||
((addr >= 0x000C0000) && (addr <= 0x000FFFFF)) ) {
|
||||
switch (bx_devices.pci->rd_memType (addr)) {
|
||||
case 0x0: // Fetch from ShadowRAM
|
||||
case 0x1: // Fetch from ShadowRAM
|
||||
*buf = shadow[addr - 0xc0000];
|
||||
// BX_INFO(("Fetching from ShadowRAM %06x, len %u !", (unsigned)addr, (unsigned)len));
|
||||
break;
|
||||
|
||||
case 0x1: // Fetch from ROM
|
||||
case 0x0: // Fetch from ROM
|
||||
*buf = vector[addr];
|
||||
// BX_INFO(("Fetching from ROM %06x, Data %02x ", (unsigned)addr, *buf));
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user