diff --git a/bochs/iodev/display/Makefile.in b/bochs/iodev/display/Makefile.in index 32092bd20..efe5c67d0 100644 --- a/bochs/iodev/display/Makefile.in +++ b/bochs/iodev/display/Makefile.in @@ -93,8 +93,8 @@ libbx_%.la: %.lo $(LIBTOOL) --mode=link --tag CXX $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) # special link rules for plugins that require more than one object file -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_vga.la: vga.lo vgacore.lo ddc.lo + $(LIBTOOL) --mode=link --tag CXX $(CXX) -module vga.lo vgacore.lo ddc.lo -o libbx_vga.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) @@ -107,8 +107,8 @@ bx_%.dll: %.o $(CXX) $(CXXFLAGS) -shared -o $@ $< $(WIN32_DLL_IMPORT_LIBRARY) # special link rules for plugins with Cygwin, MinGW/MSYS and MSVC nmake -bx_vga.dll: vga.o vgacore.o - @LINK_DLL@ vga.o vgacore.o $(WIN32_DLL_IMPORT_LIBRARY) +bx_vga.dll: vga.o vgacore.o ddc.o + @LINK_DLL@ vga.o vgacore.o ddc.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) @@ -158,7 +158,7 @@ vga.o: vga.@CPP_SUFFIX@ ../iodev.h ../../bochs.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 vga.h ../virt_timer.h + ../../param_names.h vgacore.h ddc.h vga.h ../virt_timer.h vgacore.o: vgacore.@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 \ @@ -197,7 +197,7 @@ vga.lo: vga.@CPP_SUFFIX@ ../iodev.h ../../bochs.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 vga.h ../virt_timer.h + ../../param_names.h vgacore.h ddc.h vga.h ../virt_timer.h vgacore.lo: vgacore.@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 \ diff --git a/bochs/iodev/display/vga.cc b/bochs/iodev/display/vga.cc index edfbe1520..bb7845bf9 100644 --- a/bochs/iodev/display/vga.cc +++ b/bochs/iodev/display/vga.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2002-2017 The Bochs Project +// Copyright (C) 2002-2018 The Bochs Project // PCI VGA dummy adapter Copyright (C) 2002,2003 Mike Nordell // // This library is free software; you can redistribute it and/or @@ -36,6 +36,7 @@ #include "iodev.h" #include "vgacore.h" +#include "ddc.h" #include "vga.h" #include "virt_timer.h" @@ -84,6 +85,7 @@ bx_bool bx_vga_c::init_vga_extension(void) BX_VGA_THIS vbe_present = 0; BX_VGA_THIS vbe.enabled = 0; BX_VGA_THIS vbe.dac_8bit = 0; + BX_VGA_THIS vbe.ddc_enabled = 0; BX_VGA_THIS vbe.base_address = 0x0000; if (!strcmp(BX_VGA_THIS vgaext->getptr(), "vbe")) { BX_VGA_THIS put("BXVGA"); @@ -212,6 +214,7 @@ void bx_vga_c::register_state(void) new bx_shadow_bool_c(vbe, "lfb_enabled", &BX_VGA_THIS vbe.lfb_enabled); new bx_shadow_bool_c(vbe, "get_capabilities", &BX_VGA_THIS vbe.get_capabilities); new bx_shadow_bool_c(vbe, "dac_8bit", &BX_VGA_THIS vbe.dac_8bit); + new bx_shadow_bool_c(vbe, "ddc_enabled", &BX_VGA_THIS vbe.ddc_enabled); } } @@ -846,7 +849,7 @@ Bit32u bx_vga_c::vbe_read(Bit32u address, unsigned io_len) #else UNUSED(this_ptr); #endif // BX_USE_VGA_SMF == 0 - Bit16u retval; + Bit16u retval = 0; // BX_INFO(("VBE_read %x (len %x)", address, io_len)); @@ -911,13 +914,20 @@ Bit32u bx_vga_c::vbe_read(Bit32u address, unsigned io_len) case VBE_DISPI_INDEX_VIDEO_MEMORY_64K: return (VBE_DISPI_TOTAL_VIDEO_MEMORY_KB >> 6); + case VBE_DISPI_INDEX_DDC: + if (BX_VGA_THIS vbe.ddc_enabled) { + retval = (1 << 7) | BX_VGA_THIS ddc.read(); + } else { + retval = 0x000f; + } + break; + default: - BX_PANIC(("VBE unknown data read index 0x%x",BX_VGA_THIS vbe.curindex)); + BX_ERROR(("VBE unknown data read index 0x%x",BX_VGA_THIS vbe.curindex)); break; } } - BX_PANIC(("VBE_read shouldn't reach this")); - return 0; /* keep compiler happy */ + return retval; } void bx_vga_c::vbe_write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len) @@ -1265,6 +1275,14 @@ Bit32u bx_vga_c::vbe_write(Bit32u address, Bit32u value, unsigned io_len) case VBE_DISPI_INDEX_VIRT_HEIGHT: BX_ERROR(("VBE: write to virtual height register ignored")); break; + case VBE_DISPI_INDEX_DDC: + if ((value >> 7) & 1) { + BX_VGA_THIS vbe.ddc_enabled = 1; + BX_VGA_THIS ddc.write(value & 1, (value >> 1) & 1); + } else { + BX_VGA_THIS vbe.ddc_enabled = 0; + } + break; default: BX_ERROR(("VBE: write unsupported register at index 0x%x",BX_VGA_THIS vbe.curindex)); break; diff --git a/bochs/iodev/display/vga.h b/bochs/iodev/display/vga.h index c61eaa20b..2bc75babd 100644 --- a/bochs/iodev/display/vga.h +++ b/bochs/iodev/display/vga.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2002-2017 The Bochs Project +// Copyright (C) 2002-2018 The Bochs Project // PCI VGA dummy adapter Copyright (C) 2002,2003 Mike Nordell // // This library is free software; you can redistribute it and/or @@ -50,6 +50,7 @@ #define VBE_DISPI_INDEX_X_OFFSET 0x8 #define VBE_DISPI_INDEX_Y_OFFSET 0x9 #define VBE_DISPI_INDEX_VIDEO_MEMORY_64K 0xa +#define VBE_DISPI_INDEX_DDC 0xb #define VBE_DISPI_ID0 0xB0C0 #define VBE_DISPI_ID1 0xB0C1 @@ -162,7 +163,10 @@ private: bx_bool lfb_enabled; bx_bool get_capabilities; bx_bool dac_8bit; + bx_bool ddc_enabled; } vbe; // VBE state information + + bx_ddc_c ddc; }; #endif