From: Sascha Wildner Date: Sun, 11 May 2014 19:16:54 +0000 (+0200) Subject: kernel/acpi: Improve the disabling of Debug object dumping. X-Git-Tag: v3.9.0~58 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/c9ed7d9ef60d6ffb82c02ec4822a68a29703a389 kernel/acpi: Improve the disabling of Debug object dumping. It is actually a global in ACPICA (since 20100304) so add a new sysctl debug.acpi.enable_debug_objects that can be used to toggle it, with the default being 0. This commit reverts e59c6bdadc7ee647f2ac508a3d1c210b89a680b1 which solved it differently (in the ACPICA code). Taken-from: FreeBSD Reported-by: dillon (iirc) --- diff --git a/share/man/man4/acpi.4 b/share/man/man4/acpi.4 index b80c8f3def..475182f391 100644 --- a/share/man/man4/acpi.4 +++ b/share/man/man4/acpi.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD: src/share/man/man4/acpi.4,v 1.61.8.1 2009/04/15 03:14:26 kensmith Exp $ .\" -.Dd April 29, 2014 +.Dd May 11, 2014 .Dt ACPI 4 .Os .Sh NAME @@ -62,6 +62,10 @@ used to modify or monitor .Nm behavior. .Bl -tag -width indent +.It Va debug.acpi.enable_debug_objects +Enable dumping Debug objects without +.Cd "options ACPI_DEBUG" . +Default is 0, ignore Debug objects. .It Va hw.acpi.acline AC line state (1 means online, 0 means on battery power). .It Va hw.acpi.cpu.cx_usage diff --git a/sys/contrib/dev/acpica/source/include/acoutput.h b/sys/contrib/dev/acpica/source/include/acoutput.h index 67a37987f8..8f054ae119 100644 --- a/sys/contrib/dev/acpica/source/include/acoutput.h +++ b/sys/contrib/dev/acpica/source/include/acoutput.h @@ -219,6 +219,7 @@ #define ACPI_ERROR(plist) AcpiError plist #define ACPI_BIOS_WARNING(plist) AcpiBiosWarning plist #define ACPI_BIOS_ERROR(plist) AcpiBiosError plist +#define ACPI_DEBUG_OBJECT(obj,l,i) AcpiExDoDebugObject(obj,l,i) #else @@ -230,15 +231,10 @@ #define ACPI_ERROR(plist) #define ACPI_BIOS_WARNING(plist) #define ACPI_BIOS_ERROR(plist) +#define ACPI_DEBUG_OBJECT(obj,l,i) #endif /* ACPI_NO_ERROR_MESSAGES */ -#ifdef ACPI_DEBUG_MESSAGE -#define ACPI_DEBUG_OBJECT(obj,l,i) AcpiExDoDebugObject(obj,l,i) -#else -#define ACPI_DEBUG_OBJECT(obj,l,i) -#endif - /* * Debug macros that are conditionally compiled diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 4d15fd0e5e..04833ca435 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -150,6 +150,7 @@ static void acpi_system_eventhandler_sleep(void *arg, int state); static void acpi_system_eventhandler_wakeup(void *arg, int state); static int acpi_supported_sleep_state_sysctl(SYSCTL_HANDLER_ARGS); static int acpi_sleep_state_sysctl(SYSCTL_HANDLER_ARGS); +static int acpi_debug_objects_sysctl(SYSCTL_HANDLER_ARGS); static int acpi_pm_func(u_long cmd, void *arg, ...); static int acpi_child_location_str_method(device_t acdev, device_t child, char *buf, size_t buflen); @@ -235,6 +236,13 @@ SYSCTL_STRING(_debug_acpi, OID_AUTO, acpi_ca_version, CTLFLAG_RD, static int acpi_auto_serialize_methods = 1; TUNABLE_INT("hw.acpi.auto_serialize_methods", &acpi_auto_serialize_methods); +/* Allow users to dump Debug objects without ACPI debugger. */ +static int acpi_debug_objects; +TUNABLE_INT("debug.acpi.enable_debug_objects", &acpi_debug_objects); +SYSCTL_PROC(_debug_acpi, OID_AUTO, enable_debug_objects, + CTLFLAG_RW | CTLTYPE_INT, NULL, 0, acpi_debug_objects_sysctl, "I", + "Enable Debug objects"); + /* Power devices off and on in suspend and resume. XXX Remove once tested. */ static int acpi_do_powerstate = 1; TUNABLE_INT("debug.acpi.do_powerstate", &acpi_do_powerstate); @@ -446,6 +454,7 @@ acpi_attach(device_t dev) */ AcpiGbl_AutoSerializeMethods = acpi_auto_serialize_methods; AcpiGbl_EnableInterpreterSlack = TRUE; + AcpiGbl_EnableAmlDebugObject = acpi_debug_objects ? TRUE : FALSE; /* Start up the ACPI CA subsystem. */ status = AcpiInitializeSubsystem(); @@ -3383,6 +3392,26 @@ SYSCTL_PROC(_debug_acpi, OID_AUTO, level, CTLFLAG_RW | CTLTYPE_STRING, "debug.acpi.level", 0, acpi_debug_sysctl, "A", ""); #endif /* ACPI_DEBUG */ +static int +acpi_debug_objects_sysctl(SYSCTL_HANDLER_ARGS) +{ + int error; + int old; + + old = acpi_debug_objects; + error = sysctl_handle_int(oidp, &acpi_debug_objects, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (old == acpi_debug_objects || (old && acpi_debug_objects)) + return (0); + + ACPI_SERIAL_BEGIN(acpi); + AcpiGbl_EnableAmlDebugObject = acpi_debug_objects ? TRUE : FALSE; + ACPI_SERIAL_END(acpi); + + return (0); +} + static int acpi_pm_func(u_long cmd, void *arg, ...) {