diff options
Diffstat (limited to 'drivers/acpi/executer')
-rw-r--r-- | drivers/acpi/executer/exdump.c | 656 | ||||
-rw-r--r-- | drivers/acpi/executer/exmisc.c | 47 |
2 files changed, 432 insertions, 271 deletions
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 4477a62fed56..5a4cca171af6 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c | |||
@@ -55,20 +55,386 @@ ACPI_MODULE_NAME("exdump") | |||
55 | */ | 55 | */ |
56 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 56 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
57 | /* Local prototypes */ | 57 | /* Local prototypes */ |
58 | #ifdef ACPI_FUTURE_USAGE | ||
59 | static void acpi_ex_out_string(char *title, char *value); | 58 | static void acpi_ex_out_string(char *title, char *value); |
60 | 59 | ||
61 | static void acpi_ex_out_pointer(char *title, void *value); | 60 | static void acpi_ex_out_pointer(char *title, void *value); |
62 | 61 | ||
63 | static void acpi_ex_out_integer(char *title, u32 value); | ||
64 | |||
65 | static void acpi_ex_out_address(char *title, acpi_physical_address value); | 62 | static void acpi_ex_out_address(char *title, acpi_physical_address value); |
66 | 63 | ||
67 | static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc); | 64 | static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc); |
68 | 65 | ||
69 | static void | 66 | static void |
70 | acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index); | 67 | acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, |
71 | #endif /* ACPI_FUTURE_USAGE */ | 68 | u32 level, u32 index); |
69 | |||
70 | /******************************************************************************* | ||
71 | * | ||
72 | * Object Descriptor info tables | ||
73 | * | ||
74 | * Note: The first table entry must be an INIT opcode and must contain | ||
75 | * the table length (number of table entries) | ||
76 | * | ||
77 | ******************************************************************************/ | ||
78 | |||
79 | static struct acpi_exdump_info acpi_ex_dump_integer[2] = { | ||
80 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_integer), NULL}, | ||
81 | {ACPI_EXD_UINT64, ACPI_EXD_OFFSET(integer.value), "Value"} | ||
82 | }; | ||
83 | |||
84 | static struct acpi_exdump_info acpi_ex_dump_string[4] = { | ||
85 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_string), NULL}, | ||
86 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(string.length), "Length"}, | ||
87 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(string.pointer), "Pointer"}, | ||
88 | {ACPI_EXD_STRING, 0, NULL} | ||
89 | }; | ||
90 | |||
91 | static struct acpi_exdump_info acpi_ex_dump_buffer[4] = { | ||
92 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_buffer), NULL}, | ||
93 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(buffer.length), "Length"}, | ||
94 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer.pointer), "Pointer"}, | ||
95 | {ACPI_EXD_BUFFER, 0, NULL} | ||
96 | }; | ||
97 | |||
98 | static struct acpi_exdump_info acpi_ex_dump_package[5] = { | ||
99 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_package), NULL}, | ||
100 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(package.flags), "Flags"}, | ||
101 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(package.count), "Elements"}, | ||
102 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(package.elements), "Element List"}, | ||
103 | {ACPI_EXD_PACKAGE, 0, NULL} | ||
104 | }; | ||
105 | |||
106 | static struct acpi_exdump_info acpi_ex_dump_device[4] = { | ||
107 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_device), NULL}, | ||
108 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.handler), "Handler"}, | ||
109 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.system_notify), | ||
110 | "System Notify"}, | ||
111 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.device_notify), | ||
112 | "Device Notify"} | ||
113 | }; | ||
114 | |||
115 | static struct acpi_exdump_info acpi_ex_dump_event[2] = { | ||
116 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_event), NULL}, | ||
117 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(event.semaphore), "Semaphore"} | ||
118 | }; | ||
119 | |||
120 | static struct acpi_exdump_info acpi_ex_dump_method[7] = { | ||
121 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, | ||
122 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "param_count"}, | ||
123 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"}, | ||
124 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"}, | ||
125 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"}, | ||
126 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(method.aml_length), "Aml Length"}, | ||
127 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.aml_start), "Aml Start"} | ||
128 | }; | ||
129 | |||
130 | static struct acpi_exdump_info acpi_ex_dump_mutex[5] = { | ||
131 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_mutex), NULL}, | ||
132 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(mutex.sync_level), "Sync Level"}, | ||
133 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.owner_thread), "Owner Thread"}, | ||
134 | {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(mutex.acquisition_depth), | ||
135 | "Acquire Depth"}, | ||
136 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.semaphore), "Semaphore"} | ||
137 | }; | ||
138 | |||
139 | static struct acpi_exdump_info acpi_ex_dump_region[7] = { | ||
140 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region), NULL}, | ||
141 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.space_id), "Space Id"}, | ||
142 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.flags), "Flags"}, | ||
143 | {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(region.address), "Address"}, | ||
144 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(region.length), "Length"}, | ||
145 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(region.handler), "Handler"}, | ||
146 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(region.next), "Next"} | ||
147 | }; | ||
148 | |||
149 | static struct acpi_exdump_info acpi_ex_dump_power[5] = { | ||
150 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_power), NULL}, | ||
151 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.system_level), | ||
152 | "System Level"}, | ||
153 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.resource_order), | ||
154 | "Resource Order"}, | ||
155 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.system_notify), | ||
156 | "System Notify"}, | ||
157 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.device_notify), | ||
158 | "Device Notify"} | ||
159 | }; | ||
160 | |||
161 | static struct acpi_exdump_info acpi_ex_dump_processor[7] = { | ||
162 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_processor), NULL}, | ||
163 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(processor.proc_id), "Processor ID"}, | ||
164 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(processor.length), "Length"}, | ||
165 | {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(processor.address), "Address"}, | ||
166 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.system_notify), | ||
167 | "System Notify"}, | ||
168 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.device_notify), | ||
169 | "Device Notify"}, | ||
170 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.handler), "Handler"} | ||
171 | }; | ||
172 | |||
173 | static struct acpi_exdump_info acpi_ex_dump_thermal[4] = { | ||
174 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_thermal), NULL}, | ||
175 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.system_notify), | ||
176 | "System Notify"}, | ||
177 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.device_notify), | ||
178 | "Device Notify"}, | ||
179 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.handler), "Handler"} | ||
180 | }; | ||
181 | |||
182 | static struct acpi_exdump_info acpi_ex_dump_buffer_field[3] = { | ||
183 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_buffer_field), NULL}, | ||
184 | {ACPI_EXD_FIELD, 0, NULL}, | ||
185 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer_field.buffer_obj), | ||
186 | "Buffer Object"} | ||
187 | }; | ||
188 | |||
189 | static struct acpi_exdump_info acpi_ex_dump_region_field[3] = { | ||
190 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region_field), NULL}, | ||
191 | {ACPI_EXD_FIELD, 0, NULL}, | ||
192 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(field.region_obj), "Region Object"} | ||
193 | }; | ||
194 | |||
195 | static struct acpi_exdump_info acpi_ex_dump_bank_field[5] = { | ||
196 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_bank_field), NULL}, | ||
197 | {ACPI_EXD_FIELD, 0, NULL}, | ||
198 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(bank_field.value), "Value"}, | ||
199 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(bank_field.region_obj), | ||
200 | "Region Object"}, | ||
201 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(bank_field.bank_obj), "Bank Object"} | ||
202 | }; | ||
203 | |||
204 | static struct acpi_exdump_info acpi_ex_dump_index_field[5] = { | ||
205 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_bank_field), NULL}, | ||
206 | {ACPI_EXD_FIELD, 0, NULL}, | ||
207 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(index_field.value), "Value"}, | ||
208 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.index_obj), | ||
209 | "Index Object"}, | ||
210 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.data_obj), "Data Object"} | ||
211 | }; | ||
212 | |||
213 | static struct acpi_exdump_info acpi_ex_dump_reference[7] = { | ||
214 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_reference), NULL}, | ||
215 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.target_type), "Target Type"}, | ||
216 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(reference.offset), "Offset"}, | ||
217 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.object), "Object Desc"}, | ||
218 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.node), "Node"}, | ||
219 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.where), "Where"}, | ||
220 | {ACPI_EXD_REFERENCE, 0, NULL} | ||
221 | }; | ||
222 | |||
223 | static struct acpi_exdump_info acpi_ex_dump_address_handler[6] = { | ||
224 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_address_handler), | ||
225 | NULL}, | ||
226 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(address_space.space_id), "Space Id"}, | ||
227 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.next), "Next"}, | ||
228 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.region_list), | ||
229 | "Region List"}, | ||
230 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.node), "Node"}, | ||
231 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.context), "Context"} | ||
232 | }; | ||
233 | |||
234 | static struct acpi_exdump_info acpi_ex_dump_notify[3] = { | ||
235 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_notify), NULL}, | ||
236 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.node), "Node"}, | ||
237 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.context), "Context"} | ||
238 | }; | ||
239 | |||
240 | /* Miscellaneous tables */ | ||
241 | |||
242 | static struct acpi_exdump_info acpi_ex_dump_common[4] = { | ||
243 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_common), NULL}, | ||
244 | {ACPI_EXD_TYPE, 0, NULL}, | ||
245 | {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(common.reference_count), | ||
246 | "Reference Count"}, | ||
247 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common.flags), "Flags"} | ||
248 | }; | ||
249 | |||
250 | static struct acpi_exdump_info acpi_ex_dump_field_common[7] = { | ||
251 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_field_common), NULL}, | ||
252 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.field_flags), | ||
253 | "Field Flags"}, | ||
254 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.access_byte_width), | ||
255 | "Access Byte Width"}, | ||
256 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(common_field.bit_length), | ||
257 | "Bit Length"}, | ||
258 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.start_field_bit_offset), | ||
259 | "Field Bit Offset"}, | ||
260 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(common_field.base_byte_offset), | ||
261 | "Base Byte Offset"}, | ||
262 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"} | ||
263 | }; | ||
264 | |||
265 | static struct acpi_exdump_info acpi_ex_dump_node[6] = { | ||
266 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL}, | ||
267 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"}, | ||
268 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"}, | ||
269 | {ACPI_EXD_UINT16, ACPI_EXD_NSOFFSET(reference_count), | ||
270 | "Reference Count"}, | ||
271 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(child), "Child List"}, | ||
272 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"} | ||
273 | }; | ||
274 | |||
275 | /* Dispatch table, indexed by object type */ | ||
276 | |||
277 | static struct acpi_exdump_info *acpi_ex_dump_info[] = { | ||
278 | NULL, | ||
279 | acpi_ex_dump_integer, | ||
280 | acpi_ex_dump_string, | ||
281 | acpi_ex_dump_buffer, | ||
282 | acpi_ex_dump_package, | ||
283 | NULL, | ||
284 | acpi_ex_dump_device, | ||
285 | acpi_ex_dump_event, | ||
286 | acpi_ex_dump_method, | ||
287 | acpi_ex_dump_mutex, | ||
288 | acpi_ex_dump_region, | ||
289 | acpi_ex_dump_power, | ||
290 | acpi_ex_dump_processor, | ||
291 | acpi_ex_dump_thermal, | ||
292 | acpi_ex_dump_buffer_field, | ||
293 | NULL, | ||
294 | NULL, | ||
295 | acpi_ex_dump_region_field, | ||
296 | acpi_ex_dump_bank_field, | ||
297 | acpi_ex_dump_index_field, | ||
298 | acpi_ex_dump_reference, | ||
299 | NULL, | ||
300 | NULL, | ||
301 | acpi_ex_dump_notify, | ||
302 | acpi_ex_dump_address_handler, | ||
303 | NULL, | ||
304 | NULL, | ||
305 | NULL | ||
306 | }; | ||
307 | |||
308 | /******************************************************************************* | ||
309 | * | ||
310 | * FUNCTION: acpi_ex_dump_object | ||
311 | * | ||
312 | * PARAMETERS: obj_desc - Descriptor to dump | ||
313 | * Info - Info table corresponding to this object | ||
314 | * type | ||
315 | * | ||
316 | * RETURN: None | ||
317 | * | ||
318 | * DESCRIPTION: Walk the info table for this object | ||
319 | * | ||
320 | ******************************************************************************/ | ||
321 | |||
322 | static void | ||
323 | acpi_ex_dump_object(union acpi_operand_object *obj_desc, | ||
324 | struct acpi_exdump_info *info) | ||
325 | { | ||
326 | u8 *target; | ||
327 | char *name; | ||
328 | u8 count; | ||
329 | |||
330 | if (!info) { | ||
331 | acpi_os_printf | ||
332 | ("ex_dump_object: Display not implemented for object type %s\n", | ||
333 | acpi_ut_get_object_type_name(obj_desc)); | ||
334 | return; | ||
335 | } | ||
336 | |||
337 | /* First table entry must contain the table length (# of table entries) */ | ||
338 | |||
339 | count = info->offset; | ||
340 | |||
341 | while (count) { | ||
342 | target = ((u8 *) obj_desc) + info->offset; | ||
343 | name = info->name; | ||
344 | |||
345 | switch (info->opcode) { | ||
346 | case ACPI_EXD_INIT: | ||
347 | break; | ||
348 | |||
349 | case ACPI_EXD_TYPE: | ||
350 | acpi_ex_out_string("Type", | ||
351 | acpi_ut_get_object_type_name | ||
352 | (obj_desc)); | ||
353 | break; | ||
354 | |||
355 | case ACPI_EXD_UINT8: | ||
356 | |||
357 | acpi_os_printf("%20s : %2.2X\n", name, *target); | ||
358 | break; | ||
359 | |||
360 | case ACPI_EXD_UINT16: | ||
361 | |||
362 | acpi_os_printf("%20s : %4.4X\n", name, | ||
363 | *ACPI_CAST_PTR(u16, target)); | ||
364 | break; | ||
365 | |||
366 | case ACPI_EXD_UINT32: | ||
367 | |||
368 | acpi_os_printf("%20s : %8.8X\n", name, | ||
369 | *ACPI_CAST_PTR(u32, target)); | ||
370 | break; | ||
371 | |||
372 | case ACPI_EXD_UINT64: | ||
373 | |||
374 | acpi_os_printf("%20s : %8.8X%8.8X\n", "Value", | ||
375 | ACPI_FORMAT_UINT64(*ACPI_CAST_PTR | ||
376 | (u64, target))); | ||
377 | break; | ||
378 | |||
379 | case ACPI_EXD_POINTER: | ||
380 | |||
381 | acpi_ex_out_pointer(name, | ||
382 | *ACPI_CAST_PTR(void *, target)); | ||
383 | break; | ||
384 | |||
385 | case ACPI_EXD_ADDRESS: | ||
386 | |||
387 | acpi_ex_out_address(name, | ||
388 | *ACPI_CAST_PTR | ||
389 | (acpi_physical_address, target)); | ||
390 | break; | ||
391 | |||
392 | case ACPI_EXD_STRING: | ||
393 | |||
394 | acpi_ut_print_string(obj_desc->string.pointer, | ||
395 | ACPI_UINT8_MAX); | ||
396 | acpi_os_printf("\n"); | ||
397 | break; | ||
398 | |||
399 | case ACPI_EXD_BUFFER: | ||
400 | |||
401 | ACPI_DUMP_BUFFER(obj_desc->buffer.pointer, | ||
402 | obj_desc->buffer.length); | ||
403 | break; | ||
404 | |||
405 | case ACPI_EXD_PACKAGE: | ||
406 | |||
407 | /* Dump the package contents */ | ||
408 | |||
409 | acpi_os_printf("\nPackage Contents:\n"); | ||
410 | acpi_ex_dump_package_obj(obj_desc, 0, 0); | ||
411 | break; | ||
412 | |||
413 | case ACPI_EXD_FIELD: | ||
414 | |||
415 | acpi_ex_dump_object(obj_desc, | ||
416 | acpi_ex_dump_field_common); | ||
417 | break; | ||
418 | |||
419 | case ACPI_EXD_REFERENCE: | ||
420 | |||
421 | acpi_ex_out_string("Opcode", | ||
422 | (acpi_ps_get_opcode_info | ||
423 | (obj_desc->reference.opcode))-> | ||
424 | name); | ||
425 | acpi_ex_dump_reference_obj(obj_desc); | ||
426 | break; | ||
427 | |||
428 | default: | ||
429 | acpi_os_printf("**** Invalid table opcode [%X] ****\n", | ||
430 | info->opcode); | ||
431 | return; | ||
432 | } | ||
433 | |||
434 | info++; | ||
435 | count--; | ||
436 | } | ||
437 | } | ||
72 | 438 | ||
73 | /******************************************************************************* | 439 | /******************************************************************************* |
74 | * | 440 | * |
@@ -441,7 +807,6 @@ acpi_ex_dump_operands(union acpi_operand_object **operands, | |||
441 | return; | 807 | return; |
442 | } | 808 | } |
443 | 809 | ||
444 | #ifdef ACPI_FUTURE_USAGE | ||
445 | /******************************************************************************* | 810 | /******************************************************************************* |
446 | * | 811 | * |
447 | * FUNCTION: acpi_ex_out* functions | 812 | * FUNCTION: acpi_ex_out* functions |
@@ -465,11 +830,6 @@ static void acpi_ex_out_pointer(char *title, void *value) | |||
465 | acpi_os_printf("%20s : %p\n", title, value); | 830 | acpi_os_printf("%20s : %p\n", title, value); |
466 | } | 831 | } |
467 | 832 | ||
468 | static void acpi_ex_out_integer(char *title, u32 value) | ||
469 | { | ||
470 | acpi_os_printf("%20s : %.2X\n", title, value); | ||
471 | } | ||
472 | |||
473 | static void acpi_ex_out_address(char *title, acpi_physical_address value) | 833 | static void acpi_ex_out_address(char *title, acpi_physical_address value) |
474 | { | 834 | { |
475 | 835 | ||
@@ -482,16 +842,16 @@ static void acpi_ex_out_address(char *title, acpi_physical_address value) | |||
482 | 842 | ||
483 | /******************************************************************************* | 843 | /******************************************************************************* |
484 | * | 844 | * |
485 | * FUNCTION: acpi_ex_dump_node | 845 | * FUNCTION: acpi_ex_dump_namespace_node |
486 | * | 846 | * |
487 | * PARAMETERS: *Node - Descriptor to dump | 847 | * PARAMETERS: Node - Descriptor to dump |
488 | * Flags - Force display if TRUE | 848 | * Flags - Force display if TRUE |
489 | * | 849 | * |
490 | * DESCRIPTION: Dumps the members of the given.Node | 850 | * DESCRIPTION: Dumps the members of the given.Node |
491 | * | 851 | * |
492 | ******************************************************************************/ | 852 | ******************************************************************************/ |
493 | 853 | ||
494 | void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags) | 854 | void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags) |
495 | { | 855 | { |
496 | 856 | ||
497 | ACPI_FUNCTION_ENTRY(); | 857 | ACPI_FUNCTION_ENTRY(); |
@@ -506,19 +866,17 @@ void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags) | |||
506 | 866 | ||
507 | acpi_os_printf("%20s : %4.4s\n", "Name", acpi_ut_get_node_name(node)); | 867 | acpi_os_printf("%20s : %4.4s\n", "Name", acpi_ut_get_node_name(node)); |
508 | acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type)); | 868 | acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type)); |
509 | acpi_ex_out_integer("Flags", node->flags); | ||
510 | acpi_ex_out_integer("Owner Id", node->owner_id); | ||
511 | acpi_ex_out_integer("Reference Count", node->reference_count); | ||
512 | acpi_ex_out_pointer("Attached Object", | 869 | acpi_ex_out_pointer("Attached Object", |
513 | acpi_ns_get_attached_object(node)); | 870 | acpi_ns_get_attached_object(node)); |
514 | acpi_ex_out_pointer("child_list", node->child); | ||
515 | acpi_ex_out_pointer("next_peer", node->peer); | ||
516 | acpi_ex_out_pointer("Parent", acpi_ns_get_parent_node(node)); | 871 | acpi_ex_out_pointer("Parent", acpi_ns_get_parent_node(node)); |
872 | |||
873 | acpi_ex_dump_object(ACPI_CAST_PTR(union acpi_operand_object, node), | ||
874 | acpi_ex_dump_node); | ||
517 | } | 875 | } |
518 | 876 | ||
519 | /******************************************************************************* | 877 | /******************************************************************************* |
520 | * | 878 | * |
521 | * FUNCTION: acpi_ex_dump_reference | 879 | * FUNCTION: acpi_ex_dump_reference_obj |
522 | * | 880 | * |
523 | * PARAMETERS: Object - Descriptor to dump | 881 | * PARAMETERS: Object - Descriptor to dump |
524 | * | 882 | * |
@@ -526,14 +884,16 @@ void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags) | |||
526 | * | 884 | * |
527 | ******************************************************************************/ | 885 | ******************************************************************************/ |
528 | 886 | ||
529 | static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc) | 887 | static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc) |
530 | { | 888 | { |
531 | struct acpi_buffer ret_buf; | 889 | struct acpi_buffer ret_buf; |
532 | acpi_status status; | 890 | acpi_status status; |
533 | 891 | ||
892 | ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; | ||
893 | |||
534 | if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { | 894 | if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { |
535 | acpi_os_printf("Named Object %p ", obj_desc->reference.node); | 895 | acpi_os_printf("Named Object %p ", obj_desc->reference.node); |
536 | ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 896 | |
537 | status = | 897 | status = |
538 | acpi_ns_handle_to_pathname(obj_desc->reference.node, | 898 | acpi_ns_handle_to_pathname(obj_desc->reference.node, |
539 | &ret_buf); | 899 | &ret_buf); |
@@ -551,9 +911,9 @@ static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc) | |||
551 | 911 | ||
552 | /******************************************************************************* | 912 | /******************************************************************************* |
553 | * | 913 | * |
554 | * FUNCTION: acpi_ex_dump_package | 914 | * FUNCTION: acpi_ex_dump_package_obj |
555 | * | 915 | * |
556 | * PARAMETERS: Object - Descriptor to dump | 916 | * PARAMETERS: obj_desc - Descriptor to dump |
557 | * Level - Indentation Level | 917 | * Level - Indentation Level |
558 | * Index - Package index for this object | 918 | * Index - Package index for this object |
559 | * | 919 | * |
@@ -562,7 +922,8 @@ static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc) | |||
562 | ******************************************************************************/ | 922 | ******************************************************************************/ |
563 | 923 | ||
564 | static void | 924 | static void |
565 | acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index) | 925 | acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, |
926 | u32 level, u32 index) | ||
566 | { | 927 | { |
567 | u32 i; | 928 | u32 i; |
568 | 929 | ||
@@ -622,15 +983,15 @@ acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index) | |||
622 | obj_desc->package.count); | 983 | obj_desc->package.count); |
623 | 984 | ||
624 | for (i = 0; i < obj_desc->package.count; i++) { | 985 | for (i = 0; i < obj_desc->package.count; i++) { |
625 | acpi_ex_dump_package(obj_desc->package.elements[i], | 986 | acpi_ex_dump_package_obj(obj_desc->package.elements[i], |
626 | level + 1, i); | 987 | level + 1, i); |
627 | } | 988 | } |
628 | break; | 989 | break; |
629 | 990 | ||
630 | case ACPI_TYPE_LOCAL_REFERENCE: | 991 | case ACPI_TYPE_LOCAL_REFERENCE: |
631 | 992 | ||
632 | acpi_os_printf("[Object Reference] "); | 993 | acpi_os_printf("[Object Reference] "); |
633 | acpi_ex_dump_reference(obj_desc); | 994 | acpi_ex_dump_reference_obj(obj_desc); |
634 | break; | 995 | break; |
635 | 996 | ||
636 | default: | 997 | default: |
@@ -645,7 +1006,7 @@ acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index) | |||
645 | * | 1006 | * |
646 | * FUNCTION: acpi_ex_dump_object_descriptor | 1007 | * FUNCTION: acpi_ex_dump_object_descriptor |
647 | * | 1008 | * |
648 | * PARAMETERS: Object - Descriptor to dump | 1009 | * PARAMETERS: obj_desc - Descriptor to dump |
649 | * Flags - Force display if TRUE | 1010 | * Flags - Force display if TRUE |
650 | * | 1011 | * |
651 | * DESCRIPTION: Dumps the members of the object descriptor given. | 1012 | * DESCRIPTION: Dumps the members of the object descriptor given. |
@@ -670,11 +1031,13 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) | |||
670 | } | 1031 | } |
671 | 1032 | ||
672 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) { | 1033 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) { |
673 | acpi_ex_dump_node((struct acpi_namespace_node *)obj_desc, | 1034 | acpi_ex_dump_namespace_node((struct acpi_namespace_node *) |
674 | flags); | 1035 | obj_desc, flags); |
1036 | |||
675 | acpi_os_printf("\nAttached Object (%p):\n", | 1037 | acpi_os_printf("\nAttached Object (%p):\n", |
676 | ((struct acpi_namespace_node *)obj_desc)-> | 1038 | ((struct acpi_namespace_node *)obj_desc)-> |
677 | object); | 1039 | object); |
1040 | |||
678 | acpi_ex_dump_object_descriptor(((struct acpi_namespace_node *) | 1041 | acpi_ex_dump_object_descriptor(((struct acpi_namespace_node *) |
679 | obj_desc)->object, flags); | 1042 | obj_desc)->object, flags); |
680 | return_VOID; | 1043 | return_VOID; |
@@ -687,233 +1050,18 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) | |||
687 | return_VOID; | 1050 | return_VOID; |
688 | } | 1051 | } |
689 | 1052 | ||
690 | /* Common Fields */ | 1053 | if (obj_desc->common.type > ACPI_TYPE_NS_NODE_MAX) { |
691 | 1054 | return_VOID; | |
692 | acpi_ex_out_string("Type", acpi_ut_get_object_type_name(obj_desc)); | 1055 | } |
693 | acpi_ex_out_integer("Reference Count", | ||
694 | obj_desc->common.reference_count); | ||
695 | acpi_ex_out_integer("Flags", obj_desc->common.flags); | ||
696 | |||
697 | /* Object-specific Fields */ | ||
698 | |||
699 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | ||
700 | case ACPI_TYPE_INTEGER: | ||
701 | |||
702 | acpi_os_printf("%20s : %8.8X%8.8X\n", "Value", | ||
703 | ACPI_FORMAT_UINT64(obj_desc->integer.value)); | ||
704 | break; | ||
705 | |||
706 | case ACPI_TYPE_STRING: | ||
707 | |||
708 | acpi_ex_out_integer("Length", obj_desc->string.length); | ||
709 | |||
710 | acpi_os_printf("%20s : %p ", "Pointer", | ||
711 | obj_desc->string.pointer); | ||
712 | acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX); | ||
713 | acpi_os_printf("\n"); | ||
714 | break; | ||
715 | |||
716 | case ACPI_TYPE_BUFFER: | ||
717 | |||
718 | acpi_ex_out_integer("Length", obj_desc->buffer.length); | ||
719 | acpi_ex_out_pointer("Pointer", obj_desc->buffer.pointer); | ||
720 | ACPI_DUMP_BUFFER(obj_desc->buffer.pointer, | ||
721 | obj_desc->buffer.length); | ||
722 | break; | ||
723 | |||
724 | case ACPI_TYPE_PACKAGE: | ||
725 | |||
726 | acpi_ex_out_integer("Flags", obj_desc->package.flags); | ||
727 | acpi_ex_out_integer("Elements", obj_desc->package.count); | ||
728 | acpi_ex_out_pointer("Element List", obj_desc->package.elements); | ||
729 | |||
730 | /* Dump the package contents */ | ||
731 | |||
732 | acpi_os_printf("\nPackage Contents:\n"); | ||
733 | acpi_ex_dump_package(obj_desc, 0, 0); | ||
734 | break; | ||
735 | |||
736 | case ACPI_TYPE_DEVICE: | ||
737 | |||
738 | acpi_ex_out_pointer("Handler", obj_desc->device.handler); | ||
739 | acpi_ex_out_pointer("system_notify", | ||
740 | obj_desc->device.system_notify); | ||
741 | acpi_ex_out_pointer("device_notify", | ||
742 | obj_desc->device.device_notify); | ||
743 | break; | ||
744 | |||
745 | case ACPI_TYPE_EVENT: | ||
746 | |||
747 | acpi_ex_out_pointer("Semaphore", obj_desc->event.semaphore); | ||
748 | break; | ||
749 | |||
750 | case ACPI_TYPE_METHOD: | ||
751 | |||
752 | acpi_ex_out_integer("param_count", | ||
753 | obj_desc->method.param_count); | ||
754 | acpi_ex_out_integer("Concurrency", | ||
755 | obj_desc->method.concurrency); | ||
756 | acpi_ex_out_pointer("Semaphore", obj_desc->method.semaphore); | ||
757 | acpi_ex_out_integer("owner_id", obj_desc->method.owner_id); | ||
758 | acpi_ex_out_integer("aml_length", obj_desc->method.aml_length); | ||
759 | acpi_ex_out_pointer("aml_start", obj_desc->method.aml_start); | ||
760 | break; | ||
761 | |||
762 | case ACPI_TYPE_MUTEX: | ||
763 | |||
764 | acpi_ex_out_integer("sync_level", obj_desc->mutex.sync_level); | ||
765 | acpi_ex_out_pointer("owner_thread", | ||
766 | obj_desc->mutex.owner_thread); | ||
767 | acpi_ex_out_integer("acquire_depth", | ||
768 | obj_desc->mutex.acquisition_depth); | ||
769 | acpi_ex_out_pointer("Semaphore", obj_desc->mutex.semaphore); | ||
770 | break; | ||
771 | |||
772 | case ACPI_TYPE_REGION: | ||
773 | |||
774 | acpi_ex_out_integer("space_id", obj_desc->region.space_id); | ||
775 | acpi_ex_out_integer("Flags", obj_desc->region.flags); | ||
776 | acpi_ex_out_address("Address", obj_desc->region.address); | ||
777 | acpi_ex_out_integer("Length", obj_desc->region.length); | ||
778 | acpi_ex_out_pointer("Handler", obj_desc->region.handler); | ||
779 | acpi_ex_out_pointer("Next", obj_desc->region.next); | ||
780 | break; | ||
781 | |||
782 | case ACPI_TYPE_POWER: | ||
783 | |||
784 | acpi_ex_out_integer("system_level", | ||
785 | obj_desc->power_resource.system_level); | ||
786 | acpi_ex_out_integer("resource_order", | ||
787 | obj_desc->power_resource.resource_order); | ||
788 | acpi_ex_out_pointer("system_notify", | ||
789 | obj_desc->power_resource.system_notify); | ||
790 | acpi_ex_out_pointer("device_notify", | ||
791 | obj_desc->power_resource.device_notify); | ||
792 | break; | ||
793 | |||
794 | case ACPI_TYPE_PROCESSOR: | ||
795 | |||
796 | acpi_ex_out_integer("Processor ID", | ||
797 | obj_desc->processor.proc_id); | ||
798 | acpi_ex_out_integer("Length", obj_desc->processor.length); | ||
799 | acpi_ex_out_address("Address", | ||
800 | (acpi_physical_address) obj_desc->processor. | ||
801 | address); | ||
802 | acpi_ex_out_pointer("system_notify", | ||
803 | obj_desc->processor.system_notify); | ||
804 | acpi_ex_out_pointer("device_notify", | ||
805 | obj_desc->processor.device_notify); | ||
806 | acpi_ex_out_pointer("Handler", obj_desc->processor.handler); | ||
807 | break; | ||
808 | |||
809 | case ACPI_TYPE_THERMAL: | ||
810 | |||
811 | acpi_ex_out_pointer("system_notify", | ||
812 | obj_desc->thermal_zone.system_notify); | ||
813 | acpi_ex_out_pointer("device_notify", | ||
814 | obj_desc->thermal_zone.device_notify); | ||
815 | acpi_ex_out_pointer("Handler", obj_desc->thermal_zone.handler); | ||
816 | break; | ||
817 | |||
818 | case ACPI_TYPE_BUFFER_FIELD: | ||
819 | case ACPI_TYPE_LOCAL_REGION_FIELD: | ||
820 | case ACPI_TYPE_LOCAL_BANK_FIELD: | ||
821 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | ||
822 | |||
823 | acpi_ex_out_integer("field_flags", | ||
824 | obj_desc->common_field.field_flags); | ||
825 | acpi_ex_out_integer("access_byte_width", | ||
826 | obj_desc->common_field.access_byte_width); | ||
827 | acpi_ex_out_integer("bit_length", | ||
828 | obj_desc->common_field.bit_length); | ||
829 | acpi_ex_out_integer("fld_bit_offset", | ||
830 | obj_desc->common_field. | ||
831 | start_field_bit_offset); | ||
832 | acpi_ex_out_integer("base_byte_offset", | ||
833 | obj_desc->common_field.base_byte_offset); | ||
834 | acpi_ex_out_pointer("parent_node", obj_desc->common_field.node); | ||
835 | |||
836 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | ||
837 | case ACPI_TYPE_BUFFER_FIELD: | ||
838 | acpi_ex_out_pointer("buffer_obj", | ||
839 | obj_desc->buffer_field.buffer_obj); | ||
840 | break; | ||
841 | |||
842 | case ACPI_TYPE_LOCAL_REGION_FIELD: | ||
843 | acpi_ex_out_pointer("region_obj", | ||
844 | obj_desc->field.region_obj); | ||
845 | break; | ||
846 | |||
847 | case ACPI_TYPE_LOCAL_BANK_FIELD: | ||
848 | acpi_ex_out_integer("Value", | ||
849 | obj_desc->bank_field.value); | ||
850 | acpi_ex_out_pointer("region_obj", | ||
851 | obj_desc->bank_field.region_obj); | ||
852 | acpi_ex_out_pointer("bank_obj", | ||
853 | obj_desc->bank_field.bank_obj); | ||
854 | break; | ||
855 | |||
856 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | ||
857 | acpi_ex_out_integer("Value", | ||
858 | obj_desc->index_field.value); | ||
859 | acpi_ex_out_pointer("Index", | ||
860 | obj_desc->index_field.index_obj); | ||
861 | acpi_ex_out_pointer("Data", | ||
862 | obj_desc->index_field.data_obj); | ||
863 | break; | ||
864 | |||
865 | default: | ||
866 | /* All object types covered above */ | ||
867 | break; | ||
868 | } | ||
869 | break; | ||
870 | |||
871 | case ACPI_TYPE_LOCAL_REFERENCE: | ||
872 | |||
873 | acpi_ex_out_integer("target_type", | ||
874 | obj_desc->reference.target_type); | ||
875 | acpi_ex_out_string("Opcode", | ||
876 | (acpi_ps_get_opcode_info | ||
877 | (obj_desc->reference.opcode))->name); | ||
878 | acpi_ex_out_integer("Offset", obj_desc->reference.offset); | ||
879 | acpi_ex_out_pointer("obj_desc", obj_desc->reference.object); | ||
880 | acpi_ex_out_pointer("Node", obj_desc->reference.node); | ||
881 | acpi_ex_out_pointer("Where", obj_desc->reference.where); | ||
882 | |||
883 | acpi_ex_dump_reference(obj_desc); | ||
884 | break; | ||
885 | |||
886 | case ACPI_TYPE_LOCAL_ADDRESS_HANDLER: | ||
887 | |||
888 | acpi_ex_out_integer("space_id", | ||
889 | obj_desc->address_space.space_id); | ||
890 | acpi_ex_out_pointer("Next", obj_desc->address_space.next); | ||
891 | acpi_ex_out_pointer("region_list", | ||
892 | obj_desc->address_space.region_list); | ||
893 | acpi_ex_out_pointer("Node", obj_desc->address_space.node); | ||
894 | acpi_ex_out_pointer("Context", obj_desc->address_space.context); | ||
895 | break; | ||
896 | 1056 | ||
897 | case ACPI_TYPE_LOCAL_NOTIFY: | 1057 | /* Common Fields */ |
898 | 1058 | ||
899 | acpi_ex_out_pointer("Node", obj_desc->notify.node); | 1059 | acpi_ex_dump_object(obj_desc, acpi_ex_dump_common); |
900 | acpi_ex_out_pointer("Context", obj_desc->notify.context); | ||
901 | break; | ||
902 | 1060 | ||
903 | case ACPI_TYPE_LOCAL_ALIAS: | 1061 | /* Object-specific fields */ |
904 | case ACPI_TYPE_LOCAL_METHOD_ALIAS: | ||
905 | case ACPI_TYPE_LOCAL_EXTRA: | ||
906 | case ACPI_TYPE_LOCAL_DATA: | ||
907 | default: | ||
908 | |||
909 | acpi_os_printf | ||
910 | ("ex_dump_object_descriptor: Display not implemented for object type %s\n", | ||
911 | acpi_ut_get_object_type_name(obj_desc)); | ||
912 | break; | ||
913 | } | ||
914 | 1062 | ||
1063 | acpi_ex_dump_object(obj_desc, acpi_ex_dump_info[obj_desc->common.type]); | ||
915 | return_VOID; | 1064 | return_VOID; |
916 | } | 1065 | } |
917 | 1066 | ||
918 | #endif /* ACPI_FUTURE_USAGE */ | ||
919 | #endif | 1067 | #endif |
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 1899ab251393..00a25f8188f4 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 46 | #include <acpi/acinterp.h> |
47 | #include <acpi/amlcode.h> | 47 | #include <acpi/amlcode.h> |
48 | #include <acpi/amlresrc.h> | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
50 | ACPI_MODULE_NAME("exmisc") | 51 | ACPI_MODULE_NAME("exmisc") |
@@ -157,40 +158,52 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, | |||
157 | union acpi_operand_object **actual_return_desc, | 158 | union acpi_operand_object **actual_return_desc, |
158 | struct acpi_walk_state *walk_state) | 159 | struct acpi_walk_state *walk_state) |
159 | { | 160 | { |
161 | acpi_status status; | ||
160 | union acpi_operand_object *return_desc; | 162 | union acpi_operand_object *return_desc; |
161 | u8 *new_buf; | 163 | u8 *new_buf; |
162 | u8 *end_tag1; | 164 | u8 *end_tag; |
163 | u8 *end_tag2; | 165 | acpi_size length0; |
164 | acpi_size length1; | 166 | acpi_size length1; |
165 | acpi_size length2; | ||
166 | 167 | ||
167 | ACPI_FUNCTION_TRACE("ex_concat_template"); | 168 | ACPI_FUNCTION_TRACE("ex_concat_template"); |
168 | 169 | ||
169 | /* Find the end_tags in each resource template */ | 170 | /* |
171 | * Find the end_tag descriptor in each resource template. | ||
172 | * Note: returned pointers point TO the end_tag, not past it. | ||
173 | * | ||
174 | * Compute the length of each resource template | ||
175 | */ | ||
176 | status = acpi_ut_get_resource_end_tag(operand0, &end_tag); | ||
177 | if (ACPI_FAILURE(status)) { | ||
178 | return_ACPI_STATUS(status); | ||
179 | } | ||
170 | 180 | ||
171 | end_tag1 = acpi_ut_get_resource_end_tag(operand0); | 181 | length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer); |
172 | end_tag2 = acpi_ut_get_resource_end_tag(operand1); | 182 | |
173 | if (!end_tag1 || !end_tag2) { | 183 | status = acpi_ut_get_resource_end_tag(operand1, &end_tag); |
174 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | 184 | if (ACPI_FAILURE(status)) { |
185 | return_ACPI_STATUS(status); | ||
175 | } | 186 | } |
176 | 187 | ||
177 | /* Compute the length of each part */ | 188 | /* Include the end_tag in the second template length */ |
178 | 189 | ||
179 | length1 = ACPI_PTR_DIFF(end_tag1, operand0->buffer.pointer); | 190 | length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer) + |
180 | length2 = ACPI_PTR_DIFF(end_tag2, operand1->buffer.pointer) + 2; /* Size of END_TAG */ | 191 | sizeof(struct aml_resource_end_tag); |
181 | 192 | ||
182 | /* Create a new buffer object for the result */ | 193 | /* Create a new buffer object for the result */ |
183 | 194 | ||
184 | return_desc = acpi_ut_create_buffer_object(length1 + length2); | 195 | return_desc = acpi_ut_create_buffer_object(length0 + length1); |
185 | if (!return_desc) { | 196 | if (!return_desc) { |
186 | return_ACPI_STATUS(AE_NO_MEMORY); | 197 | return_ACPI_STATUS(AE_NO_MEMORY); |
187 | } | 198 | } |
188 | 199 | ||
189 | /* Copy the templates to the new descriptor */ | 200 | /* |
190 | 201 | * Copy the templates to the new buffer, 0 first, then 1 follows. One | |
202 | * end_tag descriptor is copied from Operand1. | ||
203 | */ | ||
191 | new_buf = return_desc->buffer.pointer; | 204 | new_buf = return_desc->buffer.pointer; |
192 | ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length1); | 205 | ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length0); |
193 | ACPI_MEMCPY(new_buf + length1, operand1->buffer.pointer, length2); | 206 | ACPI_MEMCPY(new_buf + length0, operand1->buffer.pointer, length1); |
194 | 207 | ||
195 | /* Compute the new checksum */ | 208 | /* Compute the new checksum */ |
196 | 209 | ||
@@ -198,7 +211,7 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, | |||
198 | acpi_ut_generate_checksum(return_desc->buffer.pointer, | 211 | acpi_ut_generate_checksum(return_desc->buffer.pointer, |
199 | (return_desc->buffer.length - 1)); | 212 | (return_desc->buffer.length - 1)); |
200 | 213 | ||
201 | /* Return the completed template descriptor */ | 214 | /* Return the completed resource template */ |
202 | 215 | ||
203 | *actual_return_desc = return_desc; | 216 | *actual_return_desc = return_desc; |
204 | return_ACPI_STATUS(AE_OK); | 217 | return_ACPI_STATUS(AE_OK); |