Skip to content

Commit

Permalink
Merge branch 'acpica'
Browse files Browse the repository at this point in the history
* acpica:
  ACPICA: Update version to 20191018
  ACPICA: debugger: remove leading whitespaces when converting a string to a buffer
  ACPICA: acpiexec: initialize all simple types and field units from user input
  ACPICA: debugger: add field unit support for acpi_db_get_next_token
  ACPICA: debugger: surround field unit output with braces '{'
  ACPICA: debugger: add command to dump all fields of particular subtype
  ACPICA: utilities: add flag to only display data when dumping buffers
  ACPICA: make acpi_load_table() return table index
  ACPICA: Add new external interface, acpi_unload_table()
  ACPICA: More Clang changes
  ACPICA: Win OSL: Replace get_tick_count with get_tick_count64
  ACPICA: Results from Clang
  • Loading branch information
Rafael J. Wysocki committed Nov 26, 2019
2 parents b4447c0 + c7ccf10 commit 713608a
Show file tree
Hide file tree
Showing 31 changed files with 292 additions and 75 deletions.
4 changes: 2 additions & 2 deletions drivers/acpi/acpi_configfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static ssize_t acpi_table_aml_write(struct config_item *cfg,
if (!table->header)
return -ENOMEM;

ret = acpi_load_table(table->header);
ret = acpi_load_table(table->header, &table->index);
if (ret) {
kfree(table->header);
table->header = NULL;
Expand Down Expand Up @@ -223,7 +223,7 @@ static void acpi_table_drop_item(struct config_group *group,
struct acpi_table *table = container_of(cfg, struct acpi_table, cfg);

ACPI_INFO(("Host-directed Dynamic ACPI Table Unload"));
acpi_tb_unload_table(table->index);
acpi_unload_table(table->index);
}

static struct configfs_group_operations acpi_table_group_ops = {
Expand Down
2 changes: 2 additions & 0 deletions drivers/acpi/acpica/acdebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ void acpi_db_find_references(char *object_arg);

void acpi_db_get_bus_info(void);

acpi_status acpi_db_display_fields(u32 address_space_id);

/*
* dbdisply - debug display commands
*/
Expand Down
10 changes: 10 additions & 0 deletions drivers/acpi/acpica/acstruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,16 @@ struct acpi_device_walk_info {
u32 num_INI;
};

/* Info used by Acpi acpi_db_display_fields */

struct acpi_region_walk_info {
u32 debug_level;
u32 count;
acpi_owner_id owner_id;
u8 display_type;
u32 address_space_id;
};

/* TBD: [Restructure] Merge with struct above */

struct acpi_walk_info {
Expand Down
9 changes: 5 additions & 4 deletions drivers/acpi/acpica/acutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,11 @@ struct acpi_pkg_info {

/* acpi_ut_dump_buffer */

#define DB_BYTE_DISPLAY 1
#define DB_WORD_DISPLAY 2
#define DB_DWORD_DISPLAY 4
#define DB_QWORD_DISPLAY 8
#define DB_BYTE_DISPLAY 0x01
#define DB_WORD_DISPLAY 0x02
#define DB_DWORD_DISPLAY 0x04
#define DB_QWORD_DISPLAY 0x08
#define DB_DISPLAY_DATA_ONLY 0x10

/*
* utascii - ASCII utilities
Expand Down
4 changes: 4 additions & 0 deletions drivers/acpi/acpica/dbconvert.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ acpi_db_convert_to_buffer(char *string, union acpi_object *object)
u8 *buffer;
acpi_status status;

/* Skip all preceding white space */

acpi_ut_remove_whitespace(&string);

/* Generate the final buffer length */

for (i = 0, length = 0; string[i];) {
Expand Down
2 changes: 0 additions & 2 deletions drivers/acpi/acpica/dbdisply.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,6 @@ void acpi_db_display_results(void)
return;
}

obj_desc = walk_state->method_desc;
node = walk_state->method_node;

if (walk_state->results) {
Expand Down Expand Up @@ -565,7 +564,6 @@ void acpi_db_display_calling_tree(void)
return;
}

node = walk_state->method_node;
acpi_os_printf("Current Control Method Call Tree\n");

while (walk_state) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/dbfileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ acpi_status acpi_db_load_tables(struct acpi_new_table_desc *list_head)
while (table_list_head) {
table = table_list_head->table;

status = acpi_load_table(table);
status = acpi_load_table(table, NULL);
if (ACPI_FAILURE(status)) {
if (status == AE_ALREADY_EXISTS) {
acpi_os_printf
Expand Down
36 changes: 35 additions & 1 deletion drivers/acpi/acpica/dbinput.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ enum acpi_ex_debugger_commands {
CMD_EVALUATE,
CMD_EXECUTE,
CMD_EXIT,
CMD_FIELDS,
CMD_FIND,
CMD_GO,
CMD_HANDLERS,
Expand Down Expand Up @@ -127,6 +128,7 @@ static const struct acpi_db_command_info acpi_gbl_db_commands[] = {
{"EVALUATE", 1},
{"EXECUTE", 1},
{"EXIT", 0},
{"FIELDS", 1},
{"FIND", 1},
{"GO", 0},
{"HANDLERS", 0},
Expand Down Expand Up @@ -200,6 +202,8 @@ static const struct acpi_db_command_help acpi_gbl_db_command_help[] = {
"Find ACPI name(s) with wildcards\n"},
{1, " Integrity", "Validate namespace integrity\n"},
{1, " Methods", "Display list of loaded control methods\n"},
{1, " Fields <AddressSpaceId>",
"Display list of loaded field units by space ID\n"},
{1, " Namespace [Object] [Depth]",
"Display loaded namespace tree/subtree\n"},
{1, " Notify <Object> <Value>", "Send a notification on Object\n"},
Expand Down Expand Up @@ -507,6 +511,21 @@ char *acpi_db_get_next_token(char *string,
}
break;

case '{':

/* This is the start of a field unit, scan until closing brace */

string++;
start = string;
type = ACPI_TYPE_FIELD_UNIT;

/* Find end of buffer */

while (*string && (*string != '}')) {
string++;
}
break;

case '[':

/* This is the start of a package, scan until closing bracket */
Expand Down Expand Up @@ -674,6 +693,7 @@ acpi_db_command_dispatch(char *input_buffer,
union acpi_parse_object *op)
{
u32 temp;
u64 temp64;
u32 command_index;
u32 param_count;
char *command_line;
Expand All @@ -689,7 +709,6 @@ acpi_db_command_dispatch(char *input_buffer,

param_count = acpi_db_get_line(input_buffer);
command_index = acpi_db_match_command(acpi_gbl_db_args[0]);
temp = 0;

/*
* We don't want to add the !! command to the history buffer. It
Expand Down Expand Up @@ -790,6 +809,21 @@ acpi_db_command_dispatch(char *input_buffer,
status = acpi_db_find_name_in_namespace(acpi_gbl_db_args[1]);
break;

case CMD_FIELDS:

status = acpi_ut_strtoul64(acpi_gbl_db_args[1], &temp64);

if (ACPI_FAILURE(status)
|| temp64 >= ACPI_NUM_PREDEFINED_REGIONS) {
acpi_os_printf
("Invalid adress space ID: must be between 0 and %u inclusive\n",
ACPI_NUM_PREDEFINED_REGIONS - 1);
return (AE_OK);
}

status = acpi_db_display_fields((u32)temp64);
break;

case CMD_GO:

acpi_gbl_cm_single_step = FALSE;
Expand Down
4 changes: 4 additions & 0 deletions drivers/acpi/acpica/dbmethod.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,10 @@ acpi_status acpi_db_disassemble_method(char *name)
walk_state->parse_flags |= ACPI_PARSE_DISASSEMBLE;

status = acpi_ps_parse_aml(walk_state);
if (ACPI_FAILURE(status)) {
return (status);
}

(void)acpi_dm_parse_deferred_ops(op);

/* Now we can disassemble the method */
Expand Down
114 changes: 114 additions & 0 deletions drivers/acpi/acpica/dbnames.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "acnamesp.h"
#include "acdebug.h"
#include "acpredef.h"
#include "acinterp.h"

#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME("dbnames")
Expand Down Expand Up @@ -502,6 +503,86 @@ acpi_db_walk_for_object_counts(acpi_handle obj_handle,
return (AE_OK);
}

/*******************************************************************************
*
* FUNCTION: acpi_db_walk_for_fields
*
* PARAMETERS: Callback from walk_namespace
*
* RETURN: Status
*
* DESCRIPTION: Display short info about objects in the namespace
*
******************************************************************************/

static acpi_status
acpi_db_walk_for_fields(acpi_handle obj_handle,
u32 nesting_level, void *context, void **return_value)
{
union acpi_object *ret_value;
struct acpi_region_walk_info *info =
(struct acpi_region_walk_info *)context;
struct acpi_buffer buffer;
acpi_status status;
struct acpi_namespace_node *node = acpi_ns_validate_handle(obj_handle);

if (!node) {
return (AE_OK);
}
if (node->object->field.region_obj->region.space_id !=
info->address_space_id) {
return (AE_OK);
}

info->count++;

/* Get and display the full pathname to this object */

buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
status = acpi_ns_handle_to_pathname(obj_handle, &buffer, TRUE);
if (ACPI_FAILURE(status)) {
acpi_os_printf("Could Not get pathname for object %p\n",
obj_handle);
return (AE_OK);
}

acpi_os_printf("%s ", (char *)buffer.pointer);
ACPI_FREE(buffer.pointer);

buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
acpi_evaluate_object(obj_handle, NULL, NULL, &buffer);

/*
* Since this is a field unit, surround the output in braces
*/
acpi_os_printf("{");

ret_value = (union acpi_object *)buffer.pointer;
switch (ret_value->type) {
case ACPI_TYPE_INTEGER:

acpi_os_printf("%8.8X%8.8X",
ACPI_FORMAT_UINT64(ret_value->integer.value));
break;

case ACPI_TYPE_BUFFER:

acpi_ut_dump_buffer(ret_value->buffer.pointer,
ret_value->buffer.length,
DB_DISPLAY_DATA_ONLY | DB_BYTE_DISPLAY, 0);
break;

default:

break;
}
acpi_os_printf("}\n");

ACPI_FREE(buffer.pointer);

return (AE_OK);
}

/*******************************************************************************
*
* FUNCTION: acpi_db_walk_for_specific_objects
Expand Down Expand Up @@ -628,6 +709,39 @@ acpi_status acpi_db_display_objects(char *obj_type_arg, char *display_count_arg)
return (AE_OK);
}

/*******************************************************************************
*
* FUNCTION: acpi_db_display_fields
*
* PARAMETERS: obj_type_arg - Type of object to display
* display_count_arg - Max depth to display
*
* RETURN: None
*
* DESCRIPTION: Display objects in the namespace of the requested type
*
******************************************************************************/

acpi_status acpi_db_display_fields(u32 address_space_id)
{
struct acpi_region_walk_info info;

info.count = 0;
info.owner_id = ACPI_OWNER_ID_MAX;
info.debug_level = ACPI_UINT32_MAX;
info.display_type = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
info.address_space_id = address_space_id;

/* Walk the namespace from the root */

(void)acpi_walk_namespace(ACPI_TYPE_LOCAL_REGION_FIELD,
ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
acpi_db_walk_for_fields, NULL, (void *)&info,
NULL);

return (AE_OK);
}

/*******************************************************************************
*
* FUNCTION: acpi_db_integrity_walk
Expand Down
1 change: 0 additions & 1 deletion drivers/acpi/acpica/dbobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,6 @@ void acpi_db_decode_arguments(struct acpi_walk_state *walk_state)
u8 display_args = FALSE;

node = walk_state->method_node;
obj_desc = walk_state->method_desc;

/* There are no arguments for the module-level code case */

Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/dscontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
walk_state->parser_state.pkg_end;
control_state->control.opcode = op->common.aml_opcode;
control_state->control.loop_timeout = acpi_os_get_timer() +
(u64)(acpi_gbl_max_loop_iterations * ACPI_100NSEC_PER_SEC);
((u64)acpi_gbl_max_loop_iterations * ACPI_100NSEC_PER_SEC);

/* Push the control state on this walk's control stack */

Expand Down
12 changes: 3 additions & 9 deletions drivers/acpi/acpica/dsfield.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,

if (walk_state->deferred_node) {
node = walk_state->deferred_node;
status = AE_OK;
} else {
/* Execute flag should always be set when this function is entered */

Expand Down Expand Up @@ -264,7 +263,6 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
union acpi_parse_object *child;

#ifdef ACPI_EXEC_APP
u64 value = 0;
union acpi_operand_object *result_desc;
union acpi_operand_object *obj_desc;
char *name_path;
Expand Down Expand Up @@ -406,19 +404,17 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
name_path =
acpi_ns_get_external_pathname(info->
field_node);
obj_desc =
acpi_ut_create_integer_object
(value);
if (ACPI_SUCCESS
(ae_lookup_init_file_entry
(name_path, &value))) {
(name_path, &obj_desc))) {
acpi_ex_write_data_to_field
(obj_desc,
acpi_ns_get_attached_object
(info->field_node),
&result_desc);
acpi_ut_remove_reference
(obj_desc);
}
acpi_ut_remove_reference(obj_desc);
ACPI_FREE(name_path);
#endif
}
Expand Down Expand Up @@ -636,8 +632,6 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
}

/* Name already exists, just ignore this error */

status = AE_OK;
}

arg->common.node = node;
Expand Down
Loading

0 comments on commit 713608a

Please sign in to comment.