- implemented changeable VBE LFB base address (TODO: update PCIBIOS init)
This commit is contained in:
parent
e4f0de41e3
commit
b6a2eca248
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: devices.cc,v 1.144 2009-03-03 20:34:50 vruppert Exp $
|
||||
// $Id: devices.cc,v 1.145 2009-04-10 11:10:32 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -110,7 +110,7 @@ void bx_devices_c::init(BX_MEM_C *newmem)
|
||||
const char *plugname;
|
||||
#endif
|
||||
|
||||
BX_DEBUG(("Init $Id: devices.cc,v 1.144 2009-03-03 20:34:50 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: devices.cc,v 1.145 2009-04-10 11:10:32 vruppert Exp $"));
|
||||
mem = newmem;
|
||||
|
||||
/* set builtin default handlers, will be overwritten by the real default handler */
|
||||
@ -247,7 +247,7 @@ void bx_devices_c::init(BX_MEM_C *newmem)
|
||||
|
||||
#if BX_SUPPORT_PCI
|
||||
if (SIM->get_param_bool(BXPN_I440FX_SUPPORT)->get()) {
|
||||
#if BX_SUPPORT_PCIVGA
|
||||
#if BX_SUPPORT_PCIVGA && BX_SUPPORT_VBE
|
||||
if ((DEV_is_pci_device("pcivga")) &&
|
||||
(!strcmp(SIM->get_param_string(BXPN_VGA_EXTENSION)->getptr(), "vbe"))) {
|
||||
PLUG_load_plugin(pcivga, PLUGTYPE_OPTIONAL);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pcivga.cc,v 1.24 2009-02-08 09:05:52 vruppert Exp $
|
||||
// $Id: pcivga.cc,v 1.25 2009-04-10 11:10:32 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002,2003 Mike Nordell
|
||||
@ -38,7 +38,6 @@
|
||||
#if BX_SUPPORT_PCI && BX_SUPPORT_PCIVGA
|
||||
|
||||
#include "pci.h"
|
||||
#include "vga.h"
|
||||
#include "pcivga.h"
|
||||
|
||||
#define LOG_THIS thePciVgaAdapter->
|
||||
@ -98,6 +97,8 @@ void bx_pcivga_c::init(void)
|
||||
for (i = 0; i < sizeof(init_vals) / sizeof(*init_vals); ++i) {
|
||||
BX_PCIVGA_THIS s.pci_conf[init_vals[i].addr] = init_vals[i].val;
|
||||
}
|
||||
WriteHostDWordToLittleEndian(&BX_PCIVGA_THIS s.pci_conf[0x10], 0x08);
|
||||
BX_PCIVGA_THIS s.base_address = 0;
|
||||
}
|
||||
|
||||
void bx_pcivga_c::reset(unsigned type)
|
||||
@ -112,9 +113,6 @@ void bx_pcivga_c::reset(unsigned type)
|
||||
for (unsigned i = 0; i < sizeof(reset_vals) / sizeof(*reset_vals); ++i) {
|
||||
BX_PCIVGA_THIS s.pci_conf[reset_vals[i].addr] = reset_vals[i].val;
|
||||
}
|
||||
// FIXME: LFB address should be changeable
|
||||
WriteHostDWordToLittleEndian(&BX_PCIVGA_THIS s.pci_conf[0x10],
|
||||
VBE_DISPI_LFB_PHYSICAL_ADDRESS | 0x08);
|
||||
}
|
||||
|
||||
void bx_pcivga_c::register_state(void)
|
||||
@ -123,6 +121,14 @@ void bx_pcivga_c::register_state(void)
|
||||
register_pci_state(list, BX_PCIVGA_THIS s.pci_conf);
|
||||
}
|
||||
|
||||
void bx_pcivga_c::after_restore_state(void)
|
||||
{
|
||||
if (((bx_vga_c*)bx_devices.pluginVgaDevice)->vbe_set_base_addr(
|
||||
&BX_PCIVGA_THIS s.base_address, &BX_PCIVGA_THIS s.pci_conf[0x10])) {
|
||||
BX_INFO(("new base address: 0x%08x", BX_PCIVGA_THIS s.base_address));
|
||||
}
|
||||
}
|
||||
|
||||
// pci configuration space read callback handler
|
||||
Bit32u bx_pcivga_c::pci_read_handler(Bit8u address, unsigned io_len)
|
||||
{
|
||||
@ -188,7 +194,6 @@ void bx_pcivga_c::pci_write_handler(Bit8u address, Bit32u value, unsigned io_len
|
||||
unsigned i;
|
||||
unsigned write_addr;
|
||||
Bit8u new_value, old_value;
|
||||
Bit32u mask, value32;
|
||||
bx_bool baseaddr_change = 0;
|
||||
|
||||
if ((address >= 0x14) && (address < 0x34))
|
||||
@ -222,11 +227,10 @@ void bx_pcivga_c::pci_write_handler(Bit8u address, Bit32u value, unsigned io_len
|
||||
strcat(szTmp, szTmp2);
|
||||
}
|
||||
if (baseaddr_change) {
|
||||
// FIXME: implement changeable LFB address
|
||||
ReadHostDWordFromLittleEndian(&BX_PCIVGA_THIS s.pci_conf[0x10], value32);
|
||||
mask = ~((VBE_DISPI_TOTAL_VIDEO_MEMORY_MB << 20) - 1);
|
||||
value32 &= mask;
|
||||
WriteHostDWordToLittleEndian(&BX_PCIVGA_THIS s.pci_conf[0x10], value32);
|
||||
if (((bx_vga_c*)bx_devices.pluginVgaDevice)->vbe_set_base_addr(
|
||||
&BX_PCIVGA_THIS s.base_address, &BX_PCIVGA_THIS s.pci_conf[0x10])) {
|
||||
BX_INFO(("new base address: 0x%08x", BX_PCIVGA_THIS s.base_address));
|
||||
}
|
||||
}
|
||||
strrev(szTmp);
|
||||
BX_DEBUG(("Experimental PCIVGA write register 0x%02x value 0x%s", address, szTmp));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pcivga.h,v 1.9 2009-02-08 09:05:52 vruppert Exp $
|
||||
// $Id: pcivga.h,v 1.10 2009-04-10 11:10:32 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002,2003 Mike Nordell
|
||||
@ -34,12 +34,14 @@ public:
|
||||
virtual void init(void);
|
||||
virtual void reset(unsigned type);
|
||||
virtual void register_state(void);
|
||||
virtual void after_restore_state(void);
|
||||
|
||||
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
|
||||
virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);
|
||||
|
||||
private:
|
||||
struct {
|
||||
Bit32u base_address;
|
||||
Bit8u pci_conf[256];
|
||||
} s;
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: vga.cc,v 1.162 2009-02-08 09:05:52 vruppert Exp $
|
||||
// $Id: vga.cc,v 1.163 2009-04-10 11:10:32 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -291,10 +291,20 @@ void bx_vga_c::init(void)
|
||||
DEV_register_ioread_handler(this, vbe_read_handler, addr, "vga video", 7);
|
||||
DEV_register_iowrite_handler(this, vbe_write_handler, addr, "vga video", 7);
|
||||
}
|
||||
DEV_register_memory_handlers(theVga, mem_read_handler, mem_write_handler,
|
||||
VBE_DISPI_LFB_PHYSICAL_ADDRESS,
|
||||
VBE_DISPI_LFB_PHYSICAL_ADDRESS + VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES - 1);
|
||||
#if BX_SUPPORT_PCI
|
||||
if ((SIM->get_param_bool(BXPN_I440FX_SUPPORT)->get()) &&
|
||||
(DEV_is_pci_device(BX_PLUGIN_PCIVGA))) {
|
||||
BX_VGA_THIS vbe.base_address = 0x0000;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
BX_VGA_THIS vbe.base_address = VBE_DISPI_LFB_PHYSICAL_ADDRESS;
|
||||
DEV_register_memory_handlers(theVga, mem_read_handler, mem_write_handler,
|
||||
BX_VGA_THIS vbe.base_address,
|
||||
BX_VGA_THIS vbe.base_address + VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES - 1);
|
||||
|
||||
}
|
||||
if (BX_VGA_THIS s.memory == NULL)
|
||||
BX_VGA_THIS s.memory = new Bit8u[VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES];
|
||||
memset(BX_VGA_THIS s.memory, 0, VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES);
|
||||
@ -2218,7 +2228,7 @@ Bit8u bx_vga_c::mem_read(bx_phy_address addr)
|
||||
{
|
||||
return vbe_mem_read(addr);
|
||||
}
|
||||
else if (addr >= VBE_DISPI_LFB_PHYSICAL_ADDRESS)
|
||||
else if ((BX_VGA_THIS vbe.base_address != 0) && (addr >= BX_VGA_THIS vbe.base_address))
|
||||
{
|
||||
return 0xff;
|
||||
}
|
||||
@ -2357,7 +2367,7 @@ void bx_vga_c::mem_write(bx_phy_address addr, Bit8u value)
|
||||
vbe_mem_write(addr, value);
|
||||
return;
|
||||
}
|
||||
else if (addr >= VBE_DISPI_LFB_PHYSICAL_ADDRESS)
|
||||
else if ((BX_VGA_THIS vbe.base_address != 0) && (addr >= BX_VGA_THIS vbe.base_address))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -2934,15 +2944,26 @@ void bx_vga_c::redraw_area(unsigned x0, unsigned y0, unsigned width,
|
||||
|
||||
|
||||
#if BX_SUPPORT_VBE
|
||||
bx_bool bx_vga_c::vbe_set_base_addr(Bit32u *addr, Bit8u *pci_conf)
|
||||
{
|
||||
if (DEV_pci_set_base_mem(BX_VGA_THIS_PTR, mem_read_handler,
|
||||
mem_write_handler,
|
||||
addr, pci_conf, VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES)) {
|
||||
BX_VGA_THIS vbe.base_address = *addr;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Bit8u BX_CPP_AttrRegparmN(1)
|
||||
bx_vga_c::vbe_mem_read(bx_phy_address addr)
|
||||
{
|
||||
Bit32u offset;
|
||||
|
||||
if (addr >= VBE_DISPI_LFB_PHYSICAL_ADDRESS)
|
||||
if (addr >= BX_VGA_THIS vbe.base_address)
|
||||
{
|
||||
// LFB read
|
||||
offset = addr - VBE_DISPI_LFB_PHYSICAL_ADDRESS;
|
||||
offset = addr - BX_VGA_THIS vbe.base_address;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2965,10 +2986,10 @@ bx_vga_c::vbe_mem_write(bx_phy_address addr, Bit8u value)
|
||||
|
||||
if (BX_VGA_THIS vbe.lfb_enabled)
|
||||
{
|
||||
if (addr >= VBE_DISPI_LFB_PHYSICAL_ADDRESS)
|
||||
if (addr >= BX_VGA_THIS vbe.base_address)
|
||||
{
|
||||
// LFB write
|
||||
offset = addr - VBE_DISPI_LFB_PHYSICAL_ADDRESS;
|
||||
offset = addr - BX_VGA_THIS vbe.base_address;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2978,7 +2999,7 @@ bx_vga_c::vbe_mem_write(bx_phy_address addr, Bit8u value)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (addr < VBE_DISPI_LFB_PHYSICAL_ADDRESS)
|
||||
if (addr < BX_VGA_THIS vbe.base_address)
|
||||
{
|
||||
// banked mode write
|
||||
offset = (BX_VGA_THIS vbe.bank*65536) + (addr - 0xA0000);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: vga.h,v 1.69 2009-02-08 09:05:52 vruppert Exp $
|
||||
// $Id: vga.h,v 1.70 2009-04-10 11:10:32 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -121,9 +121,11 @@
|
||||
#if BX_USE_VGA_SMF
|
||||
# define BX_VGA_SMF static
|
||||
# define BX_VGA_THIS theVga->
|
||||
# define BX_VGA_THIS_PTR theVga
|
||||
#else
|
||||
# define BX_VGA_SMF
|
||||
# define BX_VGA_THIS this->
|
||||
# define BX_VGA_THIS_PTR this
|
||||
#endif
|
||||
|
||||
class bx_vga_c : public bx_vga_stub_c {
|
||||
@ -142,8 +144,9 @@ public:
|
||||
virtual void after_restore_state(void);
|
||||
|
||||
#if BX_SUPPORT_VBE
|
||||
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);
|
||||
BX_VGA_SMF bx_bool vbe_set_base_addr(Bit32u *addr, Bit8u *pci_conf);
|
||||
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);
|
||||
#endif
|
||||
|
||||
virtual void redraw_area(unsigned x0, unsigned y0,
|
||||
@ -306,6 +309,7 @@ protected:
|
||||
#if BX_SUPPORT_VBE
|
||||
struct {
|
||||
Bit16u cur_dispi;
|
||||
Bit32u base_address;
|
||||
Bit16u xres;
|
||||
Bit16u yres;
|
||||
Bit16u bpp;
|
||||
|
Loading…
Reference in New Issue
Block a user