]> xenbits.xensource.com Git - xenclient/ioemu.git/commitdiff
Read the OpRegion directly from the graphic card and
authorJean Guyader <jean.guyader@eu.citrix.com>
Thu, 29 Jan 2009 22:50:09 +0000 (22:50 +0000)
committerJean Guyader <jean.guyader@eu.citrix.com>
Thu, 29 Jan 2009 22:50:09 +0000 (22:50 +0000)
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.

hw/pass-through.c
hw/pass-through.h

index 39f44b999fe5383b7252e2fdf1710f71b81fc062..ec6586761f16cca237ec5f88d624cb140d1b9f41 100644 (file)
@@ -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");
index 008de51bee31777e4cbcce76fcf53568d4ec2831..0f3d29b3d6dc01bf3ec15d0a2b831ea4a51af7b5 100644 (file)
@@ -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)