Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Dec 2013 12:20:59 +0100
From:      Roger Pau Monne <roger.pau@citrix.com>
To:        <freebsd-xen@freebsd.org>, <freebsd-current@freebsd.org>, <xen-devel@lists.xenproject.org>, <gibbs@freebsd.org>, <jhb@freebsd.org>, <kib@freebsd.org>, <julien.grall@citrix.com>
Cc:        Roger Pau Monne <roger.pau@citrix.com>
Subject:   [PATCH RFC 10/13] xen: add ACPI bus to xen_nexus when running as Dom0
Message-ID:  <1387884062-41154-11-git-send-email-roger.pau@citrix.com>
In-Reply-To: <1387884062-41154-1-git-send-email-roger.pau@citrix.com>
References:  <1387884062-41154-1-git-send-email-roger.pau@citrix.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1387884062-41154-11-git-send-email-roger.pau>