diff options
Diffstat (limited to 'drivers/acpi/dispatcher/dsinit.c')
-rw-r--r-- | drivers/acpi/dispatcher/dsinit.c | 141 |
1 files changed, 59 insertions, 82 deletions
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index d7790db50178..8693c704aea6 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c | |||
@@ -41,23 +41,17 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acdispat.h> | 45 | #include <acpi/acdispat.h> |
47 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
48 | 47 | ||
49 | #define _COMPONENT ACPI_DISPATCHER | 48 | #define _COMPONENT ACPI_DISPATCHER |
50 | ACPI_MODULE_NAME ("dsinit") | 49 | ACPI_MODULE_NAME("dsinit") |
51 | 50 | ||
52 | /* Local prototypes */ | 51 | /* Local prototypes */ |
53 | |||
54 | static acpi_status | 52 | static acpi_status |
55 | acpi_ds_init_one_object ( | 53 | acpi_ds_init_one_object(acpi_handle obj_handle, |
56 | acpi_handle obj_handle, | 54 | u32 level, void *context, void **return_value); |
57 | u32 level, | ||
58 | void *context, | ||
59 | void **return_value); | ||
60 | |||
61 | 55 | ||
62 | /******************************************************************************* | 56 | /******************************************************************************* |
63 | * | 57 | * |
@@ -80,26 +74,23 @@ acpi_ds_init_one_object ( | |||
80 | ******************************************************************************/ | 74 | ******************************************************************************/ |
81 | 75 | ||
82 | static acpi_status | 76 | static acpi_status |
83 | acpi_ds_init_one_object ( | 77 | acpi_ds_init_one_object(acpi_handle obj_handle, |
84 | acpi_handle obj_handle, | 78 | u32 level, void *context, void **return_value) |
85 | u32 level, | ||
86 | void *context, | ||
87 | void **return_value) | ||
88 | { | 79 | { |
89 | acpi_object_type type; | 80 | struct acpi_init_walk_info *info = |
90 | acpi_status status; | 81 | (struct acpi_init_walk_info *)context; |
91 | struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context; | 82 | struct acpi_namespace_node *node = |
92 | 83 | (struct acpi_namespace_node *)obj_handle; | |
93 | 84 | acpi_object_type type; | |
94 | ACPI_FUNCTION_NAME ("ds_init_one_object"); | 85 | acpi_status status; |
95 | 86 | ||
87 | ACPI_FUNCTION_NAME("ds_init_one_object"); | ||
96 | 88 | ||
97 | /* | 89 | /* |
98 | * We are only interested in objects owned by the table that | 90 | * We are only interested in NS nodes owned by the table that |
99 | * was just loaded | 91 | * was just loaded |
100 | */ | 92 | */ |
101 | if (((struct acpi_namespace_node *) obj_handle)->owner_id != | 93 | if (node->owner_id != info->table_desc->owner_id) { |
102 | info->table_desc->table_id) { | ||
103 | return (AE_OK); | 94 | return (AE_OK); |
104 | } | 95 | } |
105 | 96 | ||
@@ -107,33 +98,31 @@ acpi_ds_init_one_object ( | |||
107 | 98 | ||
108 | /* And even then, we are only interested in a few object types */ | 99 | /* And even then, we are only interested in a few object types */ |
109 | 100 | ||
110 | type = acpi_ns_get_type (obj_handle); | 101 | type = acpi_ns_get_type(obj_handle); |
111 | 102 | ||
112 | switch (type) { | 103 | switch (type) { |
113 | case ACPI_TYPE_REGION: | 104 | case ACPI_TYPE_REGION: |
114 | 105 | ||
115 | status = acpi_ds_initialize_region (obj_handle); | 106 | status = acpi_ds_initialize_region(obj_handle); |
116 | if (ACPI_FAILURE (status)) { | 107 | if (ACPI_FAILURE(status)) { |
117 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 108 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
118 | "Region %p [%4.4s] - Init failure, %s\n", | 109 | "Region %p [%4.4s] - Init failure, %s\n", |
119 | obj_handle, acpi_ut_get_node_name (obj_handle), | 110 | obj_handle, |
120 | acpi_format_exception (status))); | 111 | acpi_ut_get_node_name(obj_handle), |
112 | acpi_format_exception(status))); | ||
121 | } | 113 | } |
122 | 114 | ||
123 | info->op_region_count++; | 115 | info->op_region_count++; |
124 | break; | 116 | break; |
125 | 117 | ||
126 | |||
127 | case ACPI_TYPE_METHOD: | 118 | case ACPI_TYPE_METHOD: |
128 | 119 | ||
129 | info->method_count++; | ||
130 | |||
131 | /* | 120 | /* |
132 | * Print a dot for each method unless we are going to print | 121 | * Print a dot for each method unless we are going to print |
133 | * the entire pathname | 122 | * the entire pathname |
134 | */ | 123 | */ |
135 | if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { | 124 | if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { |
136 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); | 125 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); |
137 | } | 126 | } |
138 | 127 | ||
139 | /* | 128 | /* |
@@ -143,41 +132,32 @@ acpi_ds_init_one_object ( | |||
143 | * on a per-table basis. Currently, we just use a global for the width. | 132 | * on a per-table basis. Currently, we just use a global for the width. |
144 | */ | 133 | */ |
145 | if (info->table_desc->pointer->revision == 1) { | 134 | if (info->table_desc->pointer->revision == 1) { |
146 | ((struct acpi_namespace_node *) obj_handle)->flags |= ANOBJ_DATA_WIDTH_32; | 135 | node->flags |= ANOBJ_DATA_WIDTH_32; |
147 | } | 136 | } |
148 | 137 | ||
149 | /* | 138 | /* |
150 | * Always parse methods to detect errors, we will delete | 139 | * Always parse methods to detect errors, we will delete |
151 | * the parse tree below | 140 | * the parse tree below |
152 | */ | 141 | */ |
153 | status = acpi_ds_parse_method (obj_handle); | 142 | status = acpi_ds_parse_method(obj_handle); |
154 | if (ACPI_FAILURE (status)) { | 143 | if (ACPI_FAILURE(status)) { |
155 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 144 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
156 | "Method %p [%4.4s] - parse failure, %s\n", | 145 | "\n+Method %p [%4.4s] - parse failure, %s\n", |
157 | obj_handle, acpi_ut_get_node_name (obj_handle), | 146 | obj_handle, |
158 | acpi_format_exception (status))); | 147 | acpi_ut_get_node_name(obj_handle), |
148 | acpi_format_exception(status))); | ||
159 | 149 | ||
160 | /* This parse failed, but we will continue parsing more methods */ | 150 | /* This parse failed, but we will continue parsing more methods */ |
161 | |||
162 | break; | ||
163 | } | 151 | } |
164 | 152 | ||
165 | /* | 153 | info->method_count++; |
166 | * Delete the parse tree. We simply re-parse the method | ||
167 | * for every execution since there isn't much overhead | ||
168 | */ | ||
169 | acpi_ns_delete_namespace_subtree (obj_handle); | ||
170 | acpi_ns_delete_namespace_by_owner ( | ||
171 | ((struct acpi_namespace_node *) obj_handle)->object->method.owning_id); | ||
172 | break; | 154 | break; |
173 | 155 | ||
174 | |||
175 | case ACPI_TYPE_DEVICE: | 156 | case ACPI_TYPE_DEVICE: |
176 | 157 | ||
177 | info->device_count++; | 158 | info->device_count++; |
178 | break; | 159 | break; |
179 | 160 | ||
180 | |||
181 | default: | 161 | default: |
182 | break; | 162 | break; |
183 | } | 163 | } |
@@ -189,7 +169,6 @@ acpi_ds_init_one_object ( | |||
189 | return (AE_OK); | 169 | return (AE_OK); |
190 | } | 170 | } |
191 | 171 | ||
192 | |||
193 | /******************************************************************************* | 172 | /******************************************************************************* |
194 | * | 173 | * |
195 | * FUNCTION: acpi_ds_initialize_objects | 174 | * FUNCTION: acpi_ds_initialize_objects |
@@ -205,45 +184,43 @@ acpi_ds_init_one_object ( | |||
205 | ******************************************************************************/ | 184 | ******************************************************************************/ |
206 | 185 | ||
207 | acpi_status | 186 | acpi_status |
208 | acpi_ds_initialize_objects ( | 187 | acpi_ds_initialize_objects(struct acpi_table_desc * table_desc, |
209 | struct acpi_table_desc *table_desc, | 188 | struct acpi_namespace_node * start_node) |
210 | struct acpi_namespace_node *start_node) | ||
211 | { | 189 | { |
212 | acpi_status status; | 190 | acpi_status status; |
213 | struct acpi_init_walk_info info; | 191 | struct acpi_init_walk_info info; |
214 | 192 | ||
193 | ACPI_FUNCTION_TRACE("ds_initialize_objects"); | ||
215 | 194 | ||
216 | ACPI_FUNCTION_TRACE ("ds_initialize_objects"); | 195 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
196 | "**** Starting initialization of namespace objects ****\n")); | ||
197 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "Parsing all Control Methods:")); | ||
217 | 198 | ||
218 | 199 | info.method_count = 0; | |
219 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | ||
220 | "**** Starting initialization of namespace objects ****\n")); | ||
221 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:")); | ||
222 | |||
223 | info.method_count = 0; | ||
224 | info.op_region_count = 0; | 200 | info.op_region_count = 0; |
225 | info.object_count = 0; | 201 | info.object_count = 0; |
226 | info.device_count = 0; | 202 | info.device_count = 0; |
227 | info.table_desc = table_desc; | 203 | info.table_desc = table_desc; |
228 | 204 | ||
229 | /* Walk entire namespace from the supplied root */ | 205 | /* Walk entire namespace from the supplied root */ |
230 | 206 | ||
231 | status = acpi_walk_namespace (ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, | 207 | status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, |
232 | acpi_ds_init_one_object, &info, NULL); | 208 | acpi_ds_init_one_object, &info, NULL); |
233 | if (ACPI_FAILURE (status)) { | 209 | if (ACPI_FAILURE(status)) { |
234 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed, %s\n", | 210 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed, %s\n", |
235 | acpi_format_exception (status))); | 211 | acpi_format_exception(status))); |
236 | } | 212 | } |
237 | 213 | ||
238 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, | 214 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
239 | "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n", | 215 | "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n", |
240 | table_desc->pointer->signature, table_desc->table_id, info.object_count, | 216 | table_desc->pointer->signature, |
241 | info.device_count, info.method_count, info.op_region_count)); | 217 | table_desc->owner_id, info.object_count, |
218 | info.device_count, info.method_count, | ||
219 | info.op_region_count)); | ||
242 | 220 | ||
243 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 221 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
244 | "%hd Methods, %hd Regions\n", info.method_count, info.op_region_count)); | 222 | "%hd Methods, %hd Regions\n", info.method_count, |
223 | info.op_region_count)); | ||
245 | 224 | ||
246 | return_ACPI_STATUS (AE_OK); | 225 | return_ACPI_STATUS(AE_OK); |
247 | } | 226 | } |
248 | |||
249 | |||