0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <acpi/acpi.h>
0011 #include "accommon.h"
0012 #include "acinterp.h"
0013 #include "amlcode.h"
0014 #include "acnamesp.h"
0015
0016 #define _COMPONENT ACPI_EXECUTER
0017 ACPI_MODULE_NAME("exdump")
0018
0019
0020
0021
0022 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
0023
0024 static void acpi_ex_out_string(const char *title, const char *value);
0025
0026 static void acpi_ex_out_pointer(const char *title, const void *value);
0027
0028 static void
0029 acpi_ex_dump_object(union acpi_operand_object *obj_desc,
0030 struct acpi_exdump_info *info);
0031
0032 static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc);
0033
0034 static void
0035 acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,
0036 u32 level, u32 index);
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047 static struct acpi_exdump_info acpi_ex_dump_integer[2] = {
0048 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_integer), NULL},
0049 {ACPI_EXD_UINT64, ACPI_EXD_OFFSET(integer.value), "Value"}
0050 };
0051
0052 static struct acpi_exdump_info acpi_ex_dump_string[4] = {
0053 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_string), NULL},
0054 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(string.length), "Length"},
0055 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(string.pointer), "Pointer"},
0056 {ACPI_EXD_STRING, 0, NULL}
0057 };
0058
0059 static struct acpi_exdump_info acpi_ex_dump_buffer[5] = {
0060 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_buffer), NULL},
0061 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(buffer.length), "Length"},
0062 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer.pointer), "Pointer"},
0063 {ACPI_EXD_NODE, ACPI_EXD_OFFSET(buffer.node), "Parent Node"},
0064 {ACPI_EXD_BUFFER, 0, NULL}
0065 };
0066
0067 static struct acpi_exdump_info acpi_ex_dump_package[6] = {
0068 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_package), NULL},
0069 {ACPI_EXD_NODE, ACPI_EXD_OFFSET(package.node), "Parent Node"},
0070 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(package.flags), "Flags"},
0071 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(package.count), "Element Count"},
0072 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(package.elements), "Element List"},
0073 {ACPI_EXD_PACKAGE, 0, NULL}
0074 };
0075
0076 static struct acpi_exdump_info acpi_ex_dump_device[4] = {
0077 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_device), NULL},
0078 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.notify_list[0]),
0079 "System Notify"},
0080 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.notify_list[1]),
0081 "Device Notify"},
0082 {ACPI_EXD_HDLR_LIST, ACPI_EXD_OFFSET(device.handler), "Handler"}
0083 };
0084
0085 static struct acpi_exdump_info acpi_ex_dump_event[2] = {
0086 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_event), NULL},
0087 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(event.os_semaphore), "OsSemaphore"}
0088 };
0089
0090 static struct acpi_exdump_info acpi_ex_dump_method[9] = {
0091 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL},
0092 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.info_flags), "Info Flags"},
0093 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count),
0094 "Parameter Count"},
0095 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.sync_level), "Sync Level"},
0096 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.mutex), "Mutex"},
0097 {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"},
0098 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.thread_count), "Thread Count"},
0099 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(method.aml_length), "Aml Length"},
0100 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.aml_start), "Aml Start"}
0101 };
0102
0103 static struct acpi_exdump_info acpi_ex_dump_mutex[6] = {
0104 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_mutex), NULL},
0105 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(mutex.sync_level), "Sync Level"},
0106 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(mutex.original_sync_level),
0107 "Original Sync Level"},
0108 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.owner_thread), "Owner Thread"},
0109 {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(mutex.acquisition_depth),
0110 "Acquire Depth"},
0111 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.os_mutex), "OsMutex"}
0112 };
0113
0114 static struct acpi_exdump_info acpi_ex_dump_region[8] = {
0115 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region), NULL},
0116 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.space_id), "Space Id"},
0117 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.flags), "Flags"},
0118 {ACPI_EXD_NODE, ACPI_EXD_OFFSET(region.node), "Parent Node"},
0119 {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(region.address), "Address"},
0120 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(region.length), "Length"},
0121 {ACPI_EXD_HDLR_LIST, ACPI_EXD_OFFSET(region.handler), "Handler"},
0122 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(region.next), "Next"}
0123 };
0124
0125 static struct acpi_exdump_info acpi_ex_dump_power[6] = {
0126 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_power), NULL},
0127 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.system_level),
0128 "System Level"},
0129 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.resource_order),
0130 "Resource Order"},
0131 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.notify_list[0]),
0132 "System Notify"},
0133 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.notify_list[1]),
0134 "Device Notify"},
0135 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.handler), "Handler"}
0136 };
0137
0138 static struct acpi_exdump_info acpi_ex_dump_processor[7] = {
0139 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_processor), NULL},
0140 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(processor.proc_id), "Processor ID"},
0141 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(processor.length), "Length"},
0142 {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(processor.address), "Address"},
0143 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.notify_list[0]),
0144 "System Notify"},
0145 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.notify_list[1]),
0146 "Device Notify"},
0147 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.handler), "Handler"}
0148 };
0149
0150 static struct acpi_exdump_info acpi_ex_dump_thermal[4] = {
0151 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_thermal), NULL},
0152 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.notify_list[0]),
0153 "System Notify"},
0154 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.notify_list[1]),
0155 "Device Notify"},
0156 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.handler), "Handler"}
0157 };
0158
0159 static struct acpi_exdump_info acpi_ex_dump_buffer_field[3] = {
0160 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_buffer_field), NULL},
0161 {ACPI_EXD_FIELD, 0, NULL},
0162 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer_field.buffer_obj),
0163 "Buffer Object"}
0164 };
0165
0166 static struct acpi_exdump_info acpi_ex_dump_region_field[5] = {
0167 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region_field), NULL},
0168 {ACPI_EXD_FIELD, 0, NULL},
0169 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(field.access_length), "AccessLength"},
0170 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(field.region_obj), "Region Object"},
0171 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(field.resource_buffer),
0172 "ResourceBuffer"}
0173 };
0174
0175 static struct acpi_exdump_info acpi_ex_dump_bank_field[5] = {
0176 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_bank_field), NULL},
0177 {ACPI_EXD_FIELD, 0, NULL},
0178 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(bank_field.value), "Value"},
0179 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(bank_field.region_obj),
0180 "Region Object"},
0181 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(bank_field.bank_obj), "Bank Object"}
0182 };
0183
0184 static struct acpi_exdump_info acpi_ex_dump_index_field[5] = {
0185 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_bank_field), NULL},
0186 {ACPI_EXD_FIELD, 0, NULL},
0187 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(index_field.value), "Value"},
0188 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.index_obj),
0189 "Index Object"},
0190 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.data_obj), "Data Object"}
0191 };
0192
0193 static struct acpi_exdump_info acpi_ex_dump_reference[9] = {
0194 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_reference), NULL},
0195 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.class), "Class"},
0196 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.target_type), "Target Type"},
0197 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(reference.value), "Value"},
0198 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.object), "Object Desc"},
0199 {ACPI_EXD_NODE, ACPI_EXD_OFFSET(reference.node), "Node"},
0200 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.where), "Where"},
0201 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.index_pointer),
0202 "Index Pointer"},
0203 {ACPI_EXD_REFERENCE, 0, NULL}
0204 };
0205
0206 static struct acpi_exdump_info acpi_ex_dump_address_handler[6] = {
0207 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_address_handler),
0208 NULL},
0209 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(address_space.space_id), "Space Id"},
0210 {ACPI_EXD_HDLR_LIST, ACPI_EXD_OFFSET(address_space.next), "Next"},
0211 {ACPI_EXD_RGN_LIST, ACPI_EXD_OFFSET(address_space.region_list),
0212 "Region List"},
0213 {ACPI_EXD_NODE, ACPI_EXD_OFFSET(address_space.node), "Node"},
0214 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.context), "Context"}
0215 };
0216
0217 static struct acpi_exdump_info acpi_ex_dump_notify[7] = {
0218 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_notify), NULL},
0219 {ACPI_EXD_NODE, ACPI_EXD_OFFSET(notify.node), "Node"},
0220 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(notify.handler_type), "Handler Type"},
0221 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.handler), "Handler"},
0222 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.context), "Context"},
0223 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.next[0]),
0224 "Next System Notify"},
0225 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.next[1]), "Next Device Notify"}
0226 };
0227
0228 static struct acpi_exdump_info acpi_ex_dump_extra[6] = {
0229 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_extra), NULL},
0230 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(extra.method_REG), "_REG Method"},
0231 {ACPI_EXD_NODE, ACPI_EXD_OFFSET(extra.scope_node), "Scope Node"},
0232 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(extra.region_context),
0233 "Region Context"},
0234 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(extra.aml_start), "Aml Start"},
0235 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(extra.aml_length), "Aml Length"}
0236 };
0237
0238 static struct acpi_exdump_info acpi_ex_dump_data[3] = {
0239 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_data), NULL},
0240 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(data.handler), "Handler"},
0241 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(data.pointer), "Raw Data"}
0242 };
0243
0244
0245
0246 static struct acpi_exdump_info acpi_ex_dump_common[5] = {
0247 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_common), NULL},
0248 {ACPI_EXD_TYPE, 0, NULL},
0249 {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(common.reference_count),
0250 "Reference Count"},
0251 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common.flags), "Flags"},
0252 {ACPI_EXD_LIST, ACPI_EXD_OFFSET(common.next_object), "Object List"}
0253 };
0254
0255 static struct acpi_exdump_info acpi_ex_dump_field_common[7] = {
0256 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_field_common), NULL},
0257 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.field_flags),
0258 "Field Flags"},
0259 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.access_byte_width),
0260 "Access Byte Width"},
0261 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(common_field.bit_length),
0262 "Bit Length"},
0263 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.start_field_bit_offset),
0264 "Field Bit Offset"},
0265 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(common_field.base_byte_offset),
0266 "Base Byte Offset"},
0267 {ACPI_EXD_NODE, ACPI_EXD_OFFSET(common_field.node), "Parent Node"}
0268 };
0269
0270 static struct acpi_exdump_info acpi_ex_dump_node[7] = {
0271 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL},
0272 {ACPI_EXD_UINT16, ACPI_EXD_NSOFFSET(flags), "Flags"},
0273 {ACPI_EXD_UINT16, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"},
0274 {ACPI_EXD_LIST, ACPI_EXD_NSOFFSET(object), "Object List"},
0275 {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET(parent), "Parent"},
0276 {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET(child), "Child"},
0277 {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET(peer), "Peer"}
0278 };
0279
0280
0281
0282 static struct acpi_exdump_info *acpi_ex_dump_info[] = {
0283 NULL,
0284 acpi_ex_dump_integer,
0285 acpi_ex_dump_string,
0286 acpi_ex_dump_buffer,
0287 acpi_ex_dump_package,
0288 NULL,
0289 acpi_ex_dump_device,
0290 acpi_ex_dump_event,
0291 acpi_ex_dump_method,
0292 acpi_ex_dump_mutex,
0293 acpi_ex_dump_region,
0294 acpi_ex_dump_power,
0295 acpi_ex_dump_processor,
0296 acpi_ex_dump_thermal,
0297 acpi_ex_dump_buffer_field,
0298 NULL,
0299 NULL,
0300 acpi_ex_dump_region_field,
0301 acpi_ex_dump_bank_field,
0302 acpi_ex_dump_index_field,
0303 acpi_ex_dump_reference,
0304 NULL,
0305 NULL,
0306 acpi_ex_dump_notify,
0307 acpi_ex_dump_address_handler,
0308 NULL,
0309 NULL,
0310 NULL,
0311 acpi_ex_dump_extra,
0312 acpi_ex_dump_data
0313 };
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329 static void
0330 acpi_ex_dump_object(union acpi_operand_object *obj_desc,
0331 struct acpi_exdump_info *info)
0332 {
0333 u8 *target;
0334 const char *name;
0335 u8 count;
0336 union acpi_operand_object *start;
0337 union acpi_operand_object *data = NULL;
0338 union acpi_operand_object *next;
0339 struct acpi_namespace_node *node;
0340
0341 if (!info) {
0342 acpi_os_printf
0343 ("ExDumpObject: Display not implemented for object type %s\n",
0344 acpi_ut_get_object_type_name(obj_desc));
0345 return;
0346 }
0347
0348
0349
0350 count = info->offset;
0351
0352 while (count) {
0353 if (!obj_desc) {
0354 return;
0355 }
0356
0357 target = ACPI_ADD_PTR(u8, obj_desc, info->offset);
0358 name = info->name;
0359
0360 switch (info->opcode) {
0361 case ACPI_EXD_INIT:
0362
0363 break;
0364
0365 case ACPI_EXD_TYPE:
0366
0367 acpi_os_printf("%20s : %2.2X [%s]\n", "Type",
0368 obj_desc->common.type,
0369 acpi_ut_get_object_type_name(obj_desc));
0370 break;
0371
0372 case ACPI_EXD_UINT8:
0373
0374 acpi_os_printf("%20s : %2.2X\n", name, *target);
0375 break;
0376
0377 case ACPI_EXD_UINT16:
0378
0379 acpi_os_printf("%20s : %4.4X\n", name,
0380 ACPI_GET16(target));
0381 break;
0382
0383 case ACPI_EXD_UINT32:
0384
0385 acpi_os_printf("%20s : %8.8X\n", name,
0386 ACPI_GET32(target));
0387 break;
0388
0389 case ACPI_EXD_UINT64:
0390
0391 acpi_os_printf("%20s : %8.8X%8.8X\n", "Value",
0392 ACPI_FORMAT_UINT64(ACPI_GET64(target)));
0393 break;
0394
0395 case ACPI_EXD_POINTER:
0396 case ACPI_EXD_ADDRESS:
0397
0398 acpi_ex_out_pointer(name,
0399 *ACPI_CAST_PTR(void *, target));
0400 break;
0401
0402 case ACPI_EXD_STRING:
0403
0404 acpi_ut_print_string(obj_desc->string.pointer,
0405 ACPI_UINT8_MAX);
0406 acpi_os_printf("\n");
0407 break;
0408
0409 case ACPI_EXD_BUFFER:
0410
0411 ACPI_DUMP_BUFFER(obj_desc->buffer.pointer,
0412 obj_desc->buffer.length);
0413 break;
0414
0415 case ACPI_EXD_PACKAGE:
0416
0417
0418
0419 acpi_os_printf("\nPackage Contents:\n");
0420 acpi_ex_dump_package_obj(obj_desc, 0, 0);
0421 break;
0422
0423 case ACPI_EXD_FIELD:
0424
0425 acpi_ex_dump_object(obj_desc,
0426 acpi_ex_dump_field_common);
0427 break;
0428
0429 case ACPI_EXD_REFERENCE:
0430
0431 acpi_ex_out_string("Class Name",
0432 acpi_ut_get_reference_name
0433 (obj_desc));
0434 acpi_ex_dump_reference_obj(obj_desc);
0435 break;
0436
0437 case ACPI_EXD_LIST:
0438
0439 start = *ACPI_CAST_PTR(void *, target);
0440 next = start;
0441
0442 acpi_os_printf("%20s : %p ", name, next);
0443 if (next) {
0444 acpi_os_printf("%s (Type %2.2X)",
0445 acpi_ut_get_object_type_name
0446 (next), next->common.type);
0447
0448 while (next->common.next_object) {
0449 if ((next->common.type ==
0450 ACPI_TYPE_LOCAL_DATA) && !data) {
0451 data = next;
0452 }
0453
0454 next = next->common.next_object;
0455 acpi_os_printf("->%p(%s %2.2X)", next,
0456 acpi_ut_get_object_type_name
0457 (next),
0458 next->common.type);
0459
0460 if ((next == start) || (next == data)) {
0461 acpi_os_printf
0462 ("\n**** Error: Object list appears to be circular linked");
0463 break;
0464 }
0465 }
0466 } else {
0467 acpi_os_printf("- No attached objects");
0468 }
0469
0470 acpi_os_printf("\n");
0471 break;
0472
0473 case ACPI_EXD_HDLR_LIST:
0474
0475 start = *ACPI_CAST_PTR(void *, target);
0476 next = start;
0477
0478 acpi_os_printf("%20s : %p", name, next);
0479 if (next) {
0480 acpi_os_printf("(%s %2.2X)",
0481 acpi_ut_get_object_type_name
0482 (next),
0483 next->address_space.space_id);
0484
0485 while (next->address_space.next) {
0486 if ((next->common.type ==
0487 ACPI_TYPE_LOCAL_DATA) && !data) {
0488 data = next;
0489 }
0490
0491 next = next->address_space.next;
0492 acpi_os_printf("->%p(%s %2.2X)", next,
0493 acpi_ut_get_object_type_name
0494 (next),
0495 next->address_space.
0496 space_id);
0497
0498 if ((next == start) || (next == data)) {
0499 acpi_os_printf
0500 ("\n**** Error: Handler list appears to be circular linked");
0501 break;
0502 }
0503 }
0504 }
0505
0506 acpi_os_printf("\n");
0507 break;
0508
0509 case ACPI_EXD_RGN_LIST:
0510
0511 start = *ACPI_CAST_PTR(void *, target);
0512 next = start;
0513
0514 acpi_os_printf("%20s : %p", name, next);
0515 if (next) {
0516 acpi_os_printf("(%s %2.2X)",
0517 acpi_ut_get_object_type_name
0518 (next), next->common.type);
0519
0520 while (next->region.next) {
0521 if ((next->common.type ==
0522 ACPI_TYPE_LOCAL_DATA) && !data) {
0523 data = next;
0524 }
0525
0526 next = next->region.next;
0527 acpi_os_printf("->%p(%s %2.2X)", next,
0528 acpi_ut_get_object_type_name
0529 (next),
0530 next->common.type);
0531
0532 if ((next == start) || (next == data)) {
0533 acpi_os_printf
0534 ("\n**** Error: Region list appears to be circular linked");
0535 break;
0536 }
0537 }
0538 }
0539
0540 acpi_os_printf("\n");
0541 break;
0542
0543 case ACPI_EXD_NODE:
0544
0545 node =
0546 *ACPI_CAST_PTR(struct acpi_namespace_node *,
0547 target);
0548
0549 acpi_os_printf("%20s : %p", name, node);
0550 if (node) {
0551 acpi_os_printf(" [%4.4s]", node->name.ascii);
0552 }
0553 acpi_os_printf("\n");
0554 break;
0555
0556 default:
0557
0558 acpi_os_printf("**** Invalid table opcode [%X] ****\n",
0559 info->opcode);
0560 return;
0561 }
0562
0563 info++;
0564 count--;
0565 }
0566 }
0567
0568
0569
0570
0571
0572
0573
0574
0575
0576
0577
0578
0579
0580
0581 void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
0582 {
0583 u32 length;
0584 u32 index;
0585
0586 ACPI_FUNCTION_NAME(ex_dump_operand);
0587
0588
0589
0590 if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_EXEC, _COMPONENT)) {
0591 return;
0592 }
0593
0594 if (!obj_desc) {
0595
0596
0597
0598 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n"));
0599 return;
0600 }
0601
0602 if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) {
0603 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p Namespace Node: ",
0604 obj_desc));
0605 ACPI_DUMP_ENTRY(obj_desc, ACPI_LV_EXEC);
0606 return;
0607 }
0608
0609 if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) {
0610 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
0611 "%p is not a node or operand object: [%s]\n",
0612 obj_desc,
0613 acpi_ut_get_descriptor_name(obj_desc)));
0614 ACPI_DUMP_BUFFER(obj_desc, sizeof(union acpi_operand_object));
0615 return;
0616 }
0617
0618
0619
0620 if (depth > 0) {
0621 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%*s[%u] %p Refs=%u ",
0622 depth, " ", depth, obj_desc,
0623 obj_desc->common.reference_count));
0624 } else {
0625 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p Refs=%u ",
0626 obj_desc, obj_desc->common.reference_count));
0627 }
0628
0629
0630
0631 switch (obj_desc->common.type) {
0632 case ACPI_TYPE_LOCAL_REFERENCE:
0633
0634 acpi_os_printf("Reference: [%s] ",
0635 acpi_ut_get_reference_name(obj_desc));
0636
0637 switch (obj_desc->reference.class) {
0638 case ACPI_REFCLASS_DEBUG:
0639
0640 acpi_os_printf("\n");
0641 break;
0642
0643 case ACPI_REFCLASS_INDEX:
0644
0645 acpi_os_printf("%p\n", obj_desc->reference.object);
0646 break;
0647
0648 case ACPI_REFCLASS_TABLE:
0649
0650 acpi_os_printf("Table Index %X\n",
0651 obj_desc->reference.value);
0652 break;
0653
0654 case ACPI_REFCLASS_REFOF:
0655
0656 acpi_os_printf("%p [%s]\n", obj_desc->reference.object,
0657 acpi_ut_get_type_name(((union
0658 acpi_operand_object
0659 *)
0660 obj_desc->
0661 reference.
0662 object)->common.
0663 type));
0664 break;
0665
0666 case ACPI_REFCLASS_NAME:
0667
0668 acpi_ut_repair_name(obj_desc->reference.node->name.
0669 ascii);
0670 acpi_os_printf("- [%4.4s] (Node %p)\n",
0671 obj_desc->reference.node->name.ascii,
0672 obj_desc->reference.node);
0673 break;
0674
0675 case ACPI_REFCLASS_ARG:
0676 case ACPI_REFCLASS_LOCAL:
0677
0678 acpi_os_printf("%X\n", obj_desc->reference.value);
0679 break;
0680
0681 default:
0682
0683 acpi_os_printf("%2.2X\n", obj_desc->reference.class);
0684 break;
0685 }
0686 break;
0687
0688 case ACPI_TYPE_BUFFER:
0689
0690 acpi_os_printf("Buffer length %.2X @ %p\n",
0691 obj_desc->buffer.length,
0692 obj_desc->buffer.pointer);
0693
0694
0695
0696 if (obj_desc->buffer.pointer) {
0697 length = obj_desc->buffer.length;
0698 if (length > 128) {
0699 length = 128;
0700 }
0701
0702 acpi_os_printf
0703 ("Buffer Contents: (displaying length 0x%.2X)\n",
0704 length);
0705 ACPI_DUMP_BUFFER(obj_desc->buffer.pointer, length);
0706 }
0707 break;
0708
0709 case ACPI_TYPE_INTEGER:
0710
0711 acpi_os_printf("Integer %8.8X%8.8X\n",
0712 ACPI_FORMAT_UINT64(obj_desc->integer.value));
0713 break;
0714
0715 case ACPI_TYPE_PACKAGE:
0716
0717 acpi_os_printf("Package [Len %X] ElementArray %p\n",
0718 obj_desc->package.count,
0719 obj_desc->package.elements);
0720
0721
0722
0723
0724
0725 if (obj_desc->package.count &&
0726 obj_desc->package.elements && acpi_dbg_level > 1) {
0727 for (index = 0; index < obj_desc->package.count;
0728 index++) {
0729 acpi_ex_dump_operand(obj_desc->package.
0730 elements[index],
0731 depth + 1);
0732 }
0733 }
0734 break;
0735
0736 case ACPI_TYPE_REGION:
0737
0738 acpi_os_printf("Region %s (%X)",
0739 acpi_ut_get_region_name(obj_desc->region.
0740 space_id),
0741 obj_desc->region.space_id);
0742
0743
0744
0745
0746
0747 if (!(obj_desc->region.flags & AOPOBJ_DATA_VALID)) {
0748 acpi_os_printf("\n");
0749 } else {
0750 acpi_os_printf(" base %8.8X%8.8X Length %X\n",
0751 ACPI_FORMAT_UINT64(obj_desc->region.
0752 address),
0753 obj_desc->region.length);
0754 }
0755 break;
0756
0757 case ACPI_TYPE_STRING:
0758
0759 acpi_os_printf("String length %X @ %p ",
0760 obj_desc->string.length,
0761 obj_desc->string.pointer);
0762
0763 acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX);
0764 acpi_os_printf("\n");
0765 break;
0766
0767 case ACPI_TYPE_LOCAL_BANK_FIELD:
0768
0769 acpi_os_printf("BankField\n");
0770 break;
0771
0772 case ACPI_TYPE_LOCAL_REGION_FIELD:
0773
0774 acpi_os_printf
0775 ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at "
0776 "byte=%X bit=%X of below:\n", obj_desc->field.bit_length,
0777 obj_desc->field.access_byte_width,
0778 obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK,
0779 obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK,
0780 obj_desc->field.base_byte_offset,
0781 obj_desc->field.start_field_bit_offset);
0782
0783 acpi_ex_dump_operand(obj_desc->field.region_obj, depth + 1);
0784 break;
0785
0786 case ACPI_TYPE_LOCAL_INDEX_FIELD:
0787
0788 acpi_os_printf("IndexField\n");
0789 break;
0790
0791 case ACPI_TYPE_BUFFER_FIELD:
0792
0793 acpi_os_printf("BufferField: %X bits at byte %X bit %X of\n",
0794 obj_desc->buffer_field.bit_length,
0795 obj_desc->buffer_field.base_byte_offset,
0796 obj_desc->buffer_field.start_field_bit_offset);
0797
0798 if (!obj_desc->buffer_field.buffer_obj) {
0799 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL*\n"));
0800 } else if ((obj_desc->buffer_field.buffer_obj)->common.type !=
0801 ACPI_TYPE_BUFFER) {
0802 acpi_os_printf("*not a Buffer*\n");
0803 } else {
0804 acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj,
0805 depth + 1);
0806 }
0807 break;
0808
0809 case ACPI_TYPE_EVENT:
0810
0811 acpi_os_printf("Event\n");
0812 break;
0813
0814 case ACPI_TYPE_METHOD:
0815
0816 acpi_os_printf("Method(%X) @ %p:%X\n",
0817 obj_desc->method.param_count,
0818 obj_desc->method.aml_start,
0819 obj_desc->method.aml_length);
0820 break;
0821
0822 case ACPI_TYPE_MUTEX:
0823
0824 acpi_os_printf("Mutex\n");
0825 break;
0826
0827 case ACPI_TYPE_DEVICE:
0828
0829 acpi_os_printf("Device\n");
0830 break;
0831
0832 case ACPI_TYPE_POWER:
0833
0834 acpi_os_printf("Power\n");
0835 break;
0836
0837 case ACPI_TYPE_PROCESSOR:
0838
0839 acpi_os_printf("Processor\n");
0840 break;
0841
0842 case ACPI_TYPE_THERMAL:
0843
0844 acpi_os_printf("Thermal\n");
0845 break;
0846
0847 default:
0848
0849
0850
0851 acpi_os_printf("Unknown Type %X\n", obj_desc->common.type);
0852 break;
0853 }
0854
0855 return;
0856 }
0857
0858
0859
0860
0861
0862
0863
0864
0865
0866
0867
0868
0869
0870 void
0871 acpi_ex_dump_operands(union acpi_operand_object **operands,
0872 const char *opcode_name, u32 num_operands)
0873 {
0874 ACPI_FUNCTION_TRACE(ex_dump_operands);
0875
0876 if (!opcode_name) {
0877 opcode_name = "UNKNOWN";
0878 }
0879
0880 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
0881 "**** Start operand dump for opcode [%s], %u operands\n",
0882 opcode_name, num_operands));
0883
0884 if (num_operands == 0) {
0885 num_operands = 1;
0886 }
0887
0888
0889
0890 while (num_operands) {
0891 acpi_ex_dump_operand(*operands, 0);
0892 operands++;
0893 num_operands--;
0894 }
0895
0896 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
0897 "**** End operand dump for [%s]\n", opcode_name));
0898 return_VOID;
0899 }
0900
0901
0902
0903
0904
0905
0906
0907
0908
0909
0910
0911
0912
0913
0914 static void acpi_ex_out_string(const char *title, const char *value)
0915 {
0916 acpi_os_printf("%20s : %s\n", title, value);
0917 }
0918
0919 static void acpi_ex_out_pointer(const char *title, const void *value)
0920 {
0921 acpi_os_printf("%20s : %p\n", title, value);
0922 }
0923
0924
0925
0926
0927
0928
0929
0930
0931
0932
0933
0934
0935 void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags)
0936 {
0937
0938 ACPI_FUNCTION_ENTRY();
0939
0940 if (!flags) {
0941
0942
0943
0944 if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_OBJECTS, _COMPONENT)) {
0945 return;
0946 }
0947 }
0948
0949 acpi_os_printf("%20s : %4.4s\n", "Name", acpi_ut_get_node_name(node));
0950 acpi_os_printf("%20s : %2.2X [%s]\n", "Type",
0951 node->type, acpi_ut_get_type_name(node->type));
0952
0953 acpi_ex_dump_object(ACPI_CAST_PTR(union acpi_operand_object, node),
0954 acpi_ex_dump_node);
0955 }
0956
0957
0958
0959
0960
0961
0962
0963
0964
0965
0966
0967 static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc)
0968 {
0969 struct acpi_buffer ret_buf;
0970 acpi_status status;
0971
0972 ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER;
0973
0974 if (obj_desc->reference.class == ACPI_REFCLASS_NAME) {
0975 acpi_os_printf(" %p ", obj_desc->reference.node);
0976
0977 status = acpi_ns_handle_to_pathname(obj_desc->reference.node,
0978 &ret_buf, TRUE);
0979 if (ACPI_FAILURE(status)) {
0980 acpi_os_printf
0981 (" Could not convert name to pathname: %s\n",
0982 acpi_format_exception(status));
0983 } else {
0984 acpi_os_printf("%s: %s\n",
0985 acpi_ut_get_type_name(obj_desc->
0986 reference.node->
0987 type),
0988 (char *)ret_buf.pointer);
0989 ACPI_FREE(ret_buf.pointer);
0990 }
0991 } else if (obj_desc->reference.object) {
0992 if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
0993 ACPI_DESC_TYPE_OPERAND) {
0994 acpi_os_printf("%22s %p", "Target :",
0995 obj_desc->reference.object);
0996 if (obj_desc->reference.class == ACPI_REFCLASS_TABLE) {
0997 acpi_os_printf(" Table Index: %X\n",
0998 obj_desc->reference.value);
0999 } else {
1000 acpi_os_printf(" [%s]\n",
1001 acpi_ut_get_type_name(((union
1002 acpi_operand_object
1003 *)
1004 obj_desc->
1005 reference.
1006 object)->
1007 common.
1008 type));
1009 }
1010 } else {
1011 acpi_os_printf(" Target: %p\n",
1012 obj_desc->reference.object);
1013 }
1014 }
1015 }
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029 static void
1030 acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,
1031 u32 level, u32 index)
1032 {
1033 u32 i;
1034
1035
1036
1037 if (level > 0) {
1038 for (i = 0; i < level; i++) {
1039 acpi_os_printf(" ");
1040 }
1041
1042 acpi_os_printf("[%.2d] ", index);
1043 }
1044
1045 acpi_os_printf("%p ", obj_desc);
1046
1047
1048
1049 if (!obj_desc) {
1050 acpi_os_printf("[Null Object]\n");
1051 return;
1052 }
1053
1054
1055
1056 switch (obj_desc->common.type) {
1057 case ACPI_TYPE_INTEGER:
1058
1059 acpi_os_printf("[Integer] = %8.8X%8.8X\n",
1060 ACPI_FORMAT_UINT64(obj_desc->integer.value));
1061 break;
1062
1063 case ACPI_TYPE_STRING:
1064
1065 acpi_os_printf("[String] Value: ");
1066 acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX);
1067 acpi_os_printf("\n");
1068 break;
1069
1070 case ACPI_TYPE_BUFFER:
1071
1072 acpi_os_printf("[Buffer] Length %.2X = ",
1073 obj_desc->buffer.length);
1074 if (obj_desc->buffer.length) {
1075 acpi_ut_debug_dump_buffer(ACPI_CAST_PTR
1076 (u8,
1077 obj_desc->buffer.pointer),
1078 obj_desc->buffer.length,
1079 DB_DWORD_DISPLAY, _COMPONENT);
1080 } else {
1081 acpi_os_printf("\n");
1082 }
1083 break;
1084
1085 case ACPI_TYPE_PACKAGE:
1086
1087 acpi_os_printf("[Package] Contains %u Elements:\n",
1088 obj_desc->package.count);
1089
1090 for (i = 0; i < obj_desc->package.count; i++) {
1091 acpi_ex_dump_package_obj(obj_desc->package.elements[i],
1092 level + 1, i);
1093 }
1094 break;
1095
1096 case ACPI_TYPE_LOCAL_REFERENCE:
1097
1098 acpi_os_printf("[Object Reference] Class [%s]",
1099 acpi_ut_get_reference_name(obj_desc));
1100 acpi_ex_dump_reference_obj(obj_desc);
1101 break;
1102
1103 default:
1104
1105 acpi_os_printf("[%s] Type: %2.2X\n",
1106 acpi_ut_get_type_name(obj_desc->common.type),
1107 obj_desc->common.type);
1108 break;
1109 }
1110 }
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123 void
1124 acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags)
1125 {
1126 ACPI_FUNCTION_TRACE(ex_dump_object_descriptor);
1127
1128 if (!obj_desc) {
1129 return_VOID;
1130 }
1131
1132 if (!flags) {
1133
1134
1135
1136 if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_OBJECTS, _COMPONENT)) {
1137 return_VOID;
1138 }
1139 }
1140
1141 if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) {
1142 acpi_ex_dump_namespace_node((struct acpi_namespace_node *)
1143 obj_desc, flags);
1144
1145 obj_desc = ((struct acpi_namespace_node *)obj_desc)->object;
1146 if (!obj_desc) {
1147 return_VOID;
1148 }
1149
1150 acpi_os_printf("\nAttached Object %p", obj_desc);
1151 if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) {
1152 acpi_os_printf(" - Namespace Node");
1153 }
1154
1155 acpi_os_printf(":\n");
1156 goto dump_object;
1157 }
1158
1159 if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) {
1160 acpi_os_printf("%p is not an ACPI operand object: [%s]\n",
1161 obj_desc, acpi_ut_get_descriptor_name(obj_desc));
1162 return_VOID;
1163 }
1164
1165
1166
1167 if (obj_desc->common.type > ACPI_TYPE_LOCAL_MAX) {
1168 acpi_os_printf("Not a known object type: %2.2X\n",
1169 obj_desc->common.type);
1170 return_VOID;
1171 }
1172
1173 dump_object:
1174
1175 if (!obj_desc) {
1176 return_VOID;
1177 }
1178
1179
1180
1181 acpi_ex_dump_object(obj_desc, acpi_ex_dump_common);
1182
1183
1184
1185 acpi_ex_dump_object(obj_desc, acpi_ex_dump_info[obj_desc->common.type]);
1186
1187 if (obj_desc->common.type == ACPI_TYPE_REGION) {
1188 obj_desc = obj_desc->common.next_object;
1189 if (obj_desc->common.type > ACPI_TYPE_LOCAL_MAX) {
1190 acpi_os_printf
1191 ("Secondary object is not a known object type: %2.2X\n",
1192 obj_desc->common.type);
1193
1194 return_VOID;
1195 }
1196
1197 acpi_os_printf("\nExtra attached Object (%p):\n", obj_desc);
1198 acpi_ex_dump_object(obj_desc,
1199 acpi_ex_dump_info[obj_desc->common.type]);
1200 }
1201
1202 return_VOID;
1203 }
1204
1205 #endif