aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/pcifront.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-07-02 17:26:42 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-07-02 17:26:42 +0100
commit38cfc3b8d0bcfd2250bafa8efe1714f1b522d3fc (patch)
tree2076432063664702d6834595f470a6225ab0dd65 /extras/mini-os/pcifront.c
parent9194f26eba9e7ce3c27863dabddafe46fcfdba58 (diff)
downloadxen-38cfc3b8d0bcfd2250bafa8efe1714f1b522d3fc.tar.gz
xen-38cfc3b8d0bcfd2250bafa8efe1714f1b522d3fc.tar.bz2
xen-38cfc3b8d0bcfd2250bafa8efe1714f1b522d3fc.zip
minios: PIRQ and MSI/MSI-X support
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Diffstat (limited to 'extras/mini-os/pcifront.c')
-rw-r--r--extras/mini-os/pcifront.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/extras/mini-os/pcifront.c b/extras/mini-os/pcifront.c
index d5f3511e27..bd8be0b9f0 100644
--- a/extras/mini-os/pcifront.c
+++ b/extras/mini-os/pcifront.c
@@ -276,3 +276,91 @@ int pcifront_conf_write(struct pcifront_dev *dev,
return op.err;
}
+
+int pcifront_enable_msi(struct pcifront_dev *dev,
+ unsigned int dom,
+ unsigned int bus, unsigned int slot, unsigned long fun)
+{
+ struct xen_pci_op op;
+
+ memset(&op, 0, sizeof(op));
+
+ op.cmd = XEN_PCI_OP_enable_msi;
+ op.domain = dom;
+ op.bus = bus;
+ op.devfn = PCI_DEVFN(slot, fun);
+
+ pcifront_op(dev, &op);
+
+ if (op.err)
+ return op.err;
+ else
+ return op.value;
+}
+
+int pcifront_disable_msi(struct pcifront_dev *dev,
+ unsigned int dom,
+ unsigned int bus, unsigned int slot, unsigned long fun)
+{
+ struct xen_pci_op op;
+
+ memset(&op, 0, sizeof(op));
+
+ op.cmd = XEN_PCI_OP_disable_msi;
+ op.domain = dom;
+ op.bus = bus;
+ op.devfn = PCI_DEVFN(slot, fun);
+
+ pcifront_op(dev, &op);
+
+ return op.err;
+}
+
+int pcifront_enable_msix(struct pcifront_dev *dev,
+ unsigned int dom,
+ unsigned int bus, unsigned int slot, unsigned long fun,
+ struct xen_msix_entry *entries, int n)
+{
+ struct xen_pci_op op;
+
+ if (n > SH_INFO_MAX_VEC)
+ return XEN_PCI_ERR_op_failed;
+
+ memset(&op, 0, sizeof(op));
+
+ op.cmd = XEN_PCI_OP_enable_msix;
+ op.domain = dom;
+ op.bus = bus;
+ op.devfn = PCI_DEVFN(slot, fun);
+ op.value = n;
+
+ memcpy(op.msix_entries, entries, n * sizeof(*entries));
+
+ pcifront_op(dev, &op);
+
+ if (op.err)
+ return op.err;
+
+ memcpy(entries, op.msix_entries, n * sizeof(*entries));
+
+ return 0;
+}
+
+
+int pcifront_disable_msix(struct pcifront_dev *dev,
+ unsigned int dom,
+ unsigned int bus, unsigned int slot, unsigned long fun)
+{
+ struct xen_pci_op op;
+
+ memset(&op, 0, sizeof(op));
+
+ op.cmd = XEN_PCI_OP_disable_msix;
+ op.domain = dom;
+ op.bus = bus;
+ op.devfn = PCI_DEVFN(slot, fun);
+
+ pcifront_op(dev, &op);
+
+ return op.err;
+}