]> xenbits.xensource.com Git - qemu-xen-4.0-testing.git/commitdiff
hw/pass-through.c: workaround for old libpci
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 6 Feb 2009 16:16:06 +0000 (16:16 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 6 Feb 2009 16:16:06 +0000 (16:16 +0000)
Old versions of libpci (including the ones on the automatic tests
which control Xen staging propagation) do not define
PCI_LIB_VERSION or the PCI_ERR_{UNCOR_MASK,...} constants.

This means that change 8c771eb6294afc5b3754a9e3de51568d4e5986c2 breaks
the build.  In this changeset I apply what is intended to be a
workaround for this problem but it may not be completely correct; this
is therefore perhaps an interim fix.

The potential problem is that the save/restore of some PCI passthrough
error handling registers (across suspend/resume) may not work properly
with old versions of libpci.  However non-passthrough and non-suspect
use cases should now be fine.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
hw/pass-through.c

index 8dfae3c1be9625b9fa6394bf5c7dfa3d57a57a8a..29714c7ee094c44bac34f3d61015aa045b3056ea 100644 (file)
@@ -1503,7 +1503,7 @@ exit:
 
 static void pt_libpci_fixup(struct pci_dev *dev)
 {
-#if PCI_LIB_VERSION < 0x030100
+#if !defined(PCI_LIB_VERSION) || PCI_LIB_VERSION < 0x030100
     int i;
     FILE *fp;
     char path[PATH_MAX], buf[256];
@@ -1850,6 +1850,7 @@ static void pt_aer_reg_save(struct pt_dev *ptdev)
     /* Root Port and Root Complex Event Collector need size expansion */
     int aer_size = 0x2c;
 
+#ifdef PCI_ERR_UNCOR_MASK
     for (i=0; i < aer_size; i+=4)
     {
         switch (i) {
@@ -1867,6 +1868,7 @@ static void pt_aer_reg_save(struct pt_dev *ptdev)
             break;
         }
     }
+#endif
 }
 
 /* restore AER register */
@@ -1879,6 +1881,7 @@ static void pt_aer_reg_restore(struct pt_dev *ptdev)
     /* Root Port and Root Complex Event Collector need size expansion */
     int aer_size = 0x2c;
 
+#ifdef PCI_ERR_UNCOR_MASK
     for (i=0; i < aer_size; i+=4)
     {
         switch (i) {
@@ -1899,6 +1902,7 @@ static void pt_aer_reg_restore(struct pt_dev *ptdev)
             break;
         }
     }
+#endif
 }
 
 /* reset Interrupt and I/O resource  */