Added new VGA extension choice "voodoo" to test the new VGA extension code. It

currently only implements an ISA standard VGA adapter with the selected Voodoo
model as it's extension. The methods of the "Voodoo VGA" device only call the
required methods of the Voodoo or VGA core.
TODO: Start implementing the Voodoo Banshee chipset based on this code.
This commit is contained in:
Volker Ruppert 2017-10-12 19:34:58 +00:00
parent 5ec78eaae2
commit 2b91dabfe5
3 changed files with 83 additions and 4 deletions

View File

@ -96,6 +96,9 @@ libbx_vga.la: vga.lo vgacore.lo
libbx_svga_cirrus.la: svga_cirrus.lo vgacore.lo
$(LIBTOOL) --mode=link --tag CXX $(CXX) -module svga_cirrus.lo vgacore.lo -o libbx_svga_cirrus.la -rpath $(PLUGIN_PATH)
libbx_voodoo.la: voodoo.lo vgacore.lo
$(LIBTOOL) --mode=link --tag CXX $(CXX) -module voodoo.lo vgacore.lo -o libbx_voodoo.la -rpath $(PLUGIN_PATH)
#### building DLLs for win32 (Cygwin and MinGW/MSYS)
bx_%.dll: %.o
$(CXX) $(CXXFLAGS) -shared -o $@ $< $(WIN32_DLL_IMPORT_LIBRARY)
@ -107,7 +110,7 @@ bx_vga.dll: vga.o vgacore.o
bx_svga_cirrus.dll: svga_cirrus.o vgacore.o
@LINK_DLL@ svga_cirrus.o vgacore.o $(WIN32_DLL_IMPORT_LIBRARY)
bx_voodoo.dll: voodoo.o
bx_voodoo.dll: voodoo.o vgacore.o
@LINK_DLL@ voodoo.o $(WIN32_DLL_IMPORT_LIBRARY)
##### end DLL section

View File

@ -75,6 +75,7 @@
#define LOG_THIS theVoodooDevice->
bx_voodoo_c* theVoodooDevice = NULL;
bx_voodoo_vga_c* theVoodooVga = NULL;
#include "voodoo_types.h"
#include "voodoo_data.h"
@ -134,7 +135,13 @@ Bit32s voodoo_options_save(FILE *fp)
int CDECL libvoodoo_LTX_plugin_init(plugin_t *plugin, plugintype_t type)
{
theVoodooDevice = new bx_voodoo_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theVoodooDevice, BX_PLUGIN_VOODOO);
if (type == PLUGTYPE_VGA) {
theVoodooVga = new bx_voodoo_vga_c();
bx_devices.pluginVgaDevice = theVoodooVga;
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theVoodooVga, BX_PLUGIN_VOODOO);
} else {
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theVoodooDevice, BX_PLUGIN_VOODOO);
}
// add new configuration parameter for the config interface
voodoo_init_options();
// register add-on option for bochsrc and command line
@ -147,6 +154,9 @@ void CDECL libvoodoo_LTX_plugin_fini(void)
SIM->unregister_addon_option("voodoo");
bx_list_c *menu = (bx_list_c*)SIM->get_param("display");
menu->remove("voodoo");
if (theVoodooVga != NULL) {
delete theVoodooVga;
}
delete theVoodooDevice;
}
@ -276,11 +286,14 @@ void bx_voodoo_c::init(void)
v = new voodoo_state;
memset(v, 0, sizeof(voodoo_state));
BX_VOODOO_THIS s.model = (Bit8u)SIM->get_param_enum("model", base)->get();
if (BX_VOODOO_THIS s.model == VOODOO_2) {
if (BX_VOODOO_THIS s.model == VOODOO_1) {
init_pci_conf(0x121a, 0x0001, 0x02, 0x000000, 0x00);
} else if (BX_VOODOO_THIS s.model == VOODOO_2) {
init_pci_conf(0x121a, 0x0002, 0x02, 0x038000, 0x00);
BX_VOODOO_THIS pci_conf[0x10] = 0x08;
} else {
init_pci_conf(0x121a, 0x0001, 0x02, 0x000000, 0x00);
BX_PANIC(("Voodoo model '%s' not supported yet",
SIM->get_param_enum("model", base)->get_selected()));
}
BX_VOODOO_THIS pci_conf[0x3d] = BX_PCI_INTA;
BX_VOODOO_THIS pci_base_address[0] = 0;
@ -855,4 +868,49 @@ void bx_voodoo_c::pci_write_handler(Bit8u address, Bit32u value, unsigned io_len
BX_DEBUG(("write PCI register 0x%02x value 0x%08x", address, value));
}
bx_voodoo_vga_c::bx_voodoo_vga_c() : bx_vgacore_c()
{
put("VVGA");
}
bx_voodoo_vga_c::~bx_voodoo_vga_c()
{
}
bx_bool bx_voodoo_vga_c::init_vga_extension(void)
{
init_iohandlers(read_handler, write_handler);
theVoodooDevice->init();
return 0;
}
void bx_voodoo_vga_c::reset(unsigned type)
{
theVoodooDevice->reset(type);
}
void bx_voodoo_vga_c::register_state(void)
{
bx_list_c *list = new bx_list_c(SIM->get_bochs_root(), "voodoo_vga", "Voodoo VGA State");
bx_vgacore_c::register_state(list);
theVoodooDevice->register_state();
}
void bx_voodoo_vga_c::after_restore_state(void)
{
bx_vgacore_c::after_restore_state();
theVoodooDevice->after_restore_state();
}
void bx_voodoo_vga_c::redraw_area(unsigned x0, unsigned y0, unsigned width,
unsigned height)
{
bx_vgacore_c::redraw_area(x0, y0, width, height);
}
void bx_voodoo_vga_c::update(void)
{
BX_VVGA_THIS bx_vgacore_c::update();
}
#endif // BX_SUPPORT_PCI && BX_SUPPORT_VOODOO

View File

@ -23,6 +23,7 @@
#define BX_VOODOO_THIS theVoodooDevice->
#define BX_VOODOO_THIS_PTR theVoodooDevice
#define BX_VVGA_THIS theVoodooVga->
typedef struct {
Bit8u model;
@ -80,4 +81,21 @@ private:
static void vertical_timer_handler(void *);
};
class bx_voodoo_vga_c : public bx_vgacore_c {
public:
bx_voodoo_vga_c();
virtual ~bx_voodoo_vga_c();
virtual void reset(unsigned type);
virtual void register_state(void);
virtual void after_restore_state(void);
virtual void redraw_area(unsigned x0, unsigned y0,
unsigned width, unsigned height);
virtual bx_bool init_vga_extension(void);
protected:
virtual void update(void);
};
#endif