diff options
author | royger <royger@FreeBSD.org> | 2014-06-16 08:44:33 +0000 |
---|---|---|
committer | royger <royger@FreeBSD.org> | 2014-06-16 08:44:33 +0000 |
commit | e67dcf09df037cf65eaa533abd6e93fc2053efef (patch) | |
tree | 8974ba75a14079f9221ddb483e5138882514c8ec | |
parent | a2b989a585f564dca417eafe10f0bcf2b6a32a3a (diff) | |
download | FreeBSD-src-e67dcf09df037cf65eaa533abd6e93fc2053efef.zip FreeBSD-src-e67dcf09df037cf65eaa533abd6e93fc2053efef.tar.gz |
xen: introduce xenpv bus
Create a dummy bus so top level Xen devices can attach to it (instead
of attaching directly to the nexus). This allows to have all the Xen
related devices grouped under a single bus.
Sponsored by: Citrix Systems R&D
Approved by: gibbs
x86/xen/xenpv.c:
- Attach the xenpv bus when running as a Xen guest.
- Attach the ISA bus if needed, in order to attach syscons.
conf/files.amd6:
conf/files.i386:
- Include the xenpv.c file in the build of i386/amd64 kernels using
XENHVM.
dev/xen/console/console.c:
dev/xen/timer/timer.c:
xen/xenstore/xenstore.c:
- Attach to the xenpv bus instead of the Nexus.
dev/xen/xenpci/xenpci.c:
- Xen specific devices on PVHVM guests are no longer attached to the
xenpci device, they are instead attached to the xenpv bus, remove
the now unused methods.
-rw-r--r-- | sys/conf/files.amd64 | 1 | ||||
-rw-r--r-- | sys/conf/files.i386 | 1 | ||||
-rw-r--r-- | sys/dev/xen/console/console.c | 2 | ||||
-rw-r--r-- | sys/dev/xen/timer/timer.c | 4 | ||||
-rw-r--r-- | sys/dev/xen/xenpci/xenpci.c | 64 | ||||
-rw-r--r-- | sys/xen/xenstore/xenstore.c | 6 |
6 files changed, 9 insertions, 69 deletions
diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index 71f32ed..aa09d14 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -558,3 +558,4 @@ x86/xen/xen_intr.c optional xen | xenhvm x86/xen/pv.c optional xenhvm x86/xen/pvcpu_enum.c optional xenhvm x86/xen/xen_apic.c optional xenhvm +x86/xen/xenpv.c optional xenhvm diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index 3a93a6b..0215bba 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -595,3 +595,4 @@ x86/x86/delay.c standard x86/xen/hvm.c optional xenhvm x86/xen/xen_intr.c optional xen | xenhvm x86/xen/xen_apic.c optional xenhvm +x86/xen/xenpv.c optional xen | xenhvm diff --git a/sys/dev/xen/console/console.c b/sys/dev/xen/console/console.c index 77bc91e..5019ec9 100644 --- a/sys/dev/xen/console/console.c +++ b/sys/dev/xen/console/console.c @@ -509,4 +509,4 @@ xcons_force_flush(void) } } -DRIVER_MODULE(xc, nexus, xc_driver, xc_devclass, 0, 0); +DRIVER_MODULE(xc, xenpv, xc_driver, xc_devclass, 0, 0); diff --git a/sys/dev/xen/timer/timer.c b/sys/dev/xen/timer/timer.c index ed611d0..5743076 100644 --- a/sys/dev/xen/timer/timer.c +++ b/sys/dev/xen/timer/timer.c @@ -645,5 +645,5 @@ static driver_t xentimer_driver = { sizeof(struct xentimer_softc), }; -DRIVER_MODULE(xentimer, nexus, xentimer_driver, xentimer_devclass, 0, 0); -MODULE_DEPEND(xentimer, nexus, 1, 1, 1); +DRIVER_MODULE(xentimer, xenpv, xentimer_driver, xentimer_devclass, 0, 0); +MODULE_DEPEND(xentimer, xenpv, 1, 1, 1); diff --git a/sys/dev/xen/xenpci/xenpci.c b/sys/dev/xen/xenpci/xenpci.c index dd2ad92..e334051 100644 --- a/sys/dev/xen/xenpci/xenpci.c +++ b/sys/dev/xen/xenpci/xenpci.c @@ -51,8 +51,6 @@ __FBSDID("$FreeBSD$"); extern void xen_intr_handle_upcall(struct trapframe *trap_frame); -static device_t nexus; - /* * This is used to find our platform device instance. */ @@ -188,36 +186,6 @@ xenpci_alloc_space(size_t sz, vm_paddr_t *pa) } } -static struct resource * -xenpci_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) -{ - return (BUS_ALLOC_RESOURCE(nexus, child, type, rid, start, - end, count, flags)); -} - - -static int -xenpci_release_resource(device_t dev, device_t child, int type, int rid, - struct resource *r) -{ - return (BUS_RELEASE_RESOURCE(nexus, child, type, rid, r)); -} - -static int -xenpci_activate_resource(device_t dev, device_t child, int type, int rid, - struct resource *r) -{ - return (BUS_ACTIVATE_RESOURCE(nexus, child, type, rid, r)); -} - -static int -xenpci_deactivate_resource(device_t dev, device_t child, int type, - int rid, struct resource *r) -{ - return (BUS_DEACTIVATE_RESOURCE(nexus, child, type, rid, r)); -} - /* * Probe - just check device ID. */ @@ -229,7 +197,7 @@ xenpci_probe(device_t dev) return (ENXIO); device_set_desc(dev, "Xen Platform Device"); - return (bus_generic_probe(dev)); + return (BUS_PROBE_DEFAULT); } /* @@ -239,20 +207,8 @@ static int xenpci_attach(device_t dev) { struct xenpci_softc *scp = device_get_softc(dev); - devclass_t dc; int error; - /* - * Find and record nexus0. Since we are not really on the - * PCI bus, all resource operations are directed to nexus - * instead of through our parent. - */ - if ((dc = devclass_find("nexus")) == 0 - || (nexus = devclass_get_device(dc, 0)) == 0) { - device_printf(dev, "unable to find nexus."); - return (ENOENT); - } - error = xenpci_allocate_resources(dev); if (error) { device_printf(dev, "xenpci_allocate_resources failed(%d).\n", @@ -270,7 +226,7 @@ xenpci_attach(device_t dev) goto errexit; } - return (bus_generic_attach(dev)); + return (0); errexit: /* @@ -309,16 +265,10 @@ xenpci_detach(device_t dev) } static int -xenpci_suspend(device_t dev) -{ - return (bus_generic_suspend(dev)); -} - -static int xenpci_resume(device_t dev) { xen_hvm_set_callback(dev); - return (bus_generic_resume(dev)); + return (0); } static device_method_t xenpci_methods[] = { @@ -326,16 +276,8 @@ static device_method_t xenpci_methods[] = { DEVMETHOD(device_probe, xenpci_probe), DEVMETHOD(device_attach, xenpci_attach), DEVMETHOD(device_detach, xenpci_detach), - DEVMETHOD(device_suspend, xenpci_suspend), DEVMETHOD(device_resume, xenpci_resume), - /* Bus interface */ - DEVMETHOD(bus_add_child, bus_generic_add_child), - DEVMETHOD(bus_alloc_resource, xenpci_alloc_resource), - DEVMETHOD(bus_release_resource, xenpci_release_resource), - DEVMETHOD(bus_activate_resource, xenpci_activate_resource), - DEVMETHOD(bus_deactivate_resource, xenpci_deactivate_resource), - { 0, 0 } }; diff --git a/sys/xen/xenstore/xenstore.c b/sys/xen/xenstore/xenstore.c index d404862..b5cf413 100644 --- a/sys/xen/xenstore/xenstore.c +++ b/sys/xen/xenstore/xenstore.c @@ -1261,11 +1261,7 @@ static device_method_t xenstore_methods[] = { DEFINE_CLASS_0(xenstore, xenstore_driver, xenstore_methods, 0); static devclass_t xenstore_devclass; -#ifdef XENHVM -DRIVER_MODULE(xenstore, xenpci, xenstore_driver, xenstore_devclass, 0, 0); -#else -DRIVER_MODULE(xenstore, nexus, xenstore_driver, xenstore_devclass, 0, 0); -#endif +DRIVER_MODULE(xenstore, xenpv, xenstore_driver, xenstore_devclass, 0, 0); /*------------------------------- Sysctl Data --------------------------------*/ /* XXX Shouldn't the node be somewhere else? */ |