2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2011-02-25 01:05:47 +03:00
|
|
|
// $Id$
|
2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2018-01-26 12:37:26 +03:00
|
|
|
// Copyright (C) 2002-2018 The Bochs Project
|
2012-01-26 20:35:38 +04:00
|
|
|
// PCI VGA dummy adapter Copyright (C) 2002,2003 Mike Nordell
|
2001-04-10 05:04:59 +04:00
|
|
|
//
|
|
|
|
// 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
|
2009-02-08 12:05:52 +03:00
|
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2009-12-04 22:50:29 +03:00
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2006-03-07 21:16:41 +03:00
|
|
|
#ifndef BX_IODEV_VGA_H
|
|
|
|
#define BX_IODEV_VGA_H
|
|
|
|
|
2011-03-07 22:01:22 +03:00
|
|
|
// Bochs VBE definitions
|
|
|
|
|
|
|
|
#define VBE_DISPI_TOTAL_VIDEO_MEMORY_MB 16
|
|
|
|
#define VBE_DISPI_4BPP_PLANE_SHIFT 22
|
|
|
|
|
|
|
|
#define VBE_DISPI_BANK_ADDRESS 0xA0000
|
|
|
|
#define VBE_DISPI_BANK_SIZE_KB 64
|
|
|
|
|
|
|
|
#define VBE_DISPI_MAX_XRES 2560
|
|
|
|
#define VBE_DISPI_MAX_YRES 1600
|
|
|
|
#define VBE_DISPI_MAX_BPP 32
|
|
|
|
|
|
|
|
#define VBE_DISPI_IOPORT_INDEX 0x01CE
|
|
|
|
#define VBE_DISPI_IOPORT_DATA 0x01CF
|
|
|
|
|
|
|
|
#define VBE_DISPI_INDEX_ID 0x0
|
|
|
|
#define VBE_DISPI_INDEX_XRES 0x1
|
|
|
|
#define VBE_DISPI_INDEX_YRES 0x2
|
|
|
|
#define VBE_DISPI_INDEX_BPP 0x3
|
|
|
|
#define VBE_DISPI_INDEX_ENABLE 0x4
|
|
|
|
#define VBE_DISPI_INDEX_BANK 0x5
|
|
|
|
#define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
|
|
|
|
#define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
|
|
|
|
#define VBE_DISPI_INDEX_X_OFFSET 0x8
|
|
|
|
#define VBE_DISPI_INDEX_Y_OFFSET 0x9
|
|
|
|
#define VBE_DISPI_INDEX_VIDEO_MEMORY_64K 0xa
|
2018-01-26 12:37:26 +03:00
|
|
|
#define VBE_DISPI_INDEX_DDC 0xb
|
2011-03-07 22:01:22 +03:00
|
|
|
|
|
|
|
#define VBE_DISPI_ID0 0xB0C0
|
|
|
|
#define VBE_DISPI_ID1 0xB0C1
|
|
|
|
#define VBE_DISPI_ID2 0xB0C2
|
|
|
|
#define VBE_DISPI_ID3 0xB0C3
|
|
|
|
#define VBE_DISPI_ID4 0xB0C4
|
|
|
|
#define VBE_DISPI_ID5 0xB0C5
|
|
|
|
|
|
|
|
#define VBE_DISPI_BPP_4 0x04
|
|
|
|
#define VBE_DISPI_BPP_8 0x08
|
|
|
|
#define VBE_DISPI_BPP_15 0x0F
|
|
|
|
#define VBE_DISPI_BPP_16 0x10
|
|
|
|
#define VBE_DISPI_BPP_24 0x18
|
|
|
|
#define VBE_DISPI_BPP_32 0x20
|
|
|
|
|
|
|
|
#define VBE_DISPI_DISABLED 0x00
|
|
|
|
#define VBE_DISPI_ENABLED 0x01
|
|
|
|
#define VBE_DISPI_GETCAPS 0x02
|
|
|
|
#define VBE_DISPI_8BIT_DAC 0x20
|
|
|
|
#define VBE_DISPI_LFB_ENABLED 0x40
|
|
|
|
#define VBE_DISPI_NOCLEARMEM 0x80
|
|
|
|
|
|
|
|
#define VBE_DISPI_LFB_PHYSICAL_ADDRESS 0xE0000000
|
|
|
|
|
|
|
|
#define VBE_DISPI_TOTAL_VIDEO_MEMORY_KB (VBE_DISPI_TOTAL_VIDEO_MEMORY_MB * 1024)
|
|
|
|
#define VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES (VBE_DISPI_TOTAL_VIDEO_MEMORY_KB * 1024)
|
|
|
|
|
|
|
|
// End Bochs VBE definitions
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
#if BX_USE_VGA_SMF
|
|
|
|
# define BX_VGA_SMF static
|
2002-10-25 01:07:56 +04:00
|
|
|
# define BX_VGA_THIS theVga->
|
2009-04-10 15:10:32 +04:00
|
|
|
# define BX_VGA_THIS_PTR theVga
|
2001-04-10 05:04:59 +04:00
|
|
|
#else
|
|
|
|
# define BX_VGA_SMF
|
|
|
|
# define BX_VGA_THIS this->
|
2009-04-10 15:10:32 +04:00
|
|
|
# define BX_VGA_THIS_PTR this
|
2001-04-10 05:04:59 +04:00
|
|
|
#endif
|
|
|
|
|
2012-01-25 01:58:24 +04:00
|
|
|
class bx_vga_c : public bx_vgacore_c {
|
2001-04-10 05:04:59 +04:00
|
|
|
public:
|
2006-03-08 00:11:20 +03:00
|
|
|
bx_vga_c();
|
|
|
|
virtual ~bx_vga_c();
|
2012-01-26 20:35:38 +04:00
|
|
|
virtual void reset(unsigned type);
|
2008-04-30 02:14:23 +04:00
|
|
|
BX_VGA_SMF bx_bool mem_read_handler(bx_phy_address addr, unsigned len, void *data, void *param);
|
|
|
|
BX_VGA_SMF bx_bool mem_write_handler(bx_phy_address addr, unsigned len, void *data, void *param);
|
|
|
|
virtual Bit8u mem_read(bx_phy_address addr);
|
|
|
|
virtual void mem_write(bx_phy_address addr, Bit8u value);
|
2006-05-27 19:54:49 +04:00
|
|
|
virtual void register_state(void);
|
|
|
|
virtual void after_restore_state(void);
|
2009-04-22 00:27:35 +04:00
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
virtual void redraw_area(unsigned x0, unsigned y0,
|
|
|
|
unsigned width, unsigned height);
|
|
|
|
|
2017-10-12 22:18:23 +03:00
|
|
|
virtual bx_bool init_vga_extension(void);
|
2012-01-26 20:35:38 +04:00
|
|
|
|
|
|
|
#if BX_SUPPORT_PCI
|
2017-03-24 22:57:25 +03:00
|
|
|
virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);
|
2018-02-04 12:41:50 +03:00
|
|
|
virtual void pci_bar_change_notify(void);
|
2012-01-26 20:35:38 +04:00
|
|
|
#endif
|
2012-03-11 16:17:41 +04:00
|
|
|
#if BX_DEBUGGER
|
2017-03-24 22:57:25 +03:00
|
|
|
virtual void debug_dump(int argc, char **argv);
|
2012-03-11 16:17:41 +04:00
|
|
|
#endif
|
2012-01-26 20:35:38 +04:00
|
|
|
|
2004-08-16 12:07:23 +04:00
|
|
|
protected:
|
2001-04-10 05:04:59 +04:00
|
|
|
static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
|
2008-09-19 00:10:17 +04:00
|
|
|
#if BX_USE_VGA_SMF
|
2001-04-10 05:04:59 +04:00
|
|
|
static void write_handler_no_log(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
|
2008-09-19 00:10:17 +04:00
|
|
|
#endif
|
2009-01-31 21:13:17 +03:00
|
|
|
void write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log);
|
|
|
|
|
2017-10-08 10:55:04 +03:00
|
|
|
virtual void update(void);
|
2011-03-07 22:01:22 +03:00
|
|
|
|
|
|
|
// Bochs VBE section
|
|
|
|
BX_VGA_SMF Bit8u vbe_mem_read(bx_phy_address addr) BX_CPP_AttrRegparmN(1);
|
|
|
|
BX_VGA_SMF void vbe_mem_write(bx_phy_address addr, Bit8u value) BX_CPP_AttrRegparmN(2);
|
|
|
|
|
|
|
|
static Bit32u vbe_read_handler(void *this_ptr, Bit32u address, unsigned io_len);
|
|
|
|
static void vbe_write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
|
|
|
|
|
|
|
|
#if BX_USE_VGA_SMF == 0
|
|
|
|
Bit32u vbe_read(Bit32u address, unsigned io_len);
|
|
|
|
void vbe_write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log);
|
|
|
|
#endif
|
|
|
|
|
2011-07-03 19:31:16 +04:00
|
|
|
private:
|
2012-01-26 20:35:38 +04:00
|
|
|
bx_bool vbe_present;
|
2009-01-31 21:13:17 +03:00
|
|
|
struct {
|
|
|
|
Bit16u cur_dispi;
|
2009-04-10 15:10:32 +04:00
|
|
|
Bit32u base_address;
|
2009-01-31 21:13:17 +03:00
|
|
|
Bit16u xres;
|
|
|
|
Bit16u yres;
|
|
|
|
Bit16u bpp;
|
|
|
|
Bit16u max_xres;
|
|
|
|
Bit16u max_yres;
|
|
|
|
Bit16u max_bpp;
|
|
|
|
Bit16u bank;
|
|
|
|
bx_bool enabled;
|
|
|
|
Bit16u curindex;
|
|
|
|
Bit32u visible_screen_size; /**< in bytes */
|
|
|
|
Bit16u offset_x; /**< Virtual screen x start (in pixels) */
|
|
|
|
Bit16u offset_y; /**< Virtual screen y start (in pixels) */
|
|
|
|
Bit16u virtual_xres;
|
|
|
|
Bit16u virtual_yres;
|
|
|
|
Bit32u virtual_start; /**< For dealing with bpp>8, this is where the virtual screen starts. */
|
|
|
|
Bit8u bpp_multiplier; /**< We have to save this b/c sometimes we need to recalculate stuff with it. */
|
|
|
|
bx_bool lfb_enabled;
|
|
|
|
bx_bool get_capabilities;
|
|
|
|
bx_bool dac_8bit;
|
2018-01-26 12:37:26 +03:00
|
|
|
bx_bool ddc_enabled;
|
2009-01-31 21:13:17 +03:00
|
|
|
} vbe; // VBE state information
|
2018-01-26 12:37:26 +03:00
|
|
|
|
|
|
|
bx_ddc_c ddc;
|
2006-03-07 21:16:41 +03:00
|
|
|
};
|
2004-08-16 12:07:23 +04:00
|
|
|
|
2006-03-07 21:16:41 +03:00
|
|
|
#endif
|