Added DDC stub for the Cirrus and Voodoo Banshee display adapters (when ready,

this code should return the VESA EDID for the Bochs plug&play monitor).
This commit is contained in:
Volker Ruppert 2018-01-11 19:02:08 +00:00
parent 7d1a524ff0
commit 1f2d9ca668
8 changed files with 179 additions and 16 deletions

View File

@ -61,6 +61,7 @@ OBJS_THAT_CAN_BE_PLUGINS = \
OBJS_THAT_SUPPORT_OTHER_PLUGINS = \
vgacore.o \
ddc.o \
$(DISPLAY_EXTRA_OBJS)
NONPLUGIN_OBJS = @IODEV_EXT_NON_PLUGIN_OBJS@
@ -95,11 +96,11 @@ libbx_%.la: %.lo
libbx_vga.la: vga.lo vgacore.lo
$(LIBTOOL) --mode=link --tag CXX $(CXX) -module vga.lo vgacore.lo -o libbx_vga.la -rpath $(PLUGIN_PATH)
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_svga_cirrus.la: svga_cirrus.lo vgacore.lo ddc.lo
$(LIBTOOL) --mode=link --tag CXX $(CXX) -module svga_cirrus.lo vgacore.lo ddc.lo -o libbx_svga_cirrus.la -rpath $(PLUGIN_PATH)
libbx_voodoo.la: voodoo.lo banshee.lo vgacore.lo
$(LIBTOOL) --mode=link --tag CXX $(CXX) -module voodoo.lo banshee.lo vgacore.lo -o libbx_voodoo.la -rpath $(PLUGIN_PATH)
libbx_voodoo.la: voodoo.lo banshee.lo vgacore.lo ddc.lo
$(LIBTOOL) --mode=link --tag CXX $(CXX) -module voodoo.lo banshee.lo vgacore.lo ddc.lo -o libbx_voodoo.la -rpath $(PLUGIN_PATH)
#### building DLLs for win32 (Cygwin and MinGW/MSYS)
bx_%.dll: %.o
@ -109,11 +110,11 @@ bx_%.dll: %.o
bx_vga.dll: vga.o vgacore.o
@LINK_DLL@ vga.o vgacore.o $(WIN32_DLL_IMPORT_LIBRARY)
bx_svga_cirrus.dll: svga_cirrus.o vgacore.o
@LINK_DLL@ svga_cirrus.o vgacore.o $(WIN32_DLL_IMPORT_LIBRARY)
bx_svga_cirrus.dll: svga_cirrus.o vgacore.o ddc.o
@LINK_DLL@ svga_cirrus.o vgacore.o ddc.o $(WIN32_DLL_IMPORT_LIBRARY)
bx_voodoo.dll: voodoo.o banshee.o vgacore.o
@LINK_DLL@ voodoo.o banshee.o vgacore.o $(WIN32_DLL_IMPORT_LIBRARY)
bx_voodoo.dll: voodoo.o banshee.o vgacore.o ddc.o
@LINK_DLL@ voodoo.o banshee.o vgacore.o ddc.o $(WIN32_DLL_IMPORT_LIBRARY)
##### end DLL section
@ -138,14 +139,20 @@ banshee.o: banshee.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory-bochs.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h ../pci.h vgacore.h voodoo.h ../virt_timer.h \
../../param_names.h ../pci.h vgacore.h ddc.h voodoo.h ../virt_timer.h \
../../bxthread.h bitblt.h voodoo_types.h voodoo_data.h voodoo_main.h
ddc.o: ddc.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory-bochs.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ddc.h
svga_cirrus.o: svga_cirrus.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \
../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory-bochs.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h vgacore.h bitblt.h svga_cirrus.h ../virt_timer.h
../../param_names.h vgacore.h bitblt.h ddc.h svga_cirrus.h \
../virt_timer.h
vga.o: vga.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h ../../osdep.h \
../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
@ -163,7 +170,7 @@ voodoo.o: voodoo.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h ../../osde
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory-bochs.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h ../pci.h vgacore.h voodoo.h ../virt_timer.h \
../../param_names.h ../pci.h vgacore.h ddc.h voodoo.h ../virt_timer.h \
../../bxthread.h bitblt.h voodoo_types.h voodoo_data.h voodoo_main.h \
voodoo_func.h
banshee.lo: banshee.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \
@ -171,14 +178,20 @@ banshee.lo: banshee.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory-bochs.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h ../pci.h vgacore.h voodoo.h ../virt_timer.h \
../../param_names.h ../pci.h vgacore.h ddc.h voodoo.h ../virt_timer.h \
../../bxthread.h bitblt.h voodoo_types.h voodoo_data.h voodoo_main.h
ddc.lo: ddc.@CPP_SUFFIX@ ../../bochs.h ../../config.h ../../osdep.h \
../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory-bochs.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ddc.h
svga_cirrus.lo: svga_cirrus.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \
../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory-bochs.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h vgacore.h bitblt.h svga_cirrus.h ../virt_timer.h
../../param_names.h vgacore.h bitblt.h ddc.h svga_cirrus.h \
../virt_timer.h
vga.lo: vga.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h ../../osdep.h \
../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
@ -196,6 +209,6 @@ voodoo.lo: voodoo.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h ../../osd
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory-bochs.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h ../pci.h vgacore.h voodoo.h ../virt_timer.h \
../../param_names.h ../pci.h vgacore.h ddc.h voodoo.h ../virt_timer.h \
../../bxthread.h bitblt.h voodoo_types.h voodoo_data.h voodoo_main.h \
voodoo_func.h

View File

@ -68,6 +68,7 @@
#include "pci.h"
#include "vgacore.h"
#include "ddc.h"
#include "voodoo.h"
#include "virt_timer.h"
#include "bxthread.h"
@ -554,7 +555,13 @@ Bit32u bx_banshee_c::read(Bit32u address, unsigned io_len)
break;
case io_vidSerialParallelPort:
result = v->banshee.io[reg] | 0x0f780000;
result = v->banshee.io[reg] & 0xff87ffff;
if ((v->banshee.io[reg] >> 18) & 1) {
result |= ((Bit32u)ddc.read() << 19);
} else {
result |= 0x00780000;
}
result |= 0x0f000000;
break;
default:
@ -719,6 +726,13 @@ void bx_banshee_c::write(Bit32u address, Bit32u value, unsigned io_len)
v->banshee.hwcursor.color[1] = v->banshee.io[reg] & 0xffffff;
break;
case io_vidSerialParallelPort:
v->banshee.io[reg] = value;
if ((v->banshee.io[reg] >> 18) & 1) {
ddc.write((v->banshee.io[reg] >> 19) & 1, (v->banshee.io[reg] >> 20) & 1);
}
break;
case io_vidScreenSize:
BX_LOCK(render_mutex);
v->banshee.io[reg] = value;

View File

@ -0,0 +1,71 @@
/////////////////////////////////////////////////////////////////////////
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 The Bochs Project
//
// 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// DDC stub (when ready, this code should return the VESA EDID for the
// Bochs plug&play monitor)
// 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"
#include "ddc.h"
#define LOG_THIS
bx_ddc_c::bx_ddc_c(void)
{
put("DDC");
s.DCKhost = 1;
s.DDAhost = 1;
s.DCKmon = 1;
s.DDAmon = 1;
s.retval = 0x0f;
}
bx_ddc_c::~bx_ddc_c(void)
{
}
Bit8u bx_ddc_c::read()
{
return s.retval;
}
void bx_ddc_c::write(bx_bool dck, bx_bool dda)
{
if (dck != s.DCKhost) {
BX_INFO(("DCK now %s", dck ? "inactive":"active low"));
s.DCKhost = dck;
}
if (dda != s.DDAhost) {
BX_INFO(("DDA now %s", dda ? "inactive":"active low"));
s.DDAhost = dda;
}
combine_signals();
}
void bx_ddc_c::combine_signals()
{
s.retval = (s.DCKhost & s.DCKmon) << 2;
s.retval |= ((s.DDAhost & s.DDAmon) << 3);
s.retval |= ((s.DDAhost << 1) | s.DCKhost);
}

46
bochs/iodev/display/ddc.h Normal file
View File

@ -0,0 +1,46 @@
////////////////////////////////////////////////////////////////////////
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 The Bochs Project
//
// 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef BX_DISPLAY_DDC_H
#define BX_DISPLAY_DDC_H
class bx_ddc_c : public logfunctions {
public:
bx_ddc_c();
virtual ~bx_ddc_c();
Bit8u read(void);
void write(bx_bool dck, bx_bool dda);
private:
void combine_signals(void);
struct {
bx_bool DCKhost;
bx_bool DDAhost;
bx_bool DCKmon;
bx_bool DDAmon;
Bit8u retval;
} s; // state information
};
#endif

View File

@ -41,6 +41,7 @@
#include "vgacore.h"
#define BX_USE_BINARY_ROP
#include "bitblt.h"
#include "ddc.h"
#include "svga_cirrus.h"
#include "virt_timer.h"
@ -1637,6 +1638,8 @@ void bx_svga_cirrus_c::svga_write_crtc(Bit32u address, unsigned index, Bit8u val
Bit8u bx_svga_cirrus_c::svga_read_sequencer(Bit32u address, unsigned index)
{
Bit8u value;
switch (index) {
case 0x00: // VGA
case 0x01: // VGA
@ -1669,6 +1672,13 @@ Bit8u bx_svga_cirrus_c::svga_read_sequencer(Bit32u address, unsigned index)
case 0xd1:
case 0xf1:
return BX_CIRRUS_THIS sequencer.reg[0x11];
case 0x08: // DDC / EEPROM
if ((BX_CIRRUS_THIS sequencer.reg[0x08] & 0x40) != 0) {
value = BX_CIRRUS_THIS ddc.read();
value = (value & 0x07) | ((value & 0x08) << 4);
return (BX_CIRRUS_THIS sequencer.reg[0x08] & 0x40) | value;
}
break;
default:
BX_DEBUG(("sequencer index 0x%02x is unknown(read)", index));
break;
@ -1727,7 +1737,11 @@ void bx_svga_cirrus_c::svga_write_sequencer(Bit32u address, unsigned index, Bit8
BX_CIRRUS_THIS svga_needs_update_mode = 1;
}
break;
case 0x08:
case 0x08: // DDC / EEPROM
if ((value & 0x40) != 0) {
BX_CIRRUS_THIS ddc.write(value & 1, (value >> 1) & 1);
}
break;
case 0x09:
case 0x0a: // cirrus scratch reg 1
break;

View File

@ -243,6 +243,8 @@ private:
Bit16u x, y, w, h;
} redraw;
bx_ddc_c ddc;
bx_bool is_unlocked() { return svga_unlock_special; }
bx_bool banking_granularity_is_16k() { return !!(control.reg[0x0B] & 0x20); }

View File

@ -68,6 +68,7 @@
#include "pci.h"
#include "vgacore.h"
#include "ddc.h"
#include "voodoo.h"
#include "virt_timer.h"
#include "bxthread.h"

View File

@ -166,6 +166,8 @@ private:
void blt_host_to_screen(void);
void blt_host_to_screen_pattern(void);
void blt_line(bx_bool pline);
bx_ddc_c ddc;
};
class bx_voodoo_vga_c : public bx_vgacore_c {