aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorLin Ming <ming.m.lin@intel.com>2010-03-03 03:28:28 -0500
committerLen Brown <len.brown@intel.com>2010-04-20 10:42:49 -0400
commit4cdf1a562bfb5852954aadbe8515557b8acc8168 (patch)
tree0248629a274c751835622435b6aa49319da4308d /drivers/acpi
parent01bf0b64579ead8a82e7cfc32ae44bc667e7ad0f (diff)
ACPICA: Enhance configuration for output of AML Debug Object
This change will enable debug object output via a global variable, acpi_gbl_enable_aml_debug_object. This will help with remote machine debugging. Also, moved all debug object support code to a new file, exdebug.c. Entire debug object module can now be configured out of the ACPICA build if desired. Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/acpica/Makefile2
-rw-r--r--drivers/acpi/acpica/acglobal.h5
-rw-r--r--drivers/acpi/acpica/acinterp.h7
-rw-r--r--drivers/acpi/acpica/exdebug.c261
-rw-r--r--drivers/acpi/acpica/exstore.c216
5 files changed, 275 insertions, 216 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index 7423052ece5a..c1102098dbfb 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -19,7 +19,7 @@ acpi-y += evevent.o evregion.o evsci.o evxfevnt.o \
19acpi-y += exconfig.o exfield.o exnames.o exoparg6.o exresolv.o exstorob.o\ 19acpi-y += exconfig.o exfield.o exnames.o exoparg6.o exresolv.o exstorob.o\
20 exconvrt.o exfldio.o exoparg1.o exprep.o exresop.o exsystem.o\ 20 exconvrt.o exfldio.o exoparg1.o exprep.o exresop.o exsystem.o\
21 excreate.o exmisc.o exoparg2.o exregion.o exstore.o exutils.o \ 21 excreate.o exmisc.o exoparg2.o exregion.o exstore.o exutils.o \
22 exdump.o exmutex.o exoparg3.o exresnte.o exstoren.o 22 exdump.o exmutex.o exoparg3.o exresnte.o exstoren.o exdebug.o
23 23
24acpi-y += hwacpi.o hwgpe.o hwregs.o hwsleep.o hwxface.o hwvalid.o 24acpi-y += hwacpi.o hwgpe.o hwregs.o hwsleep.o hwxface.o hwvalid.o
25 25
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index f8dd8f250ac4..2b2e61ed373e 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -112,6 +112,11 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE);
112 */ 112 */
113u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE); 113u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE);
114 114
115/*
116 * Optionally enable output from the AML Debug Object.
117 */
118u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE);
119
115/* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */ 120/* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */
116 121
117struct acpi_table_fadt acpi_gbl_FADT; 122struct acpi_table_fadt acpi_gbl_FADT;
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h
index 6df3f8428168..9a9b89312b09 100644
--- a/drivers/acpi/acpica/acinterp.h
+++ b/drivers/acpi/acpica/acinterp.h
@@ -121,6 +121,13 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
121 struct acpi_walk_state *walk_state); 121 struct acpi_walk_state *walk_state);
122 122
123/* 123/*
124 * exdebug - AML debug object
125 */
126void
127acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
128 u32 level, u32 index);
129
130/*
124 * exfield - ACPI AML (p-code) execution - field manipulation 131 * exfield - ACPI AML (p-code) execution - field manipulation
125 */ 132 */
126acpi_status 133acpi_status
diff --git a/drivers/acpi/acpica/exdebug.c b/drivers/acpi/acpica/exdebug.c
new file mode 100644
index 000000000000..be8c98b480d7
--- /dev/null
+++ b/drivers/acpi/acpica/exdebug.c
@@ -0,0 +1,261 @@
1/******************************************************************************
2 *
3 * Module Name: exdebug - Support for stores to the AML Debug Object
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46#include "acinterp.h"
47
48#define _COMPONENT ACPI_EXECUTER
49ACPI_MODULE_NAME("exdebug")
50
51#ifndef ACPI_NO_ERROR_MESSAGES
52/*******************************************************************************
53 *
54 * FUNCTION: acpi_ex_do_debug_object
55 *
56 * PARAMETERS: source_desc - Object to be output to "Debug Object"
57 * Level - Indentation level (used for packages)
58 * Index - Current package element, zero if not pkg
59 *
60 * RETURN: None
61 *
62 * DESCRIPTION: Handles stores to the AML Debug Object. For example:
63 * Store(INT1, Debug)
64 *
65 * This function is not compiled if ACPI_NO_ERROR_MESSAGES is set.
66 *
67 * This function is only enabled if acpi_gbl_enable_aml_debug_object is set, or
68 * if ACPI_LV_DEBUG_OBJECT is set in the acpi_dbg_level. Thus, in the normal
69 * operational case, stores to the debug object are ignored but can be easily
70 * enabled if necessary.
71 *
72 ******************************************************************************/
73void
74acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
75 u32 level, u32 index)
76{
77 u32 i;
78
79 ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc);
80
81 /* Output must be enabled via the debug_object global or the dbg_level */
82
83 if (!acpi_gbl_enable_aml_debug_object &&
84 !(acpi_dbg_level & ACPI_LV_DEBUG_OBJECT)) {
85 return_VOID;
86 }
87
88 /*
89 * Print line header as long as we are not in the middle of an
90 * object display
91 */
92 if (!((level > 0) && index == 0)) {
93 acpi_os_printf("[ACPI Debug] %*s", level, " ");
94 }
95
96 /* Display the index for package output only */
97
98 if (index > 0) {
99 acpi_os_printf("(%.2u) ", index - 1);
100 }
101
102 if (!source_desc) {
103 acpi_os_printf("[Null Object]\n");
104 return_VOID;
105 }
106
107 if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) {
108 acpi_os_printf("%s ",
109 acpi_ut_get_object_type_name(source_desc));
110
111 if (!acpi_ut_valid_internal_object(source_desc)) {
112 acpi_os_printf("%p, Invalid Internal Object!\n",
113 source_desc);
114 return_VOID;
115 }
116 } else if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) ==
117 ACPI_DESC_TYPE_NAMED) {
118 acpi_os_printf("%s: %p\n",
119 acpi_ut_get_type_name(((struct
120 acpi_namespace_node *)
121 source_desc)->type),
122 source_desc);
123 return_VOID;
124 } else {
125 return_VOID;
126 }
127
128 /* source_desc is of type ACPI_DESC_TYPE_OPERAND */
129
130 switch (source_desc->common.type) {
131 case ACPI_TYPE_INTEGER:
132
133 /* Output correct integer width */
134
135 if (acpi_gbl_integer_byte_width == 4) {
136 acpi_os_printf("0x%8.8X\n",
137 (u32)source_desc->integer.value);
138 } else {
139 acpi_os_printf("0x%8.8X%8.8X\n",
140 ACPI_FORMAT_UINT64(source_desc->integer.
141 value));
142 }
143 break;
144
145 case ACPI_TYPE_BUFFER:
146
147 acpi_os_printf("[0x%.2X]\n", (u32)source_desc->buffer.length);
148 acpi_ut_dump_buffer2(source_desc->buffer.pointer,
149 (source_desc->buffer.length < 256) ?
150 source_desc->buffer.length : 256,
151 DB_BYTE_DISPLAY);
152 break;
153
154 case ACPI_TYPE_STRING:
155
156 acpi_os_printf("[0x%.2X] \"%s\"\n",
157 source_desc->string.length,
158 source_desc->string.pointer);
159 break;
160
161 case ACPI_TYPE_PACKAGE:
162
163 acpi_os_printf("[Contains 0x%.2X Elements]\n",
164 source_desc->package.count);
165
166 /* Output the entire contents of the package */
167
168 for (i = 0; i < source_desc->package.count; i++) {
169 acpi_ex_do_debug_object(source_desc->package.
170 elements[i], level + 4, i + 1);
171 }
172 break;
173
174 case ACPI_TYPE_LOCAL_REFERENCE:
175
176 acpi_os_printf("[%s] ",
177 acpi_ut_get_reference_name(source_desc));
178
179 /* Decode the reference */
180
181 switch (source_desc->reference.class) {
182 case ACPI_REFCLASS_INDEX:
183
184 acpi_os_printf("0x%X\n", source_desc->reference.value);
185 break;
186
187 case ACPI_REFCLASS_TABLE:
188
189 /* Case for ddb_handle */
190
191 acpi_os_printf("Table Index 0x%X\n",
192 source_desc->reference.value);
193 return;
194
195 default:
196 break;
197 }
198
199 acpi_os_printf(" ");
200
201 /* Check for valid node first, then valid object */
202
203 if (source_desc->reference.node) {
204 if (ACPI_GET_DESCRIPTOR_TYPE
205 (source_desc->reference.node) !=
206 ACPI_DESC_TYPE_NAMED) {
207 acpi_os_printf
208 (" %p - Not a valid namespace node\n",
209 source_desc->reference.node);
210 } else {
211 acpi_os_printf("Node %p [%4.4s] ",
212 source_desc->reference.node,
213 (source_desc->reference.node)->
214 name.ascii);
215
216 switch ((source_desc->reference.node)->type) {
217
218 /* These types have no attached object */
219
220 case ACPI_TYPE_DEVICE:
221 acpi_os_printf("Device\n");
222 break;
223
224 case ACPI_TYPE_THERMAL:
225 acpi_os_printf("Thermal Zone\n");
226 break;
227
228 default:
229 acpi_ex_do_debug_object((source_desc->
230 reference.
231 node)->object,
232 level + 4, 0);
233 break;
234 }
235 }
236 } else if (source_desc->reference.object) {
237 if (ACPI_GET_DESCRIPTOR_TYPE
238 (source_desc->reference.object) ==
239 ACPI_DESC_TYPE_NAMED) {
240 acpi_ex_do_debug_object(((struct
241 acpi_namespace_node *)
242 source_desc->reference.
243 object)->object,
244 level + 4, 0);
245 } else {
246 acpi_ex_do_debug_object(source_desc->reference.
247 object, level + 4, 0);
248 }
249 }
250 break;
251
252 default:
253
254 acpi_os_printf("%p\n", source_desc);
255 break;
256 }
257
258 ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "\n"));
259 return_VOID;
260}
261#endif
diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c
index 702b9ecfd44b..f65d7e4ef9c7 100644
--- a/drivers/acpi/acpica/exstore.c
+++ b/drivers/acpi/acpica/exstore.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: exstore - AML Interpreter object store support 3 * Module Name: exstore - AML Interpreter object store support
@@ -53,10 +52,6 @@
53ACPI_MODULE_NAME("exstore") 52ACPI_MODULE_NAME("exstore")
54 53
55/* Local prototypes */ 54/* Local prototypes */
56static void
57acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
58 u32 level, u32 index);
59
60static acpi_status 55static acpi_status
61acpi_ex_store_object_to_index(union acpi_operand_object *val_desc, 56acpi_ex_store_object_to_index(union acpi_operand_object *val_desc,
62 union acpi_operand_object *dest_desc, 57 union acpi_operand_object *dest_desc,
@@ -64,215 +59,6 @@ acpi_ex_store_object_to_index(union acpi_operand_object *val_desc,
64 59
65/******************************************************************************* 60/*******************************************************************************
66 * 61 *
67 * FUNCTION: acpi_ex_do_debug_object
68 *
69 * PARAMETERS: source_desc - Value to be stored
70 * Level - Indentation level (used for packages)
71 * Index - Current package element, zero if not pkg
72 *
73 * RETURN: None
74 *
75 * DESCRIPTION: Handles stores to the Debug Object.
76 *
77 ******************************************************************************/
78
79static void
80acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
81 u32 level, u32 index)
82{
83 u32 i;
84
85 ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc);
86
87 /* Print line header as long as we are not in the middle of an object display */
88
89 if (!((level > 0) && index == 0)) {
90 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
91 level, " "));
92 }
93
94 /* Display index for package output only */
95
96 if (index > 0) {
97 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
98 "(%.2u) ", index - 1));
99 }
100
101 if (!source_desc) {
102 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[Null Object]\n"));
103 return_VOID;
104 }
105
106 if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) {
107 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s ",
108 acpi_ut_get_object_type_name
109 (source_desc)));
110
111 if (!acpi_ut_valid_internal_object(source_desc)) {
112 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
113 "%p, Invalid Internal Object!\n",
114 source_desc));
115 return_VOID;
116 }
117 } else if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) ==
118 ACPI_DESC_TYPE_NAMED) {
119 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s: %p\n",
120 acpi_ut_get_type_name(((struct
121 acpi_namespace_node
122 *)source_desc)->
123 type),
124 source_desc));
125 return_VOID;
126 } else {
127 return_VOID;
128 }
129
130 /* source_desc is of type ACPI_DESC_TYPE_OPERAND */
131
132 switch (source_desc->common.type) {
133 case ACPI_TYPE_INTEGER:
134
135 /* Output correct integer width */
136
137 if (acpi_gbl_integer_byte_width == 4) {
138 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
139 (u32) source_desc->integer.
140 value));
141 } else {
142 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
143 "0x%8.8X%8.8X\n",
144 ACPI_FORMAT_UINT64(source_desc->
145 integer.
146 value)));
147 }
148 break;
149
150 case ACPI_TYPE_BUFFER:
151
152 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n",
153 (u32) source_desc->buffer.length));
154 ACPI_DUMP_BUFFER(source_desc->buffer.pointer,
155 (source_desc->buffer.length <
156 256) ? source_desc->buffer.length : 256);
157 break;
158
159 case ACPI_TYPE_STRING:
160
161 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
162 source_desc->string.length,
163 source_desc->string.pointer));
164 break;
165
166 case ACPI_TYPE_PACKAGE:
167
168 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
169 "[Contains 0x%.2X Elements]\n",
170 source_desc->package.count));
171
172 /* Output the entire contents of the package */
173
174 for (i = 0; i < source_desc->package.count; i++) {
175 acpi_ex_do_debug_object(source_desc->package.
176 elements[i], level + 4, i + 1);
177 }
178 break;
179
180 case ACPI_TYPE_LOCAL_REFERENCE:
181
182 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s] ",
183 acpi_ut_get_reference_name(source_desc)));
184
185 /* Decode the reference */
186
187 switch (source_desc->reference.class) {
188 case ACPI_REFCLASS_INDEX:
189
190 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "0x%X\n",
191 source_desc->reference.value));
192 break;
193
194 case ACPI_REFCLASS_TABLE:
195
196 /* Case for ddb_handle */
197
198 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
199 "Table Index 0x%X\n",
200 source_desc->reference.value));
201 return;
202
203 default:
204 break;
205 }
206
207 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, " "));
208
209 /* Check for valid node first, then valid object */
210
211 if (source_desc->reference.node) {
212 if (ACPI_GET_DESCRIPTOR_TYPE
213 (source_desc->reference.node) !=
214 ACPI_DESC_TYPE_NAMED) {
215 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
216 " %p - Not a valid namespace node\n",
217 source_desc->reference.
218 node));
219 } else {
220 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
221 "Node %p [%4.4s] ",
222 source_desc->reference.
223 node,
224 (source_desc->reference.
225 node)->name.ascii));
226
227 switch ((source_desc->reference.node)->type) {
228
229 /* These types have no attached object */
230
231 case ACPI_TYPE_DEVICE:
232 acpi_os_printf("Device\n");
233 break;
234
235 case ACPI_TYPE_THERMAL:
236 acpi_os_printf("Thermal Zone\n");
237 break;
238
239 default:
240 acpi_ex_do_debug_object((source_desc->
241 reference.
242 node)->object,
243 level + 4, 0);
244 break;
245 }
246 }
247 } else if (source_desc->reference.object) {
248 if (ACPI_GET_DESCRIPTOR_TYPE
249 (source_desc->reference.object) ==
250 ACPI_DESC_TYPE_NAMED) {
251 acpi_ex_do_debug_object(((struct
252 acpi_namespace_node *)
253 source_desc->reference.
254 object)->object,
255 level + 4, 0);
256 } else {
257 acpi_ex_do_debug_object(source_desc->reference.
258 object, level + 4, 0);
259 }
260 }
261 break;
262
263 default:
264
265 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%p\n",
266 source_desc));
267 break;
268 }
269
270 ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "\n"));
271 return_VOID;
272}
273
274/*******************************************************************************
275 *
276 * FUNCTION: acpi_ex_store 62 * FUNCTION: acpi_ex_store
277 * 63 *
278 * PARAMETERS: *source_desc - Value to be stored 64 * PARAMETERS: *source_desc - Value to be stored
@@ -402,7 +188,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
402 source_desc, 188 source_desc,
403 acpi_ut_get_object_type_name(source_desc))); 189 acpi_ut_get_object_type_name(source_desc)));
404 190
405 acpi_ex_do_debug_object(source_desc, 0, 0); 191 ACPI_DEBUG_OBJECT(source_desc, 0, 0);
406 break; 192 break;
407 193
408 default: 194 default: