aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/parser
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2005-09-30 19:03:00 -0400
committerLen Brown <len.brown@intel.com>2005-12-10 00:20:25 -0500
commit50eca3eb89d73d9f0aa070b126c7ee6a616016ab (patch)
treeb2d06d21b34b9bd17eea4c53cff1f3866fa1b21d /drivers/acpi/parser
parent3d5271f9883cba7b54762bc4fe027d4172f06db7 (diff)
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code - specifically, optimizations in the area of the AML/internal resource conversion code. The code has been optimized to simplify and eliminate duplicated code, CPU stack use has been decreased by optimizing function parameters and local variables, and naming conventions across the manager have been standardized for clarity and ease of maintenance (this includes function, parameter, variable, and struct/typedef names.) All Resource Manager dispatch and information tables have been moved to a single location for clarity and ease of maintenance. One new file was created, named "rsinfo.c". The ACPI return macros (return_ACPI_STATUS, etc.) have been modified to guarantee that the argument is not evaluated twice, making them less prone to macro side-effects. However, since there exists the possibility of additional stack use if a particular compiler cannot optimize them (such as in the debug generation case), the original macros are optionally available. Note that some invocations of the return_VALUE macro may now cause size mismatch warnings; the return_UINT8 and return_UINT32 macros are provided to eliminate these. (From Randy Dunlap) Implemented a new mechanism to enable debug tracing for individual control methods. A new external interface, acpi_debug_trace(), is provided to enable this mechanism. The intent is to allow the host OS to easily enable and disable tracing for problematic control methods. This interface can be easily exposed to a user or debugger interface if desired. See the file psxface.c for details. acpi_ut_callocate() will now return a valid pointer if a length of zero is specified - a length of one is used and a warning is issued. This matches the behavior of acpi_ut_allocate(). Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
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);