summaryrefslogtreecommitdiff
path: root/packages/qemu/files/qemu-pci-irq-sharing.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packages/qemu/files/qemu-pci-irq-sharing.patch')
-rw-r--r--packages/qemu/files/qemu-pci-irq-sharing.patch52
1 files changed, 52 insertions, 0 deletions
diff --git a/packages/qemu/files/qemu-pci-irq-sharing.patch b/packages/qemu/files/qemu-pci-irq-sharing.patch
new file mode 100644
index 0000000000..c47e89895f
--- /dev/null
+++ b/packages/qemu/files/qemu-pci-irq-sharing.patch
@@ -0,0 +1,52 @@
+diff -pNaur qemu-cvs-ts-orig/hw/pci.c qemu-cvs-ts/hw/pci.c
+--- qemu-cvs-ts-orig/hw/pci.c 2006-08-17 10:46:34.000000000 +0000
++++ qemu-cvs-ts/hw/pci.c 2006-09-23 17:02:41.000000000 +0000
+@@ -34,6 +34,7 @@ struct PCIBus {
+ SetIRQFunc *low_set_irq;
+ void *irq_opaque;
+ PCIDevice *devices[256];
++ int irq_count[4];
+ };
+
+ static void pci_update_mappings(PCIDevice *d);
+@@ -49,6 +50,7 @@ PCIBus *pci_register_bus(pci_set_irq_fn
+ bus->set_irq = set_irq;
+ bus->irq_opaque = pic;
+ bus->devfn_min = devfn_min;
++ memset(bus->irq_count, 0, sizeof(bus->irq_count));
+ first_bus = bus;
+ return bus;
+ }
+@@ -100,6 +102,7 @@ PCIDevice *pci_register_device(PCIBus *b
+ pci_dev->bus = bus;
+ pci_dev->devfn = devfn;
+ pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
++ memset(pci_dev->irq_state, 0, sizeof(pci_dev->irq_state));
+
+ if (!config_read)
+ config_read = pci_default_read_config;
+@@ -404,7 +407,10 @@ uint32_t pci_data_read(void *opaque, uin
+ void pci_set_irq(PCIDevice *pci_dev, int irq_num, int level)
+ {
+ PCIBus *bus = pci_dev->bus;
+- bus->set_irq(pci_dev, bus->irq_opaque, irq_num, level);
++ bus->irq_count[irq_num] += level - pci_dev->irq_state[irq_num];
++ pci_dev->irq_state[irq_num] = level;
++ bus->set_irq(pci_dev, bus->irq_opaque,
++ irq_num, !!bus->irq_count[irq_num]);
+ }
+
+ /***********************************************************/
+diff -pNaur qemu-cvs-ts-orig/vl.h qemu-cvs-ts/vl.h
+--- qemu-cvs-ts-orig/vl.h 2006-09-18 01:15:29.000000000 +0000
++++ qemu-cvs-ts/vl.h 2006-09-23 17:15:21.000000000 +0000
+@@ -733,6 +733,9 @@ struct PCIDevice {
+ PCIConfigWriteFunc *config_write;
+ /* ??? This is a PC-specific hack, and should be removed. */
+ int irq_index;
++
++ /* remember last irq levels */
++ int irq_state[4];
+ };
+
+ PCIDevice *pci_register_device(PCIBus *bus, const char *name,