Skip to contentSkip to conversation

minios: PIRQ and MSI/MSI-X support

PATCH New Samuel Thibault 1 participant 1 message Jul 2, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 minios: PIRQ and MSI/MSI-X support

minios: PIRQ and MSI/MSI-X support

extras/mini-os/events.c +17 -0
diff -r 095f95d287b1 extras/mini-os/events.c
@@ -136,6 +136,23 @@
 	return op.port;
 }
 
+evtchn_port_t bind_pirq(uint32_t pirq, int will_share, evtchn_handler_t handler, void *data)
+{
+	evtchn_bind_pirq_t op;
+
+	/* Try to bind the pirq to a port */
+	op.pirq = pirq;
+	op.flags = will_share ? BIND_PIRQ__WILL_SHARE : 0;
+
+	if ( HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &op) != 0 )
+	{
+		printk("Failed to bind physical IRQ %d\n", pirq);
+		return -1;
+	}
+	bind_evtchn(op.port, handler, data);
+	return op.port;
+}
+
 #if defined(__x86_64__)
 char irqstack[2 * STACK_SIZE];
 
extras/mini-os/include/events.h +1 -0
diff -r 095f95d287b1 extras/mini-os/include/events.h
@@ -27,6 +27,7 @@
 /* prototypes */
 int do_event(evtchn_port_t port, struct pt_regs *regs);
 evtchn_port_t bind_virq(uint32_t virq, evtchn_handler_t handler, void *data);
+evtchn_port_t bind_pirq(uint32_t pirq, int will_share, evtchn_handler_t handler, void *data);
 evtchn_port_t bind_evtchn(evtchn_port_t port, evtchn_handler_t handler,
 						  void *data);
 void unbind_evtchn(evtchn_port_t port);
extras/mini-os/include/pcifront.h +15 -2
diff -r 095f95d287b1 extras/mini-os/include/pcifront.h
@@ -2,9 +2,8 @@
 #include <xen/io/pciif.h>
 struct pcifront_dev;
 struct pcifront_dev *init_pcifront(char *nodename);
+void pcifront_op(struct pcifront_dev *dev, struct xen_pci_op *op);
 void pcifront_scan(struct pcifront_dev *dev, void (*fun)(unsigned int domain, unsigned int bus, unsigned slot, unsigned int fun));
-void pcifront_op(struct pcifront_dev *dev, struct xen_pci_op *op);
-void shutdown_pcifront(struct pcifront_dev *dev);
 int pcifront_conf_read(struct pcifront_dev *dev,
                        unsigned int dom,
                        unsigned int bus, unsigned int slot, unsigned long fun,
@@ -13,3 +12,17 @@
                         unsigned int dom,
                         unsigned int bus, unsigned int slot, unsigned long fun,
                         unsigned int off, unsigned int size, unsigned int val);
+int pcifront_enable_msi(struct pcifront_dev *dev,
+                        unsigned int dom,
+                        unsigned int bus, unsigned int slot, unsigned long fun);
+int pcifront_disable_msi(struct pcifront_dev *dev,
+                         unsigned int dom,
+                         unsigned int bus, unsigned int slot, unsigned long fun);
+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);
+int pcifront_disable_msix(struct pcifront_dev *dev,
+                          unsigned int dom,
+                          unsigned int bus, unsigned int slot, unsigned long fun);
+void shutdown_pcifront(struct pcifront_dev *dev);
extras/mini-os/pcifront.c +88 -0

91 lines not on this page · raw message