HVM device passthru: Correct PCI_EXP_DEVCTL_FLR
authorKeir Fraser <keir@xensource.com>
Wed, 7 Nov 2007 09:21:16 +0000 (09:21 +0000)
committerKeir Fraser <keir@xensource.com>
Wed, 7 Nov 2007 09:21:16 +0000 (09:21 +0000)
This patch corrects PCI_EXP_DEVCTL_FLR so that function level reset
will be really executed, and also replaces some magic numbers with
macros.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Weidong Han <weidong.han@intel.com>
tools/ioemu/hw/pass-through.c
tools/ioemu/hw/pass-through.h

index 7dd9588ba080ee7e7154fa6b81a6383895616a44..8645faa29de61da250c806ce5036bb1077eb2d90 100644 (file)
@@ -127,9 +127,10 @@ void pt_iomem_map(PCIDevice *d, int i, uint32_t e_phys, uint32_t e_size,
     if ( !first_map )
     {
         /* Remove old mapping */
-        ret = xc_domain_memory_mapping(xc_handle, domid, old_ebase >> 12,
-                assigned_device->bases[i].access.maddr >> 12,
-                (e_size+0xFFF) >> 12,
+        ret = xc_domain_memory_mapping(xc_handle, domid,
+                old_ebase >> PAGE_SHIFT,
+                assigned_device->bases[i].access.maddr >> PAGE_SHIFT,
+                (e_size+PAGE_MASK) >> PAGE_SHIFT,
                 DPCI_REMOVE_MAPPING);
         if ( ret != 0 )
         {
@@ -140,9 +141,9 @@ void pt_iomem_map(PCIDevice *d, int i, uint32_t e_phys, uint32_t e_size,
 
     /* Create new mapping */
     ret = xc_domain_memory_mapping(xc_handle, domid,
-            assigned_device->bases[i].e_physbase >> 12,
-            assigned_device->bases[i].access.maddr >> 12,
-            (e_size+0xFFF) >> 12,
+            assigned_device->bases[i].e_physbase >> PAGE_SHIFT,
+            assigned_device->bases[i].access.maddr >> PAGE_SHIFT,
+            (e_size+PAGE_MASK) >> PAGE_SHIFT,
             DPCI_ADD_MAPPING);
     if ( ret != 0 )
         PT_LOG("Error: create new mapping failed!\n");
index 42f7b52d74520d6ff4a90314ea8bf2b144a3aa3e..b05527330a1bcde74056d0599d30f1d7b967804a 100644 (file)
@@ -40,7 +40,7 @@
 /* Misc PCI constants that should be moved to a separate library :) */
 #define PCI_CONFIG_SIZE         (256)
 #define PCI_EXP_DEVCAP_FLR      (1 << 28)
-#define PCI_EXP_DEVCTL_FLR      (0x1b)
+#define PCI_EXP_DEVCTL_FLR      (1 << 15)
 #define PCI_BAR_ENTRIES         (6)
 
 struct pt_region {