aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/parser
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/parser')
-rw-r--r--drivers/acpi/parser/psargs.c2
-rw-r--r--drivers/acpi/parser/psxface.c142
2 files changed, 143 insertions, 1 deletions
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c
index 5858188f94a6..562d0f822ab1 100644
--- a/drivers/acpi/parser/psargs.c
+++ b/drivers/acpi/parser/psargs.c
@@ -116,7 +116,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)
116 break; 116 break;
117 } 117 }
118 118
119 return_VALUE(length); 119 return_UINT32(length);
120} 120}
121 121
122/******************************************************************************* 122/*******************************************************************************
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c
index 4dcbd443160e..4c426f4c6af6 100644
--- a/drivers/acpi/parser/psxface.c
+++ b/drivers/acpi/parser/psxface.c
@@ -50,6 +50,10 @@
50ACPI_MODULE_NAME("psxface") 50ACPI_MODULE_NAME("psxface")
51 51
52/* Local Prototypes */ 52/* Local Prototypes */
53static void acpi_ps_start_trace(struct acpi_parameter_info *info);
54
55static void acpi_ps_stop_trace(struct acpi_parameter_info *info);
56
53static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info); 57static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info);
54 58
55static void 59static void
@@ -57,6 +61,136 @@ acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action);
57 61
58/******************************************************************************* 62/*******************************************************************************
59 * 63 *
64 * FUNCTION: acpi_debug_trace
65 *
66 * PARAMETERS: method_name - Valid ACPI name string
67 * debug_level - Optional level mask. 0 to use default
68 * debug_layer - Optional layer mask. 0 to use default
69 * Flags - bit 1: one shot(1) or persistent(0)
70 *
71 * RETURN: Status
72 *
73 * DESCRIPTION: External interface to enable debug tracing during control
74 * method execution
75 *
76 ******************************************************************************/
77
78acpi_status
79acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags)
80{
81 acpi_status status;
82
83 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
84 if (ACPI_FAILURE(status)) {
85 return (status);
86 }
87
88 /* TBDs: Validate name, allow full path or just nameseg */
89
90 acpi_gbl_trace_method_name = *(u32 *) name;
91 acpi_gbl_trace_flags = flags;
92
93 if (debug_level) {
94 acpi_gbl_trace_dbg_level = debug_level;
95 }
96 if (debug_layer) {
97 acpi_gbl_trace_dbg_layer = debug_layer;
98 }
99
100 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
101 return (AE_OK);
102}
103
104/*******************************************************************************
105 *
106 * FUNCTION: acpi_ps_start_trace
107 *
108 * PARAMETERS: Info - Method info struct
109 *
110 * RETURN: None
111 *
112 * DESCRIPTION: Start control method execution trace
113 *
114 ******************************************************************************/
115
116static void acpi_ps_start_trace(struct acpi_parameter_info *info)
117{
118 acpi_status status;
119
120 ACPI_FUNCTION_ENTRY();
121
122 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
123 if (ACPI_FAILURE(status)) {
124 return;
125 }
126
127 if ((!acpi_gbl_trace_method_name) ||
128 (acpi_gbl_trace_method_name != info->node->name.integer)) {
129 goto exit;
130 }
131
132 acpi_gbl_original_dbg_level = acpi_dbg_level;
133 acpi_gbl_original_dbg_layer = acpi_dbg_layer;
134
135 acpi_dbg_level = 0x00FFFFFF;
136 acpi_dbg_layer = ACPI_UINT32_MAX;
137
138 if (acpi_gbl_trace_dbg_level) {
139 acpi_dbg_level = acpi_gbl_trace_dbg_level;
140 }
141 if (acpi_gbl_trace_dbg_layer) {
142 acpi_dbg_layer = acpi_gbl_trace_dbg_layer;
143 }
144
145 exit:
146 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
147}
148
149/*******************************************************************************
150 *
151 * FUNCTION: acpi_ps_stop_trace
152 *
153 * PARAMETERS: Info - Method info struct
154 *
155 * RETURN: None
156 *
157 * DESCRIPTION: Stop control method execution trace
158 *
159 ******************************************************************************/
160
161static void acpi_ps_stop_trace(struct acpi_parameter_info *info)
162{
163 acpi_status status;
164
165 ACPI_FUNCTION_ENTRY();
166
167 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
168 if (ACPI_FAILURE(status)) {
169 return;
170 }
171
172 if ((!acpi_gbl_trace_method_name) ||
173 (acpi_gbl_trace_method_name != info->node->name.integer)) {
174 goto exit;
175 }
176
177 /* Disable further tracing if type is one-shot */
178
179 if (acpi_gbl_trace_flags & 1) {
180 acpi_gbl_trace_method_name = 0;
181 acpi_gbl_trace_dbg_level = 0;
182 acpi_gbl_trace_dbg_layer = 0;
183 }
184
185 acpi_dbg_level = acpi_gbl_original_dbg_level;
186 acpi_dbg_layer = acpi_gbl_original_dbg_layer;
187
188 exit:
189 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
190}
191
192/*******************************************************************************
193 *
60 * FUNCTION: acpi_ps_execute_method 194 * FUNCTION: acpi_ps_execute_method
61 * 195 *
62 * PARAMETERS: Info - Method info block, contains: 196 * PARAMETERS: Info - Method info block, contains:
@@ -104,6 +238,10 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
104 */ 238 */
105 acpi_ps_update_parameter_list(info, REF_INCREMENT); 239 acpi_ps_update_parameter_list(info, REF_INCREMENT);
106 240
241 /* Begin tracing if requested */
242
243 acpi_ps_start_trace(info);
244
107 /* 245 /*
108 * 1) Perform the first pass parse of the method to enter any 246 * 1) Perform the first pass parse of the method to enter any
109 * named objects that it creates into the namespace 247 * named objects that it creates into the namespace
@@ -129,6 +267,10 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
129 status = acpi_ps_execute_pass(info); 267 status = acpi_ps_execute_pass(info);
130 268
131 cleanup: 269 cleanup:
270 /* End optional tracing */
271
272 acpi_ps_stop_trace(info);
273
132 /* Take away the extra reference that we gave the parameters above */ 274 /* Take away the extra reference that we gave the parameters above */
133 275
134 acpi_ps_update_parameter_list(info, REF_DECREMENT); 276 acpi_ps_update_parameter_list(info, REF_DECREMENT);