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.
This commit is contained in:
parent
2382778f40
commit
c2641d23e1
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
@ -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__ */
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user