summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroyger <royger@FreeBSD.org>2014-08-04 09:05:28 +0000
committerroyger <royger@FreeBSD.org>2014-08-04 09:05:28 +0000
commit8daf97263e7a24a563717f2311ecc4dfb0f5f1fc (patch)
tree7183b8bda8a4ba4bab7dd9c1f26630ec4fe37ce9
parent7713d32d467b3946461905e37cbb3f459b684623 (diff)
downloadFreeBSD-src-8daf97263e7a24a563717f2311ecc4dfb0f5f1fc.zip
FreeBSD-src-8daf97263e7a24a563717f2311ecc4dfb0f5f1fc.tar.gz
xen: add ACPI bus to xen_nexus when running as Dom0
Also disable a couple of ACPI devices that are not usable under Dom0. To this end a couple of booleans are added that allow disabling ACPI specific devices. Sponsored by: Citrix Systems R&D Reviewed by: jhb x86/xen/xen_nexus.c: - Return BUS_PROBE_SPECIFIC in the Xen Nexus attachement routine to force the usage of the Xen Nexus. - Attach the ACPI bus when running as Dom0. dev/acpica/acpi_cpu.c: dev/acpica/acpi_hpet.c: dev/acpica/acpi_timer.c - Add a variable that gates the addition of the devices. x86/include/init.h: - Declare variables that control the attachment of ACPI cpu, hpet and timer devices.
-rw-r--r--sys/dev/acpica/acpi_cpu.c6
-rw-r--r--sys/dev/acpica/acpi_hpet.c5
-rw-r--r--sys/dev/acpica/acpi_timer.c5
-rw-r--r--sys/x86/include/init.h9
-rw-r--r--sys/x86/xen/xen_nexus.c33
5 files changed, 52 insertions, 6 deletions
diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c
index 5cb22a9..9350935 100644
--- a/sys/dev/acpica/acpi_cpu.c
+++ b/sys/dev/acpica/acpi_cpu.c
@@ -133,6 +133,9 @@ SYSCTL_INT(_debug_acpi, OID_AUTO, cpu_unordered, CTLFLAG_RDTUN,
&cpu_unordered, 0,
"Do not use the MADT to match ACPI Processor objects to CPUs.");
+/* Knob to disable acpi_cpu devices */
+bool acpi_cpu_disabled = false;
+
/* Platform hardware resource information. */
static uint32_t cpu_smi_cmd; /* Value to write to SMI_CMD. */
static uint8_t cpu_cst_cnt; /* Indicate we are _CST aware. */
@@ -220,7 +223,8 @@ acpi_cpu_probe(device_t dev)
ACPI_OBJECT *obj;
ACPI_STATUS status;
- if (acpi_disabled("cpu") || acpi_get_type(dev) != ACPI_TYPE_PROCESSOR)
+ if (acpi_disabled("cpu") || acpi_get_type(dev) != ACPI_TYPE_PROCESSOR ||
+ acpi_cpu_disabled)
return (ENXIO);
handle = acpi_get_handle(dev);
diff --git a/sys/dev/acpica/acpi_hpet.c b/sys/dev/acpica/acpi_hpet.c
index 2558648..5e294e1 100644
--- a/sys/dev/acpica/acpi_hpet.c
+++ b/sys/dev/acpica/acpi_hpet.c
@@ -113,6 +113,9 @@ static void hpet_test(struct hpet_softc *sc);
static char *hpet_ids[] = { "PNP0103", NULL };
+/* Knob to disable acpi_hpet device */
+bool acpi_hpet_disabled = false;
+
static u_int
hpet_get_timecount(struct timecounter *tc)
{
@@ -360,7 +363,7 @@ hpet_probe(device_t dev)
{
ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__);
- if (acpi_disabled("hpet"))
+ if (acpi_disabled("hpet") || acpi_hpet_disabled)
return (ENXIO);
if (acpi_get_handle(dev) != NULL &&
ACPI_ID_PROBE(device_get_parent(dev), dev, hpet_ids) == NULL)
diff --git a/sys/dev/acpica/acpi_timer.c b/sys/dev/acpica/acpi_timer.c
index b974f1f..03ef686 100644
--- a/sys/dev/acpica/acpi_timer.c
+++ b/sys/dev/acpica/acpi_timer.c
@@ -65,6 +65,9 @@ static eventhandler_tag acpi_timer_eh;
static u_int acpi_timer_frequency = 14318182 / 4;
+/* Knob to disable acpi_timer device */
+bool acpi_timer_disabled = false;
+
static void acpi_timer_identify(driver_t *driver, device_t parent);
static int acpi_timer_probe(device_t dev);
static int acpi_timer_attach(device_t dev);
@@ -125,7 +128,7 @@ acpi_timer_identify(driver_t *driver, device_t parent)
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
if (acpi_disabled("timer") || (acpi_quirks & ACPI_Q_TIMER) ||
- acpi_timer_dev)
+ acpi_timer_dev || acpi_timer_disabled)
return_VOID;
if ((dev = BUS_ADD_CHILD(parent, 2, "acpi_timer", 0)) == NULL) {
diff --git a/sys/x86/include/init.h b/sys/x86/include/init.h
index e1ff5cf..47dc4f5 100644
--- a/sys/x86/include/init.h
+++ b/sys/x86/include/init.h
@@ -45,4 +45,13 @@ struct init_ops {
extern struct init_ops init_ops;
+/* Knob to disable acpi_cpu devices */
+extern bool acpi_cpu_disabled;
+
+/* Knob to disable acpi_hpet device */
+extern bool acpi_hpet_disabled;
+
+/* Knob to disable acpi_timer device */
+extern bool acpi_timer_disabled;
+
#endif /* __X86_INIT_H__ */
diff --git a/sys/x86/xen/xen_nexus.c b/sys/x86/xen/xen_nexus.c
index f9cf578..e4634f9 100644
--- a/sys/x86/xen/xen_nexus.c
+++ b/sys/x86/xen/xen_nexus.c
@@ -35,6 +35,11 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/smp.h>
+#include <contrib/dev/acpica/include/acpi.h>
+
+#include <dev/acpica/acpivar.h>
+
+#include <x86/init.h>
#include <machine/nexusvar.h>
#include <machine/intr_machdep.h>
@@ -51,18 +56,40 @@ 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 error;
+#ifndef XEN
+ device_t acpi_dev;
+#endif
nexus_init_resources();
bus_generic_probe(dev);
- bus_generic_attach(dev);
- return (0);
+#ifndef XEN
+ if (xen_initial_domain()) {
+ /* Disable some ACPI devices that are not usable by Dom0 */
+ acpi_cpu_disabled = true;
+ acpi_hpet_disabled = true;
+ acpi_timer_disabled = true;
+
+ acpi_dev = BUS_ADD_CHILD(dev, 10, "acpi", 0);
+ if (acpi_dev == NULL)
+ panic("Unable to add ACPI bus to Xen Dom0");
+ }
+#endif
+
+ error = bus_generic_attach(dev);
+#ifndef XEN
+ if (xen_initial_domain() && (error == 0))
+ acpi_install_wakeup_handler(device_get_softc(acpi_dev));
+#endif
+
+ return (error);
}
static int
OpenPOWER on IntegriCloud