From: Jean Guyader Date: Thu, 29 Jan 2009 22:50:09 +0000 (+0000) Subject: Read the OpRegion directly from the graphic card and X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=3dd91b7d08f92e9552d967719f50afd7be822b05;p=xenclient%2Fioemu.git Read the OpRegion directly from the graphic card and map it inside the guest. This is a ACPI NVS region (non volatile). The region of the OpRegion of at the offset 0xfc on the pci config space. --- diff --git a/hw/pass-through.c b/hw/pass-through.c index 39f44b99..ec658676 100644 --- a/hw/pass-through.c +++ b/hw/pass-through.c @@ -2937,6 +2937,7 @@ struct pt_dev * register_real_device(PCIBus *e_bus, struct pci_config_cf8 machine_bdf; int free_pci_slot = -1; uint16_t class, vendor_id; + uint32_t opregion; PT_LOG("Assigning real physical device %02x:%02x.%x ...\n", r_bus, r_dev, r_func); @@ -3060,8 +3061,12 @@ struct pt_dev * register_real_device(PCIBus *e_bus, rc |= xc_domain_memory_mapping(xc_handle, domid, 0xa0, 0xa0, 32, DPCI_ADD_MAPPING); if ( vendor_id == 0x8086 ) - rc |= xc_domain_memory_mapping(xc_handle, domid, 0x7d5ae, 0x7d5ae, 2, + { + opregion = pt_pci_host_read_long(0, 2, 0, 0xfc); + PT_LOG("map opregion 0x%x\n", opregion); + rc |= xc_domain_memory_mapping(xc_handle, domid, 0x7d5ae, opregion, 2, DPCI_ADD_MAPPING); + } if ( rc != 0 ) { PT_LOG("legacy mapping failed !\n"); @@ -3086,6 +3091,7 @@ int unregister_real_device(int php_slot) uint32_t bdf = 0; int rc = -1; uint16_t class, vendor_id; + uint32_t opregion; if ( php_slot < 0 || php_slot >= PHP_SLOT_LEN ) return -1; @@ -3138,9 +3144,12 @@ int unregister_real_device(int php_slot) DPCI_REMOVE_MAPPING); rc |= xc_domain_memory_mapping(xc_handle, domid, 0xa0, 0xa0, 32, DPCI_REMOVE_MAPPING); - if ( vendor_id == 0x8086 ) - rc |= xc_domain_memory_mapping(xc_handle, domid, 0x7d5ae, 0x7d5ae, 2, - DPCI_REMOVE_MAPPING); + if ( vendor_id == 0x8086 ) + { + opregion = pt_pci_host_read_long(0, 2, 0, 0xfc); + rc |= xc_domain_memory_mapping(xc_handle, domid, 0x7d5ae, opregion, 2, + DPCI_REMOVE_MAPPING); + } if ( rc != 0 ) { PT_LOG("legacy unmapping failed !\n"); diff --git a/hw/pass-through.h b/hw/pass-through.h index 008de51b..0f3d29b3 100644 --- a/hw/pass-through.h +++ b/hw/pass-through.h @@ -26,7 +26,7 @@ #include "audio/sys-queue.h" /* Log acesss */ -//#define PT_LOGGING_ENABLED +#define PT_LOGGING_ENABLED #ifdef PT_LOGGING_ENABLED #define PT_LOG(_f, _a...) fprintf(logfile, "%s: " _f, __func__, ##_a)