Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Mar 2010 19:02:02 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r204916 - head/sys/dev/acpica
Message-ID:  <201003091902.o29J22lv001749@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkim
Date: Tue Mar  9 19:02:02 2010
New Revision: 204916
URL: http://svn.freebsd.org/changeset/base/204916

Log:
  - Allow users to enable dumping Debug objects without ACPI debugger.
  Setting the new sysctl MIB "debug.acpi.enable_debug_objects" to a non-zero
  value enables us to print Debug object when something is written to it.
  - Allow users to disable interpreter slack mode.  Setting the new tunable
  "debug.acpi.interpreter_slack" to zero disables some workarounds for common
  BIOS mistakes and enables strict ACPI implementations by the specification.

Modified:
  head/sys/dev/acpica/acpi.c

Modified: head/sys/dev/acpica/acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi.c	Tue Mar  9 17:26:50 2010	(r204915)
+++ head/sys/dev/acpica/acpi.c	Tue Mar  9 19:02:02 2010	(r204916)
@@ -162,6 +162,7 @@ static int	acpi_sname2sstate(const char 
 static const char *acpi_sstate2sname(int sstate);
 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);
@@ -253,6 +254,19 @@ SYSCTL_STRING(_debug_acpi, OID_AUTO, acp
 static int acpi_serialize_methods;
 TUNABLE_INT("hw.acpi.serialize_methods", &acpi_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");
+
+/* Allow the interpreter to ignore common mistakes in BIOS. */
+static int acpi_interpreter_slack = 1;
+TUNABLE_INT("debug.acpi.interpreter_slack", &acpi_interpreter_slack);
+SYSCTL_INT(_debug_acpi, OID_AUTO, interpreter_slack, CTLFLAG_RDTUN,
+    &acpi_interpreter_slack, 1, "Turn on interpreter slack mode.");
+
 /* 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);
@@ -452,8 +466,17 @@ acpi_attach(device_t dev)
      * Set the globals from our tunables.  This is needed because ACPI-CA
      * uses UINT8 for some values and we have no tunable_byte.
      */
-    AcpiGbl_AllMethodsSerialized = acpi_serialize_methods;
-    AcpiGbl_EnableInterpreterSlack = TRUE;
+    AcpiGbl_AllMethodsSerialized = acpi_serialize_methods ? TRUE : FALSE;
+    AcpiGbl_EnableInterpreterSlack = acpi_interpreter_slack ? TRUE : FALSE;
+    AcpiGbl_EnableAmlDebugObject = acpi_debug_objects ? TRUE : FALSE;
+
+#ifndef ACPI_DEBUG
+    /*
+     * Disable all debugging layers and levels.
+     */
+    AcpiDbgLayer = 0;
+    AcpiDbgLevel = 0;
+#endif
 
     /* Start up the ACPI CA subsystem. */
     status = AcpiInitializeSubsystem();
@@ -3447,8 +3470,6 @@ acpi_set_debugging(void *junk)
 	AcpiDbgLevel = 0;
     }
 
-    AcpiGbl_EnableAmlDebugObject = TRUE;
-
     layer = getenv("debug.acpi.layer");
     level = getenv("debug.acpi.level");
     if (layer == NULL && level == NULL)
@@ -3525,6 +3546,26 @@ SYSCTL_PROC(_debug_acpi, OID_AUTO, level
 #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, ...)
 {
 	int	state, acpi_state;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003091902.o29J22lv001749>