From 9ca8344cfaa6adc887d50c322bdd82ac69588e87 Mon Sep 17 00:00:00 2001 From: Jean Guyader Date: Thu, 9 Oct 2008 17:51:19 +0100 Subject: [PATCH] - Pass through some value of the real host in case of intel graphic card. The graphic card need the know how much merroy has been stolen from the physical RAM. --- hw/pci.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/hw/pci.c b/hw/pci.c index 1de68fdd..067fd0cf 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -25,6 +25,7 @@ #include "pci.h" #include "console.h" #include "net.h" +#include "pass-through.h" //#define DEBUG_PCI @@ -52,6 +53,8 @@ static void pci_set_irq(void *opaque, int irq_num, int level); target_phys_addr_t pci_mem_base; static PCIBus *first_bus; +extern int vga_passthrough; + static int pcibus_load(QEMUFile *f, void *opaque, int version_id) { int i, nirq; @@ -441,7 +444,7 @@ uint32_t pci_data_read(void *opaque, uint32_t addr, int len) PCIBus *s = opaque; PCIDevice *pci_dev; int config_addr, bus_num; - uint32_t val; + uint32_t val = 0; bus_num = (addr >> 16) & 0xff; while (s && s->bus_num != bus_num) @@ -466,6 +469,19 @@ uint32_t pci_data_read(void *opaque, uint32_t addr, int len) goto the_end; } config_addr = addr & 0xff; + + + if (vga_passthrough && pci_dev->devfn == 0x00) //Host Bridge + { + if (config_addr == 0x52) // GMCH + val = pt_pci_host_read_word(0, 0, 0, 0x52); + if (config_addr == 0xa0) // Top of memory + val = pt_pci_host_read_byte(0, 0, 0, 0xa0); + if (config_addr == 0x02) // Device ID + val = pt_pci_host_read_byte(0, 0, 0, 0x02); + goto the_end; + } + val = pci_dev->config_read(pci_dev, config_addr, len); #if defined(DEBUG_PCI) printf("pci_config_read: %s: addr=%02x val=%08x len=%d\n", -- 2.39.5