[PATCH RFC 10/13] xen: add ACPI bus to xen_nexus when running as Dom0

Roger Pau Monne roger.pau at citrix.com
Tue Dec 24 11:25:36 UTC 2013


Also disable a couple of ACPI devices that are not usable under Dom0.
---
 sys/x86/xen/xen_nexus.c |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/sys/x86/xen/xen_nexus.c b/sys/x86/xen/xen_nexus.c
index 288e6b6..823b3bc 100644
--- a/sys/x86/xen/xen_nexus.c
+++ b/sys/x86/xen/xen_nexus.c
@@ -35,6 +35,10 @@ __FBSDID("$FreeBSD$");
 #include <sys/systm.h>
 #include <sys/smp.h>
 
+#include <contrib/dev/acpica/include/acpi.h>
+
+#include <dev/acpica/acpivar.h>
+
 #include <machine/nexusvar.h>
 
 #include <xen/xen-os.h>
@@ -44,7 +48,6 @@ static const char *xen_devices[] =
 	"xenstore",		/* XenStore bus */
 	"xen_et",		/* Xen PV timer (provides: tc, et, clk) */
 	"xc",			/* Xen PV console */
-	"isa",			/* Dummy ISA bus for sc to attach */
 };
 
 /*
@@ -56,13 +59,14 @@ nexus_xen_probe(device_t dev)
 	if (!xen_pv_domain())
 		return (ENXIO);
 
-	return (BUS_PROBE_DEFAULT);
+	return (BUS_PROBE_SPECIFIC);
 }
 
 static int
 nexus_xen_attach(device_t dev)
 {
 	int i, error = 0;
+	device_t acpi_dev;
 
 	nexus_init_resources();
 	bus_generic_probe(dev);
@@ -79,8 +83,22 @@ nexus_xen_attach(device_t dev)
 		if (BUS_ADD_CHILD(dev, 0, xen_devices[i], 0) == NULL)
 			panic("%s: could not add", xen_devices[i]);
 	}
+	if (xen_initial_domain()) {
+		/* Disable some ACPI devices that are not usable by Dom0 */
+		setenv("debug.acpi.disabled", "cpu hpet timer");
+
+		acpi_dev = BUS_ADD_CHILD(dev, 10, "acpi", 0);
+		if (acpi_dev == NULL)
+			panic("Unable to add ACPI bus to Xen Dom0");
+	} else {
+		/* Dummy ISA bus for sc to attach */
+		if (BUS_ADD_CHILD(dev, 0, "isa", 0) == NULL)
+			panic("isa: could not add");
+	}
 
-	bus_generic_attach(dev);
+	error = bus_generic_attach(dev);
+	if (xen_initial_domain() && (error == 0))
+		acpi_install_wakeup_handler(device_get_softc(acpi_dev));
 
 	return (error);
 }
-- 
1.7.7.5 (Apple Git-26)



More information about the freebsd-current mailing list