aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/kernel.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-07-02 13:54:20 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-07-02 13:54:20 +0100
commitde4e0840642f41b2a0feef8a97afc360c734bb2b (patch)
tree8dff9dc8e7b57d0bd762cc2dd213fd6ca8600a25 /extras/mini-os/kernel.c
parentdac6f79804f05cde83ebd877939b66b71ee8cdf8 (diff)
downloadxen-de4e0840642f41b2a0feef8a97afc360c734bb2b.tar.gz
xen-de4e0840642f41b2a0feef8a97afc360c734bb2b.tar.bz2
xen-de4e0840642f41b2a0feef8a97afc360c734bb2b.zip
stubdom: PCI passthrough support via PV-PCI
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Diffstat (limited to 'extras/mini-os/kernel.c')
-rw-r--r--extras/mini-os/kernel.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/extras/mini-os/kernel.c b/extras/mini-os/kernel.c
index e02b85880f..cb0ee52213 100644
--- a/extras/mini-os/kernel.c
+++ b/extras/mini-os/kernel.c
@@ -40,6 +40,7 @@
#include <netfront.h>
#include <blkfront.h>
#include <fbfront.h>
+#include <pcifront.h>
#include <fs.h>
#include <xmalloc.h>
#include <fcntl.h>
@@ -431,6 +432,27 @@ static void kbdfront_thread(void *p)
}
}
+static struct pcifront_dev *pci_dev;
+
+static void pcifront_thread(void *p)
+{
+ void print(unsigned int domain, unsigned int bus, unsigned int slot, unsigned int fun)
+ {
+ unsigned int vendor, device, rev, class;
+
+ pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x00, 2, &vendor);
+ pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x02, 2, &device);
+ pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x08, 1, &rev);
+ pcifront_conf_read(pci_dev, domain, bus, slot, fun, 0x0a, 2, &class);
+
+ printk("%04x:%02x:%02x.%02x %04x: %04x:%04x (rev %02x)\n", domain, bus, slot, fun, class, vendor, device, rev);
+ }
+
+ pci_dev = init_pcifront(NULL);
+ printk("PCI devices:\n");
+ pcifront_scan(pci_dev, print);
+}
+
static void fs_thread(void *p)
{
init_fs_frontend();
@@ -446,6 +468,7 @@ __attribute__((weak)) int app_main(start_info_t *si)
create_thread("blkfront", blkfront_thread, si);
create_thread("fbfront", fbfront_thread, si);
create_thread("kbdfront", kbdfront_thread, si);
+ create_thread("pcifront", pcifront_thread, si);
create_thread("fs-frontend", fs_thread, si);
return 0;
}
@@ -524,6 +547,9 @@ void stop_kernel(void)
if (kbd_dev)
shutdown_kbdfront(kbd_dev);
+ if (pci_dev)
+ shutdown_pcifront(pci_dev);
+
/* TODO: fs import */
local_irq_disable();