/******************************************************************************* * * FUNCTION: acpi_ex_do_debug_object * * PARAMETERS: source_desc - Object to be output to "Debug Object" * level - Indentation level (used for packages) * index - Current package element, zero if not pkg * * RETURN: None * * DESCRIPTION: Handles stores to the AML Debug Object. For example: * Store(INT1, Debug) * * This function is not compiled if ACPI_NO_ERROR_MESSAGES is set. * * This function is only enabled if acpi_gbl_enable_aml_debug_object is set, or * if ACPI_LV_DEBUG_OBJECT is set in the acpi_dbg_level. Thus, in the normal * operational case, stores to the debug object are ignored but can be easily * enabled if necessary. * ******************************************************************************/ void acpi_ex_do_debug_object(union acpi_operand_object *source_desc, u32 level, u32 index) { u32 i; u32 timer; union acpi_operand_object *object_desc; u32 value; ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc); /* Output must be enabled via the debug_object global or the dbg_level */ if (!acpi_gbl_enable_aml_debug_object && !(acpi_dbg_level & ACPI_LV_DEBUG_OBJECT)) { return_VOID; } /* * We will emit the current timer value (in microseconds) with each * debug output. Only need the lower 26 bits. This allows for 67 * million microseconds or 67 seconds before rollover. */ timer = ((u32)acpi_os_get_timer() / 10); /* (100 nanoseconds to microseconds) */ timer &= 0x03FFFFFF; /* * Print line header as long as we are not in the middle of an * object display */ if (!((level > 0) && index == 0)) { acpi_os_printf("[ACPI Debug %.8u] %*s", timer, level, " "); } /* Display the index for package output only */ if (index > 0) { acpi_os_printf("(%.2u) ", index - 1); } if (!source_desc) { acpi_os_printf("[Null Object]\n"); return_VOID; } if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) { acpi_os_printf("%s ", acpi_ut_get_object_type_name(source_desc)); if (!acpi_ut_valid_internal_object(source_desc)) { acpi_os_printf("%p, Invalid Internal Object!\n", source_desc); return_VOID; } } else if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_NAMED) { acpi_os_printf("%s: %p\n", acpi_ut_get_type_name(((struct acpi_namespace_node *) source_desc)->type), source_desc); return_VOID; } else { return_VOID; } /* source_desc is of type ACPI_DESC_TYPE_OPERAND */ switch (source_desc->common.type) { case ACPI_TYPE_INTEGER: /* Output correct integer width */ if (acpi_gbl_integer_byte_width == 4) { acpi_os_printf("0x%8.8X\n", (u32)source_desc->integer.value); } else { acpi_os_printf("0x%8.8X%8.8X\n", ACPI_FORMAT_UINT64(source_desc->integer. value)); } break; case ACPI_TYPE_BUFFER: acpi_os_printf("[0x%.2X]\n", (u32)source_desc->buffer.length); acpi_ut_dump_buffer(source_desc->buffer.pointer, (source_desc->buffer.length < 256) ? source_desc->buffer.length : 256, DB_BYTE_DISPLAY, 0); break; case ACPI_TYPE_STRING: acpi_os_printf("[0x%.2X] \"%s\"\n", source_desc->string.length, source_desc->string.pointer); break; case ACPI_TYPE_PACKAGE: acpi_os_printf("[Contains 0x%.2X Elements]\n", source_desc->package.count); /* Output the entire contents of the package */ for (i = 0; i < source_desc->package.count; i++) { acpi_ex_do_debug_object(source_desc->package. elements[i], level + 4, i + 1); } break; case ACPI_TYPE_LOCAL_REFERENCE: acpi_os_printf("[%s] ", acpi_ut_get_reference_name(source_desc)); /* Decode the reference */ switch (source_desc->reference.class) { case ACPI_REFCLASS_INDEX: acpi_os_printf("0x%X\n", source_desc->reference.value); break; case ACPI_REFCLASS_TABLE: /* Case for ddb_handle */ acpi_os_printf("Table Index 0x%X\n", source_desc->reference.value); return_VOID; default: break; } acpi_os_printf(" "); /* Check for valid node first, then valid object */ if (source_desc->reference.node) { if (ACPI_GET_DESCRIPTOR_TYPE (source_desc->reference.node) != ACPI_DESC_TYPE_NAMED) { acpi_os_printf (" %p - Not a valid namespace node\n", source_desc->reference.node); } else { acpi_os_printf("Node %p [%4.4s] ", source_desc->reference.node, (source_desc->reference.node)-> name.ascii); switch ((source_desc->reference.node)->type) { /* These types have no attached object */ case ACPI_TYPE_DEVICE: acpi_os_printf("Device\n"); break; case ACPI_TYPE_THERMAL: acpi_os_printf("Thermal Zone\n"); break; default: acpi_ex_do_debug_object((source_desc-> reference. node)->object, level + 4, 0); break; } } } else if (source_desc->reference.object) { if (ACPI_GET_DESCRIPTOR_TYPE (source_desc->reference.object) == ACPI_DESC_TYPE_NAMED) { acpi_ex_do_debug_object(((struct acpi_namespace_node *) source_desc->reference. object)->object, level + 4, 0); } else { object_desc = source_desc->reference.object; value = source_desc->reference.value; switch (object_desc->common.type) { case ACPI_TYPE_BUFFER: acpi_os_printf("Buffer[%u] = 0x%2.2X\n", value, *source_desc->reference. index_pointer); break; case ACPI_TYPE_STRING: acpi_os_printf ("String[%u] = \"%c\" (0x%2.2X)\n", value, *source_desc->reference. index_pointer, *source_desc->reference. index_pointer); break; case ACPI_TYPE_PACKAGE: acpi_os_printf("Package[%u] = ", value); acpi_ex_do_debug_object(*source_desc-> reference.where, level + 4, 0); break; default: acpi_os_printf ("Unknown Reference object type %X\n", object_desc->common.type); break; } } } break; default: acpi_os_printf("%p\n", source_desc); break; } ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "\n")); return_VOID; }
static void acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, u32 level, u32 index) { u32 i; /* Indentation and index output */ if (level > 0) { for (i = 0; i < level; i++) { acpi_os_printf(" "); } acpi_os_printf("[%.2d] ", index); } acpi_os_printf("%p ", obj_desc); /* Null package elements are allowed */ if (!obj_desc) { acpi_os_printf("[Null Object]\n"); return; } /* Packages may only contain a few object types */ switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_INTEGER: acpi_os_printf("[Integer] = %8.8X%8.8X\n", ACPI_FORMAT_UINT64(obj_desc->integer.value)); break; case ACPI_TYPE_STRING: acpi_os_printf("[String] Value: "); for (i = 0; i < obj_desc->string.length; i++) { acpi_os_printf("%c", obj_desc->string.pointer[i]); } acpi_os_printf("\n"); break; case ACPI_TYPE_BUFFER: acpi_os_printf("[Buffer] Length %.2X = ", obj_desc->buffer.length); if (obj_desc->buffer.length) { acpi_ut_dump_buffer(ACPI_CAST_PTR (u8, obj_desc->buffer.pointer), obj_desc->buffer.length, DB_DWORD_DISPLAY, _COMPONENT); } else { acpi_os_printf("\n"); } break; case ACPI_TYPE_PACKAGE: acpi_os_printf("[Package] Contains %d Elements:\n", obj_desc->package.count); for (i = 0; i < obj_desc->package.count; i++) { acpi_ex_dump_package_obj(obj_desc->package.elements[i], level + 1, i); } break; case ACPI_TYPE_LOCAL_REFERENCE: acpi_os_printf("[Object Reference] "); acpi_ex_dump_reference_obj(obj_desc); break; default: acpi_os_printf("[Unknown Type] %X\n", ACPI_GET_OBJECT_TYPE(obj_desc)); break; } }
static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state) { ACPI_FUNCTION_TRACE_PTR(ps_get_aml_opcode, walk_state); walk_state->aml_offset = (u32)ACPI_PTR_DIFF(walk_state->parser_state.aml, walk_state->parser_state.aml_start); walk_state->opcode = acpi_ps_peek_opcode(&(walk_state->parser_state)); /* * First cut to determine what we have found: * 1) A valid AML opcode * 2) A name string * 3) An unknown/invalid opcode */ walk_state->op_info = acpi_ps_get_opcode_info(walk_state->opcode); switch (walk_state->op_info->class) { case AML_CLASS_ASCII: case AML_CLASS_PREFIX: /* * Starts with a valid prefix or ASCII char, this is a name * string. Convert the bare name string to a namepath. */ walk_state->opcode = AML_INT_NAMEPATH_OP; walk_state->arg_types = ARGP_NAMESTRING; break; case AML_CLASS_UNKNOWN: /* The opcode is unrecognized. Complain and skip unknown opcodes */ if (walk_state->pass_number == 2) { ACPI_ERROR((AE_INFO, "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring", walk_state->opcode, (u32)(walk_state->aml_offset + sizeof(struct acpi_table_header)))); ACPI_DUMP_BUFFER((walk_state->parser_state.aml - 16), 48); #ifdef ACPI_ASL_COMPILER /* * This is executed for the disassembler only. Output goes * to the disassembled ASL output file. */ acpi_os_printf ("/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n", walk_state->opcode, (u32)(walk_state->aml_offset + sizeof(struct acpi_table_header))); /* Dump the context surrounding the invalid opcode */ acpi_ut_dump_buffer(((u8 *)walk_state->parser_state. aml - 16), 48, DB_BYTE_DISPLAY, (walk_state->aml_offset + sizeof(struct acpi_table_header) - 16)); acpi_os_printf(" */\n"); #endif } /* Increment past one-byte or two-byte opcode */ walk_state->parser_state.aml++; if (walk_state->opcode > 0xFF) { /* Can only happen if first byte is 0x5B */ walk_state->parser_state.aml++; } return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE); default: /* Found opcode info, this is a normal opcode */ walk_state->parser_state.aml += acpi_ps_get_opcode_size(walk_state->opcode); walk_state->arg_types = walk_state->op_info->parse_args; break; } return_ACPI_STATUS(AE_OK); }
void acpi_db_dump_pld_buffer(union acpi_object *obj_desc) { union acpi_object *buffer_desc; struct acpi_pld_info *pld_info; u8 *new_buffer; acpi_status status; /* Object must be of type Package with at least one Buffer element */ if (obj_desc->type != ACPI_TYPE_PACKAGE) { return; } buffer_desc = &obj_desc->package.elements[0]; if (buffer_desc->type != ACPI_TYPE_BUFFER) { return; } /* Convert _PLD buffer to local _PLD struct */ status = acpi_decode_pld_buffer(buffer_desc->buffer.pointer, buffer_desc->buffer.length, &pld_info); if (ACPI_FAILURE(status)) { return; } /* Encode local _PLD struct back to a _PLD buffer */ new_buffer = acpi_db_encode_pld_buffer(pld_info); if (!new_buffer) { goto exit; } /* The two bit-packed buffers should match */ if (memcmp(new_buffer, buffer_desc->buffer.pointer, buffer_desc->buffer.length)) { acpi_os_printf ("Converted _PLD buffer does not compare. New:\n"); acpi_ut_dump_buffer(new_buffer, buffer_desc->buffer.length, DB_BYTE_DISPLAY, 0); } /* First 32-bit dword */ acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Revision", pld_info->revision); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_IgnoreColor", pld_info->ignore_color); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Red", pld_info->red); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Green", pld_info->green); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Blue", pld_info->blue); /* Second 32-bit dword */ acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Width", pld_info->width); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Height", pld_info->height); /* Third 32-bit dword */ acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_UserVisible", pld_info->user_visible); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Dock", pld_info->dock); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Lid", pld_info->lid); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Panel", pld_info->panel); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_VerticalPosition", pld_info->vertical_position); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_HorizontalPosition", pld_info->horizontal_position); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Shape", pld_info->shape); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_GroupOrientation", pld_info->group_orientation); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_GroupToken", pld_info->group_token); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_GroupPosition", pld_info->group_position); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Bay", pld_info->bay); /* Fourth 32-bit dword */ acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Ejectable", pld_info->ejectable); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_EjectRequired", pld_info->ospm_eject_required); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_CabinetNumber", pld_info->cabinet_number); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_CardCageNumber", pld_info->card_cage_number); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Reference", pld_info->reference); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Rotation", pld_info->rotation); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Order", pld_info->order); /* Fifth 32-bit dword */ if (buffer_desc->buffer.length > 16) { acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_VerticalOffset", pld_info->vertical_offset); acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_HorizontalOffset", pld_info->horizontal_offset); } ACPI_FREE(new_buffer); exit: ACPI_FREE(pld_info); }