[PATCH v2 12/14] ACPI: Enable build of AML interpreter debugger

2015-10-18 Thread Lv Zheng
This patch enables ACPICA debugger files using a configurable
CONFIG_ACPI_DEBUGGER configuration item. Those debugger related code that
was originally masked as ACPI_FUTURE_USAGE now gets unmasked.

Necessary OSL stubs are also added in this patch:
1. acpi_os_readable(): This should be arch specific in Linux, while this
patch doesn't introduce real implementation and a complex mechanism to
allow architecture specific acpi_os_readable() to be implemented to
validate the address. It may be done by future commits.
2. acpi_os_get_line(): This is used to obtain debugger command input. This
patch only introduces a simple KDB concept example in it and the
example should be co-working with the code implemented in
acpi_os_printf(). Since this KDB example won't be compiled unless
ENABLE_DEBUGGER is defined and it seems Linux has already stopped to
use ENABLE_DEBUGGER, thus do not expect it can work properly.

This patch also cleans up all other ACPI_FUTURE_USAGE surroundings
accordingly.
1. Since linkage error can be automatically detected, declaration in the
   headers needn't be surrounded by ACPI_FUTURE_USAGE.
   So only the following separate exported fuction bodies are masked by
   this macro (other exported fucntions may have already been masked at
   entire module level via drivers/acpi/acpica/Makefile):
 acpi_install_exception_handler()
 acpi_subsystem_status()
 acpi_get_system_info()
 acpi_get_statistics()
 acpi_install_initialization_handler()
2. Since strip can automatically zap the no-user functions, functions that
   are not marked with ACPI_EXPORT_SYMBOL() needn't get surrounded by
   ACPI_FUTURE_USAGE.
   So the following function which is not used by Linux kernel now won't
   get surrounded by this macro:
 acpi_ps_get_name()

Signed-off-by: Lv Zheng 
---
 drivers/acpi/Kconfig  |9 +
 drivers/acpi/acpica/Makefile  |   18 +-
 drivers/acpi/acpica/acinterp.h|2 --
 drivers/acpi/acpica/acnamesp.h|4 
 drivers/acpi/acpica/acparser.h|4 
 drivers/acpi/acpica/acutils.h |2 --
 drivers/acpi/acpica/evxface.c |2 +-
 drivers/acpi/acpica/nsdump.c  |6 --
 drivers/acpi/acpica/pstree.c  |2 --
 drivers/acpi/acpica/psutils.c |2 --
 drivers/acpi/acpica/rsutils.c |2 --
 drivers/acpi/acpica/rsxface.c |4 ++--
 drivers/acpi/acpica/utxface.c |2 +-
 drivers/acpi/osl.c|   11 +++
 include/acpi/acpixf.h |   10 --
 include/acpi/platform/aclinux.h   |7 +--
 include/acpi/platform/aclinuxex.h |5 +
 17 files changed, 43 insertions(+), 49 deletions(-)

diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 5d1015c..706c2e9 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -57,6 +57,15 @@ config ACPI_SYSTEM_POWER_STATES_SUPPORT
 config ACPI_CCA_REQUIRED
bool
 
+config ACPI_DEBUGGER
+   bool "In-kernel debugger (EXPERIMENTAL)"
+   select ACPI_DEBUG
+   help
+ Enable in-kernel debugging facilities: statistics, internal
+ object dump, single step control method execution.
+ This is still under development, currently enabling this only
+ results in the compilation of the ACPICA debugger files.
+
 config ACPI_SLEEP
bool
depends on SUSPEND || HIBERNATION
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index ac78d76..885936f 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -177,8 +177,24 @@ acpi-y +=  \
utxferror.o \
utxfmutex.o
 
-acpi-$(ACPI_FUTURE_USAGE) +=   \
+acpi-$(CONFIG_ACPI_DEBUGGER) +=\
+   dbcmds.o\
+   dbconvert.o \
+   dbdisply.o  \
+   dbexec.o\
+   dbhistry.o  \
+   dbinput.o   \
+   dbmethod.o  \
+   dbnames.o   \
+   dbobject.o  \
+   dbstats.o   \
+   dbutils.o   \
+   dbxface.o   \
rsdump.o\
+
+acpi-$(ACPI_FUTURE_USAGE) +=   \
+   dbfileio.o  \
+   dbtest.o\
utcache.o   \
utfileio.o  \
utprint.o   \
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h
index e820ed8..e9e936e 100644
--- a/drivers/acpi/acpica/acinterp.h
+++ b/drivers/acpi/acpica/acinterp.h
@@ -397,12 +397,10 @@ void
 acpi_ex_dump_operands(union acpi_operand_object **operands,
  const char *opcode_name, u32 num_opcodes);
 
-#ifdef ACPI_FUTURE_USAGE
 void
 acpi_ex_dump_object_descriptor(union acpi_operand_object *object, u32 flags);
 
 void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags);
-#endif /* ACPI_FUTURE_USAGE */
 
 /*

[PATCH v2 12/14] ACPI: Enable build of AML interpreter debugger

2015-10-18 Thread Lv Zheng
This patch enables ACPICA debugger files using a configurable
CONFIG_ACPI_DEBUGGER configuration item. Those debugger related code that
was originally masked as ACPI_FUTURE_USAGE now gets unmasked.

Necessary OSL stubs are also added in this patch:
1. acpi_os_readable(): This should be arch specific in Linux, while this
patch doesn't introduce real implementation and a complex mechanism to
allow architecture specific acpi_os_readable() to be implemented to
validate the address. It may be done by future commits.
2. acpi_os_get_line(): This is used to obtain debugger command input. This
patch only introduces a simple KDB concept example in it and the
example should be co-working with the code implemented in
acpi_os_printf(). Since this KDB example won't be compiled unless
ENABLE_DEBUGGER is defined and it seems Linux has already stopped to
use ENABLE_DEBUGGER, thus do not expect it can work properly.

This patch also cleans up all other ACPI_FUTURE_USAGE surroundings
accordingly.
1. Since linkage error can be automatically detected, declaration in the
   headers needn't be surrounded by ACPI_FUTURE_USAGE.
   So only the following separate exported fuction bodies are masked by
   this macro (other exported fucntions may have already been masked at
   entire module level via drivers/acpi/acpica/Makefile):
 acpi_install_exception_handler()
 acpi_subsystem_status()
 acpi_get_system_info()
 acpi_get_statistics()
 acpi_install_initialization_handler()
2. Since strip can automatically zap the no-user functions, functions that
   are not marked with ACPI_EXPORT_SYMBOL() needn't get surrounded by
   ACPI_FUTURE_USAGE.
   So the following function which is not used by Linux kernel now won't
   get surrounded by this macro:
 acpi_ps_get_name()

Signed-off-by: Lv Zheng 
---
 drivers/acpi/Kconfig  |9 +
 drivers/acpi/acpica/Makefile  |   18 +-
 drivers/acpi/acpica/acinterp.h|2 --
 drivers/acpi/acpica/acnamesp.h|4 
 drivers/acpi/acpica/acparser.h|4 
 drivers/acpi/acpica/acutils.h |2 --
 drivers/acpi/acpica/evxface.c |2 +-
 drivers/acpi/acpica/nsdump.c  |6 --
 drivers/acpi/acpica/pstree.c  |2 --
 drivers/acpi/acpica/psutils.c |2 --
 drivers/acpi/acpica/rsutils.c |2 --
 drivers/acpi/acpica/rsxface.c |4 ++--
 drivers/acpi/acpica/utxface.c |2 +-
 drivers/acpi/osl.c|   11 +++
 include/acpi/acpixf.h |   10 --
 include/acpi/platform/aclinux.h   |7 +--
 include/acpi/platform/aclinuxex.h |5 +
 17 files changed, 43 insertions(+), 49 deletions(-)

diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 5d1015c..706c2e9 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -57,6 +57,15 @@ config ACPI_SYSTEM_POWER_STATES_SUPPORT
 config ACPI_CCA_REQUIRED
bool
 
+config ACPI_DEBUGGER
+   bool "In-kernel debugger (EXPERIMENTAL)"
+   select ACPI_DEBUG
+   help
+ Enable in-kernel debugging facilities: statistics, internal
+ object dump, single step control method execution.
+ This is still under development, currently enabling this only
+ results in the compilation of the ACPICA debugger files.
+
 config ACPI_SLEEP
bool
depends on SUSPEND || HIBERNATION
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index ac78d76..885936f 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -177,8 +177,24 @@ acpi-y +=  \
utxferror.o \
utxfmutex.o
 
-acpi-$(ACPI_FUTURE_USAGE) +=   \
+acpi-$(CONFIG_ACPI_DEBUGGER) +=\
+   dbcmds.o\
+   dbconvert.o \
+   dbdisply.o  \
+   dbexec.o\
+   dbhistry.o  \
+   dbinput.o   \
+   dbmethod.o  \
+   dbnames.o   \
+   dbobject.o  \
+   dbstats.o   \
+   dbutils.o   \
+   dbxface.o   \
rsdump.o\
+
+acpi-$(ACPI_FUTURE_USAGE) +=   \
+   dbfileio.o  \
+   dbtest.o\
utcache.o   \
utfileio.o  \
utprint.o   \
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h
index e820ed8..e9e936e 100644
--- a/drivers/acpi/acpica/acinterp.h
+++ b/drivers/acpi/acpica/acinterp.h
@@ -397,12 +397,10 @@ void
 acpi_ex_dump_operands(union acpi_operand_object **operands,
  const char *opcode_name, u32 num_opcodes);
 
-#ifdef ACPI_FUTURE_USAGE
 void
 acpi_ex_dump_object_descriptor(union acpi_operand_object *object, u32 flags);
 
 void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags);
-#endif /*