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

From: Roger Pau Monne <roger.pau_at_citrix.com>
Date: Tue, 24 Dec 2013 12:20:59 +0100
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
_at__at_ -35,6 +35,10 _at__at_ __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>
_at__at_ -44,7 +48,6 _at__at_ 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 */
 };
 
 /*
_at__at_ -56,13 +59,14 _at__at_ 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);
_at__at_ -79,8 +83,22 _at__at_ 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)
Received on Tue Dec 24 2013 - 10:25:36 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:45 UTC