aboutsummaryrefslogtreecommitdiffstats
path: root/xen-all.c
diff options
context:
space:
mode:
authorAnthony PERARD <anthony.perard@citrix.com>2010-07-16 14:55:39 +0100
committerAlexander Graf <agraf@suse.de>2011-05-08 10:10:00 +0200
commit4144530012793e6cd479eaa90cceb1aef0de8158 (patch)
tree03d74f1bff6a92cd502a1752aaf34780f268a44f /xen-all.c
parent1611977c3d8fdbdac6090cbd1f5555cee4aed6d9 (diff)
piix_pci: Introduces Xen specific call for irq.
This patch introduces Xen specific call in piix_pci. The specific part for Xen is in write_config, set_irq and get_pirq. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Alexander Graf <agraf@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'xen-all.c')
-rw-r--r--xen-all.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/xen-all.c b/xen-all.c
index 0b984b25a..acb051cff 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -6,9 +6,40 @@
*
*/
+#include "hw/pci.h"
#include "hw/xen_common.h"
#include "hw/xen_backend.h"
+/* Xen specific function for piix pci */
+
+int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num)
+{
+ return irq_num + ((pci_dev->devfn >> 3) << 2);
+}
+
+void xen_piix3_set_irq(void *opaque, int irq_num, int level)
+{
+ xc_hvm_set_pci_intx_level(xen_xc, xen_domid, 0, 0, irq_num >> 2,
+ irq_num & 3, level);
+}
+
+void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len)
+{
+ int i;
+
+ /* Scan for updates to PCI link routes (0x60-0x63). */
+ for (i = 0; i < len; i++) {
+ uint8_t v = (val >> (8 * i)) & 0xff;
+ if (v & 0x80) {
+ v = 0;
+ }
+ v &= 0xf;
+ if (((address + i) >= 0x60) && ((address + i) <= 0x63)) {
+ xc_hvm_set_pci_link_route(xen_xc, xen_domid, address + i - 0x60, v);
+ }
+ }
+}
+
/* VCPU Operations, MMIO, IO ring ... */
static void xen_reset_vcpu(void *opaque)