- added PCI IDE controller (dummy device - busmaster feature not present yet)
This commit is contained in:
parent
36d7f60c21
commit
bf243f892a
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: bochs.h,v 1.138 2004-06-04 22:06:54 sshwarts Exp $
|
// $Id: bochs.h,v 1.139 2004-06-09 20:55:43 vruppert Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||||
@ -302,9 +302,7 @@ enum {
|
|||||||
CPU10LOG, CPU11LOG, CPU12LOG, CPU13LOG, CPU14LOG, CPU15LOG, CTRLLOG,
|
CPU10LOG, CPU11LOG, CPU12LOG, CPU13LOG, CPU14LOG, CPU15LOG, CTRLLOG,
|
||||||
UNMAPLOG, SERRLOG, BIOSLOG, PIT81LOG, PIT82LOG, IODEBUGLOG, PCI2ISALOG,
|
UNMAPLOG, SERRLOG, BIOSLOG, PIT81LOG, PIT82LOG, IODEBUGLOG, PCI2ISALOG,
|
||||||
PLUGINLOG, EXTFPUIRQLOG , PCIVGALOG, PCIUSBLOG, VTIMERLOG, STIMERLOG,
|
PLUGINLOG, EXTFPUIRQLOG , PCIVGALOG, PCIUSBLOG, VTIMERLOG, STIMERLOG,
|
||||||
PCIDEVLOG,
|
PCIIDELOG, PCIDEVLOG, PCIPNICLOG, SPEAKERLOG
|
||||||
PCIPNICLOG,
|
|
||||||
SPEAKERLOG,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class BOCHSAPI iofunctions {
|
class BOCHSAPI iofunctions {
|
||||||
|
@ -258,6 +258,7 @@
|
|||||||
#define BX_USE_DEV_SMF 1 // System Devices (port92)
|
#define BX_USE_DEV_SMF 1 // System Devices (port92)
|
||||||
#define BX_USE_PCI_SMF 1 // PCI
|
#define BX_USE_PCI_SMF 1 // PCI
|
||||||
#define BX_USE_P2I_SMF 1 // PCI-to-ISA bridge
|
#define BX_USE_P2I_SMF 1 // PCI-to-ISA bridge
|
||||||
|
#define BX_USE_PIDE_SMF 1 // PCI-IDE
|
||||||
#define BX_USE_PCIVGA_SMF 1 // PCI-VGA
|
#define BX_USE_PCIVGA_SMF 1 // PCI-VGA
|
||||||
#define BX_USE_PCIDEV_SMF 1 // PCI-DEV
|
#define BX_USE_PCIDEV_SMF 1 // PCI-DEV
|
||||||
#define BX_USE_PCIUSB_SMF 1 // USB hub
|
#define BX_USE_PCIUSB_SMF 1 // USB hub
|
||||||
@ -276,7 +277,7 @@
|
|||||||
|| !BX_USE_SER_SMF || !BX_USE_UM_SMF || !BX_USE_VGA_SMF \
|
|| !BX_USE_SER_SMF || !BX_USE_UM_SMF || !BX_USE_VGA_SMF \
|
||||||
|| !BX_USE_SB16_SMF || !BX_USE_DEV_SMF || !BX_USE_PCI_SMF \
|
|| !BX_USE_SB16_SMF || !BX_USE_DEV_SMF || !BX_USE_PCI_SMF \
|
||||||
|| !BX_USE_P2I_SMF || !BX_USE_PCIVGA_SMF || !BX_USE_PCIUSB_SMF \
|
|| !BX_USE_P2I_SMF || !BX_USE_PCIVGA_SMF || !BX_USE_PCIUSB_SMF \
|
||||||
|| !BX_USE_PCIPNIC_SMF \
|
|| !BX_USE_PCIPNIC_SMF || !BX_USE_PIDE_SMF \
|
||||||
|| !BX_USE_NE2K_SMF || !BX_USE_EFI_SMF || !BX_USE_GAME_SMF \
|
|| !BX_USE_NE2K_SMF || !BX_USE_EFI_SMF || !BX_USE_GAME_SMF \
|
||||||
|| !BX_USE_PCIDEV_SMF)
|
|| !BX_USE_PCIDEV_SMF)
|
||||||
#error You must use SMF to have plugins
|
#error You must use SMF to have plugins
|
||||||
|
2
bochs/configure
vendored
2
bochs/configure
vendored
@ -34216,7 +34216,7 @@ echo "${ECHO_T}yes" >&6
|
|||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
pci=1
|
pci=1
|
||||||
PCI_OBJ='pci.o pci2isa.o pcivga.o'
|
PCI_OBJ='pci.o pci2isa.o pci_ide.o pcivga.o'
|
||||||
else
|
else
|
||||||
echo "$as_me:$LINENO: result: no" >&5
|
echo "$as_me:$LINENO: result: no" >&5
|
||||||
echo "${ECHO_T}no" >&6
|
echo "${ECHO_T}no" >&6
|
||||||
|
@ -2,7 +2,7 @@ dnl // Process this file with autoconf to produce a configure script.
|
|||||||
|
|
||||||
AC_PREREQ(2.50)
|
AC_PREREQ(2.50)
|
||||||
AC_INIT(bochs.h)
|
AC_INIT(bochs.h)
|
||||||
AC_REVISION([[$Id: configure.in,v 1.254 2004-06-01 07:30:33 cbothamy Exp $]])
|
AC_REVISION([[$Id: configure.in,v 1.255 2004-06-09 20:55:57 vruppert Exp $]])
|
||||||
AC_CONFIG_HEADER(config.h)
|
AC_CONFIG_HEADER(config.h)
|
||||||
AC_CONFIG_HEADER(ltdlconf.h)
|
AC_CONFIG_HEADER(ltdlconf.h)
|
||||||
|
|
||||||
@ -798,7 +798,7 @@ AC_ARG_ENABLE(pci,
|
|||||||
AC_MSG_RESULT(yes)
|
AC_MSG_RESULT(yes)
|
||||||
AC_DEFINE(BX_PCI_SUPPORT, 1)
|
AC_DEFINE(BX_PCI_SUPPORT, 1)
|
||||||
pci=1
|
pci=1
|
||||||
PCI_OBJ='pci.o pci2isa.o pcivga.o'
|
PCI_OBJ='pci.o pci2isa.o pci_ide.o pcivga.o'
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
AC_DEFINE(BX_PCI_SUPPORT, 0)
|
AC_DEFINE(BX_PCI_SUPPORT, 0)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: devices.cc,v 1.66 2004-04-08 21:23:41 cbothamy Exp $
|
// $Id: devices.cc,v 1.67 2004-06-09 20:55:58 vruppert Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||||
@ -55,6 +55,7 @@ bx_devices_c::bx_devices_c(void)
|
|||||||
#if BX_PCI_SUPPORT
|
#if BX_PCI_SUPPORT
|
||||||
pluginPciBridge = &stubPci;
|
pluginPciBridge = &stubPci;
|
||||||
pluginPci2IsaBridge = NULL;
|
pluginPci2IsaBridge = NULL;
|
||||||
|
pluginPciIdeController = NULL;
|
||||||
#if BX_PCI_VGA_SUPPORT
|
#if BX_PCI_VGA_SUPPORT
|
||||||
pluginPciVgaAdapter = NULL;
|
pluginPciVgaAdapter = NULL;
|
||||||
#endif
|
#endif
|
||||||
@ -105,7 +106,7 @@ bx_devices_c::init(BX_MEM_C *newmem)
|
|||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
BX_DEBUG(("Init $Id: devices.cc,v 1.66 2004-04-08 21:23:41 cbothamy Exp $"));
|
BX_DEBUG(("Init $Id: devices.cc,v 1.67 2004-06-09 20:55:58 vruppert Exp $"));
|
||||||
mem = newmem;
|
mem = newmem;
|
||||||
|
|
||||||
/* set no-default handlers, will be overwritten by the real default handler */
|
/* set no-default handlers, will be overwritten by the real default handler */
|
||||||
@ -185,6 +186,7 @@ bx_devices_c::init(BX_MEM_C *newmem)
|
|||||||
#if BX_PCI_SUPPORT
|
#if BX_PCI_SUPPORT
|
||||||
PLUG_load_plugin(pci, PLUGTYPE_OPTIONAL);
|
PLUG_load_plugin(pci, PLUGTYPE_OPTIONAL);
|
||||||
PLUG_load_plugin(pci2isa, PLUGTYPE_OPTIONAL);
|
PLUG_load_plugin(pci2isa, PLUGTYPE_OPTIONAL);
|
||||||
|
PLUG_load_plugin(pci_ide, PLUGTYPE_OPTIONAL);
|
||||||
#if BX_PCI_VGA_SUPPORT
|
#if BX_PCI_VGA_SUPPORT
|
||||||
PLUG_load_plugin(pcivga, PLUGTYPE_OPTIONAL);
|
PLUG_load_plugin(pcivga, PLUGTYPE_OPTIONAL);
|
||||||
#endif
|
#endif
|
||||||
@ -309,6 +311,7 @@ bx_devices_c::reset(unsigned type)
|
|||||||
if (bx_options.Oi440FXSupport->get ()) {
|
if (bx_options.Oi440FXSupport->get ()) {
|
||||||
pluginPciBridge->reset(type);
|
pluginPciBridge->reset(type);
|
||||||
pluginPci2IsaBridge->reset(type);
|
pluginPci2IsaBridge->reset(type);
|
||||||
|
pluginPciIdeController->reset(type);
|
||||||
#if BX_PCI_VGA_SUPPORT
|
#if BX_PCI_VGA_SUPPORT
|
||||||
pluginPciVgaAdapter->reset(type);
|
pluginPciVgaAdapter->reset(type);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: iodev.h,v 1.41 2004-02-02 21:47:26 vruppert Exp $
|
// $Id: iodev.h,v 1.42 2004-06-09 20:55:58 vruppert Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||||
@ -323,6 +323,7 @@ public:
|
|||||||
bx_ioapic_c *ioapic;
|
bx_ioapic_c *ioapic;
|
||||||
bx_pci_stub_c *pluginPciBridge;
|
bx_pci_stub_c *pluginPciBridge;
|
||||||
bx_devmodel_c *pluginPci2IsaBridge;
|
bx_devmodel_c *pluginPci2IsaBridge;
|
||||||
|
bx_devmodel_c *pluginPciIdeController;
|
||||||
bx_devmodel_c *pluginPciVgaAdapter;
|
bx_devmodel_c *pluginPciVgaAdapter;
|
||||||
bx_devmodel_c *pluginPciDevAdapter;
|
bx_devmodel_c *pluginPciDevAdapter;
|
||||||
bx_devmodel_c *pluginPciUSBAdapter;
|
bx_devmodel_c *pluginPciUSBAdapter;
|
||||||
@ -411,6 +412,7 @@ private:
|
|||||||
#if BX_PCI_SUPPORT
|
#if BX_PCI_SUPPORT
|
||||||
#include "iodev/pci.h"
|
#include "iodev/pci.h"
|
||||||
#include "iodev/pci2isa.h"
|
#include "iodev/pci2isa.h"
|
||||||
|
#include "iodev/pci_ide.h"
|
||||||
#if BX_PCI_VGA_SUPPORT
|
#if BX_PCI_VGA_SUPPORT
|
||||||
#include "iodev/pcivga.h"
|
#include "iodev/pcivga.h"
|
||||||
#endif
|
#endif
|
||||||
|
299
bochs/iodev/pci_ide.cc
Normal file
299
bochs/iodev/pci_ide.cc
Normal file
@ -0,0 +1,299 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
// $Id: pci_ide.cc,v 1.1 2004-06-09 20:55:58 vruppert Exp $
|
||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||||
|
//
|
||||||
|
// MandrakeSoft S.A.
|
||||||
|
// 43, rue d'Aboukir
|
||||||
|
// 75002 Paris - France
|
||||||
|
// http://www.linux-mandrake.com/
|
||||||
|
// http://www.mandrakesoft.com/
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
//
|
||||||
|
// i440FX Support - PCI IDE controller (PIIX3)
|
||||||
|
//
|
||||||
|
|
||||||
|
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
|
||||||
|
// platforms that require a special tag on exported symbols, BX_PLUGGABLE
|
||||||
|
// is used to know when we are exporting symbols and when we are importing.
|
||||||
|
#define BX_PLUGGABLE
|
||||||
|
|
||||||
|
#include "bochs.h"
|
||||||
|
#if BX_PCI_SUPPORT
|
||||||
|
|
||||||
|
#define LOG_THIS thePciIdeController->
|
||||||
|
|
||||||
|
bx_pci_ide_c *thePciIdeController = NULL;
|
||||||
|
|
||||||
|
int
|
||||||
|
libpci_ide_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
|
||||||
|
{
|
||||||
|
thePciIdeController = new bx_pci_ide_c ();
|
||||||
|
bx_devices.pluginPciIdeController = thePciIdeController;
|
||||||
|
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, thePciIdeController, BX_PLUGIN_PCI_IDE);
|
||||||
|
return(0); // Success
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
libpci_ide_LTX_plugin_fini(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bx_pci_ide_c::bx_pci_ide_c(void)
|
||||||
|
{
|
||||||
|
put("PIDE");
|
||||||
|
settype(PCIIDELOG);
|
||||||
|
}
|
||||||
|
|
||||||
|
bx_pci_ide_c::~bx_pci_ide_c(void)
|
||||||
|
{
|
||||||
|
// nothing for now
|
||||||
|
BX_DEBUG(("Exit."));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
bx_pci_ide_c::init(void)
|
||||||
|
{
|
||||||
|
// called once when bochs initializes
|
||||||
|
|
||||||
|
DEV_register_pci_handlers(this, pci_read_handler, pci_write_handler,
|
||||||
|
BX_PCI_DEVICE(1,1), "PIIX3 PCI IDE controller");
|
||||||
|
|
||||||
|
for (unsigned i=0; i<256; i++)
|
||||||
|
BX_PIDE_THIS s.pci_conf[i] = 0x0;
|
||||||
|
// readonly registers
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x00] = 0x86;
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x01] = 0x80;
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x02] = 0x10;
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x03] = 0x70;
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x09] = 0x80;
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x0a] = 0x01;
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x0b] = 0x01;
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x0e] = 0x00;
|
||||||
|
|
||||||
|
BX_PIDE_THIS s.bmide_addr = 0x0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
bx_pci_ide_c::reset(unsigned type)
|
||||||
|
{
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x04] = 0x01;
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x05] = 0x00;
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x06] = 0x80;
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x07] = 0x02;
|
||||||
|
if (bx_options.ata[0].Opresent->get ()) {
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x10] = 0xf1;
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x11] = 0x01;
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x14] = 0xf5;
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x15] = 0x03;
|
||||||
|
}
|
||||||
|
if (bx_options.ata[1].Opresent->get ()) {
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x18] = 0x71;
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x19] = 0x01;
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x1C] = 0x75;
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x1D] = 0x03;
|
||||||
|
}
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x20] = 0x01;
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x21] = 0x00;
|
||||||
|
if (bx_options.ata[0].Opresent->get ()) {
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x40] = 0x00;
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x41] = 0x80;
|
||||||
|
}
|
||||||
|
if (bx_options.ata[1].Opresent->get ()) {
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x42] = 0x00;
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x43] = 0x80;
|
||||||
|
}
|
||||||
|
BX_PIDE_THIS s.pci_conf[0x44] = 0x00;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// static IO port read callback handler
|
||||||
|
// redirects to non-static class handler to avoid virtual functions
|
||||||
|
|
||||||
|
Bit32u
|
||||||
|
bx_pci_ide_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
|
||||||
|
{
|
||||||
|
#if !BX_USE_PIDE_SMF
|
||||||
|
bx_pci_ide_c *class_ptr = (bx_pci_ide_c *) this_ptr;
|
||||||
|
|
||||||
|
return( class_ptr->read(address, io_len) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Bit32u
|
||||||
|
bx_pci_ide_c::read(Bit32u address, unsigned io_len)
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
UNUSED(this_ptr);
|
||||||
|
#endif // !BX_USE_PIDE_SMF
|
||||||
|
Bit8u offset;
|
||||||
|
|
||||||
|
offset = address - BX_PIDE_THIS s.bmide_addr;
|
||||||
|
BX_INFO(("BM-IDE read register 0x%08x len %d", offset, io_len));
|
||||||
|
return BX_PIDE_THIS s.bmide_regs[offset];
|
||||||
|
/* switch (address) {
|
||||||
|
}
|
||||||
|
|
||||||
|
return(0xffffffff);*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// static IO port write callback handler
|
||||||
|
// redirects to non-static class handler to avoid virtual functions
|
||||||
|
|
||||||
|
void
|
||||||
|
bx_pci_ide_c::write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len)
|
||||||
|
{
|
||||||
|
#if !BX_USE_PIDE_SMF
|
||||||
|
bx_pci_ide_c *class_ptr = (bx_pci_ide_c *) this_ptr;
|
||||||
|
|
||||||
|
class_ptr->write(address, value, io_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
bx_pci_ide_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
UNUSED(this_ptr);
|
||||||
|
#endif // !BX_USE_PIDE_SMF
|
||||||
|
Bit8u offset;
|
||||||
|
|
||||||
|
offset = address - BX_PIDE_THIS s.bmide_addr;
|
||||||
|
BX_INFO(("BM-IDE write register 0x%08x len %d", offset, io_len));
|
||||||
|
BX_PIDE_THIS s.bmide_regs[offset] = (Bit8u)value;
|
||||||
|
/* switch (address) {
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// static pci configuration space read callback handler
|
||||||
|
// redirects to non-static class handler to avoid virtual functions
|
||||||
|
|
||||||
|
Bit32u
|
||||||
|
bx_pci_ide_c::pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len)
|
||||||
|
{
|
||||||
|
#if !BX_USE_PIDE_SMF
|
||||||
|
bx_pci_ide_c *class_ptr = (bx_pci_ide_c *) this_ptr;
|
||||||
|
|
||||||
|
return( class_ptr->pci_read(address, io_len) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Bit32u
|
||||||
|
bx_pci_ide_c::pci_read(Bit8u address, unsigned io_len)
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
UNUSED(this_ptr);
|
||||||
|
#endif // !BX_USE_PIDE_SMF
|
||||||
|
|
||||||
|
Bit32u value = 0;
|
||||||
|
|
||||||
|
if (io_len <= 4) {
|
||||||
|
for (unsigned i=0; i<io_len; i++) {
|
||||||
|
value |= (BX_PIDE_THIS s.pci_conf[address+i] << (i*8));
|
||||||
|
}
|
||||||
|
BX_DEBUG(("PIIX3 PCI IDE read register 0x%02x value 0x%08x", address, value));
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return(0xffffffff);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// static pci configuration space write callback handler
|
||||||
|
// redirects to non-static class handler to avoid virtual functions
|
||||||
|
|
||||||
|
void
|
||||||
|
bx_pci_ide_c::pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len)
|
||||||
|
{
|
||||||
|
#if !BX_USE_PIDE_SMF
|
||||||
|
bx_pci_ide_c *class_ptr = (bx_pci_ide_c *) this_ptr;
|
||||||
|
|
||||||
|
class_ptr->pci_write(address, value, io_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
bx_pci_ide_c::pci_write(Bit8u address, Bit32u value, unsigned io_len)
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
UNUSED(this_ptr);
|
||||||
|
#endif // !BX_USE_PIDE_SMF
|
||||||
|
|
||||||
|
Bit8u value8, oldval;
|
||||||
|
bx_bool bmide_change = 0;
|
||||||
|
|
||||||
|
if (io_len <= 4) {
|
||||||
|
for (unsigned i=0; i<io_len; i++) {
|
||||||
|
oldval = BX_PIDE_THIS s.pci_conf[address+i];
|
||||||
|
value8 = (value >> (i*8)) & 0xFF;
|
||||||
|
switch (address+i) {
|
||||||
|
case 0x06:
|
||||||
|
case 0x12:
|
||||||
|
case 0x13:
|
||||||
|
case 0x16:
|
||||||
|
case 0x17:
|
||||||
|
case 0x1A:
|
||||||
|
case 0x1B:
|
||||||
|
case 0x1E:
|
||||||
|
case 0x1F:
|
||||||
|
case 0x22:
|
||||||
|
case 0x23:
|
||||||
|
break;
|
||||||
|
case 0x20:
|
||||||
|
bmide_change = (value8 != oldval);
|
||||||
|
case 0x10:
|
||||||
|
case 0x14:
|
||||||
|
case 0x18:
|
||||||
|
case 0x1C:
|
||||||
|
BX_PIDE_THIS s.pci_conf[address+i] = (value8 & 0xF0) | 0x01;
|
||||||
|
break;
|
||||||
|
case 0x21:
|
||||||
|
bmide_change = (value8 != oldval);
|
||||||
|
default:
|
||||||
|
BX_PIDE_THIS s.pci_conf[address+i] = value8;
|
||||||
|
BX_DEBUG(("PIIX3 PCI IDE write register 0x%02x value 0x%02x", address,
|
||||||
|
value8));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bmide_change) {
|
||||||
|
if (BX_PIDE_THIS s.bmide_addr > 0) {
|
||||||
|
DEV_unregister_ioread_handler_range(this, read_handler,
|
||||||
|
BX_PIDE_THIS s.bmide_addr,
|
||||||
|
BX_PIDE_THIS s.bmide_addr + 0x0F, 7);
|
||||||
|
DEV_unregister_iowrite_handler_range(this, write_handler,
|
||||||
|
BX_PIDE_THIS s.bmide_addr,
|
||||||
|
BX_PIDE_THIS s.bmide_addr + 0x0F, 7);
|
||||||
|
}
|
||||||
|
BX_PIDE_THIS s.bmide_addr = (BX_PIDE_THIS s.pci_conf[0x20] & 0xFE) |
|
||||||
|
(BX_PIDE_THIS s.pci_conf[0x21] << 8);
|
||||||
|
BX_INFO(("new BM-IDE address: 0x%04x", BX_PIDE_THIS s.bmide_addr));
|
||||||
|
if (BX_PIDE_THIS s.bmide_addr > 0) {
|
||||||
|
DEV_register_ioread_handler_range(this, read_handler, BX_PIDE_THIS s.bmide_addr,
|
||||||
|
BX_PIDE_THIS s.bmide_addr + 0x0F,
|
||||||
|
"PIIX3 PCI IDE controller", 7);
|
||||||
|
DEV_register_iowrite_handler_range(this, write_handler, BX_PIDE_THIS s.bmide_addr,
|
||||||
|
BX_PIDE_THIS s.bmide_addr + 0x0F,
|
||||||
|
"PIIX3 PCI IDE controller", 7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* BX_PCI_SUPPORT */
|
63
bochs/iodev/pci_ide.h
Normal file
63
bochs/iodev/pci_ide.h
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
// $Id: pci_ide.h,v 1.1 2004-06-09 20:55:58 vruppert Exp $
|
||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2004 MandrakeSoft S.A.
|
||||||
|
//
|
||||||
|
// MandrakeSoft S.A.
|
||||||
|
// 43, rue d'Aboukir
|
||||||
|
// 75002 Paris - France
|
||||||
|
// http://www.linux-mandrake.com/
|
||||||
|
// http://www.mandrakesoft.com/
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
#if BX_USE_PIDE_SMF
|
||||||
|
# define BX_PIDE_SMF static
|
||||||
|
# define BX_PIDE_THIS thePciIdeController->
|
||||||
|
#else
|
||||||
|
# define BX_PIDE_SMF
|
||||||
|
# define BX_PIDE_THIS this->
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
class bx_pci_ide_c : public bx_devmodel_c {
|
||||||
|
|
||||||
|
public:
|
||||||
|
bx_pci_ide_c(void);
|
||||||
|
~bx_pci_ide_c(void);
|
||||||
|
virtual void init(void);
|
||||||
|
virtual void reset(unsigned type);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
struct {
|
||||||
|
Bit8u pci_conf[256];
|
||||||
|
Bit16u bmide_addr;
|
||||||
|
Bit8u bmide_regs[16];
|
||||||
|
} s;
|
||||||
|
|
||||||
|
static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
|
||||||
|
static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
|
||||||
|
static Bit32u pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len);
|
||||||
|
static void pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len);
|
||||||
|
#if !BX_USE_PIDE_SMF
|
||||||
|
Bit32u read(Bit32u address, unsigned io_len);
|
||||||
|
void write(Bit32u address, Bit32u value, unsigned io_len);
|
||||||
|
Bit32u pci_read(Bit8u address, unsigned io_len);
|
||||||
|
void pci_write(Bit8u address, Bit32u value, unsigned io_len);
|
||||||
|
#endif
|
||||||
|
};
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: plugin.h,v 1.24 2004-02-02 19:42:21 cbothamy Exp $
|
// $Id: plugin.h,v 1.25 2004-06-09 20:55:58 vruppert Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// This file provides macros and types needed for plugins. It is based on
|
// This file provides macros and types needed for plugins. It is based on
|
||||||
@ -34,6 +34,7 @@ extern "C" {
|
|||||||
#define BX_PLUGIN_PIC "pic"
|
#define BX_PLUGIN_PIC "pic"
|
||||||
#define BX_PLUGIN_PCI "pci"
|
#define BX_PLUGIN_PCI "pci"
|
||||||
#define BX_PLUGIN_PCI2ISA "pci2isa"
|
#define BX_PLUGIN_PCI2ISA "pci2isa"
|
||||||
|
#define BX_PLUGIN_PCI_IDE "pci_ide"
|
||||||
#define BX_PLUGIN_SB16 "sb16"
|
#define BX_PLUGIN_SB16 "sb16"
|
||||||
#define BX_PLUGIN_NE2K "ne2k"
|
#define BX_PLUGIN_NE2K "ne2k"
|
||||||
#define BX_PLUGIN_EXTFPUIRQ "extfpuirq"
|
#define BX_PLUGIN_EXTFPUIRQ "extfpuirq"
|
||||||
@ -335,6 +336,7 @@ DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(floppy)
|
|||||||
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(parallel)
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(parallel)
|
||||||
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pci)
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pci)
|
||||||
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pci2isa)
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pci2isa)
|
||||||
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pci_ide)
|
||||||
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pcivga)
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pcivga)
|
||||||
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pcidev)
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pcidev)
|
||||||
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pciusb)
|
DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(pciusb)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user