Skip to content

Commit 713608a

Browse files
committed
Merge branch 'acpica'
* 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
2 parents b4447c0 + c7ccf10 commit 713608a

31 files changed

+292
-75
lines changed

drivers/acpi/acpi_configfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static ssize_t acpi_table_aml_write(struct config_item *cfg,
5353
if (!table->header)
5454
return -ENOMEM;
5555

56-
ret = acpi_load_table(table->header);
56+
ret = acpi_load_table(table->header, &table->index);
5757
if (ret) {
5858
kfree(table->header);
5959
table->header = NULL;
@@ -223,7 +223,7 @@ static void acpi_table_drop_item(struct config_group *group,
223223
struct acpi_table *table = container_of(cfg, struct acpi_table, cfg);
224224

225225
ACPI_INFO(("Host-directed Dynamic ACPI Table Unload"));
226-
acpi_tb_unload_table(table->index);
226+
acpi_unload_table(table->index);
227227
}
228228

229229
static struct configfs_group_operations acpi_table_group_ops = {

drivers/acpi/acpica/acdebug.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ void acpi_db_find_references(char *object_arg);
148148

149149
void acpi_db_get_bus_info(void);
150150

151+
acpi_status acpi_db_display_fields(u32 address_space_id);
152+
151153
/*
152154
* dbdisply - debug display commands
153155
*/

drivers/acpi/acpica/acstruct.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,16 @@ struct acpi_device_walk_info {
192192
u32 num_INI;
193193
};
194194

195+
/* Info used by Acpi acpi_db_display_fields */
196+
197+
struct acpi_region_walk_info {
198+
u32 debug_level;
199+
u32 count;
200+
acpi_owner_id owner_id;
201+
u8 display_type;
202+
u32 address_space_id;
203+
};
204+
195205
/* TBD: [Restructure] Merge with struct above */
196206

197207
struct acpi_walk_info {

drivers/acpi/acpica/acutils.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,11 @@ struct acpi_pkg_info {
142142

143143
/* acpi_ut_dump_buffer */
144144

145-
#define DB_BYTE_DISPLAY 1
146-
#define DB_WORD_DISPLAY 2
147-
#define DB_DWORD_DISPLAY 4
148-
#define DB_QWORD_DISPLAY 8
145+
#define DB_BYTE_DISPLAY 0x01
146+
#define DB_WORD_DISPLAY 0x02
147+
#define DB_DWORD_DISPLAY 0x04
148+
#define DB_QWORD_DISPLAY 0x08
149+
#define DB_DISPLAY_DATA_ONLY 0x10
149150

150151
/*
151152
* utascii - ASCII utilities

drivers/acpi/acpica/dbconvert.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ acpi_db_convert_to_buffer(char *string, union acpi_object *object)
106106
u8 *buffer;
107107
acpi_status status;
108108

109+
/* Skip all preceding white space */
110+
111+
acpi_ut_remove_whitespace(&string);
112+
109113
/* Generate the final buffer length */
110114

111115
for (i = 0, length = 0; string[i];) {

drivers/acpi/acpica/dbdisply.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,6 @@ void acpi_db_display_results(void)
513513
return;
514514
}
515515

516-
obj_desc = walk_state->method_desc;
517516
node = walk_state->method_node;
518517

519518
if (walk_state->results) {
@@ -565,7 +564,6 @@ void acpi_db_display_calling_tree(void)
565564
return;
566565
}
567566

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

571569
while (walk_state) {

drivers/acpi/acpica/dbfileio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ acpi_status acpi_db_load_tables(struct acpi_new_table_desc *list_head)
9393
while (table_list_head) {
9494
table = table_list_head->table;
9595

96-
status = acpi_load_table(table);
96+
status = acpi_load_table(table, NULL);
9797
if (ACPI_FAILURE(status)) {
9898
if (status == AE_ALREADY_EXISTS) {
9999
acpi_os_printf

drivers/acpi/acpica/dbinput.c

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ enum acpi_ex_debugger_commands {
5050
CMD_EVALUATE,
5151
CMD_EXECUTE,
5252
CMD_EXIT,
53+
CMD_FIELDS,
5354
CMD_FIND,
5455
CMD_GO,
5556
CMD_HANDLERS,
@@ -127,6 +128,7 @@ static const struct acpi_db_command_info acpi_gbl_db_commands[] = {
127128
{"EVALUATE", 1},
128129
{"EXECUTE", 1},
129130
{"EXIT", 0},
131+
{"FIELDS", 1},
130132
{"FIND", 1},
131133
{"GO", 0},
132134
{"HANDLERS", 0},
@@ -200,6 +202,8 @@ static const struct acpi_db_command_help acpi_gbl_db_command_help[] = {
200202
"Find ACPI name(s) with wildcards\n"},
201203
{1, " Integrity", "Validate namespace integrity\n"},
202204
{1, " Methods", "Display list of loaded control methods\n"},
205+
{1, " Fields <AddressSpaceId>",
206+
"Display list of loaded field units by space ID\n"},
203207
{1, " Namespace [Object] [Depth]",
204208
"Display loaded namespace tree/subtree\n"},
205209
{1, " Notify <Object> <Value>", "Send a notification on Object\n"},
@@ -507,6 +511,21 @@ char *acpi_db_get_next_token(char *string,
507511
}
508512
break;
509513

514+
case '{':
515+
516+
/* This is the start of a field unit, scan until closing brace */
517+
518+
string++;
519+
start = string;
520+
type = ACPI_TYPE_FIELD_UNIT;
521+
522+
/* Find end of buffer */
523+
524+
while (*string && (*string != '}')) {
525+
string++;
526+
}
527+
break;
528+
510529
case '[':
511530

512531
/* This is the start of a package, scan until closing bracket */
@@ -674,6 +693,7 @@ acpi_db_command_dispatch(char *input_buffer,
674693
union acpi_parse_object *op)
675694
{
676695
u32 temp;
696+
u64 temp64;
677697
u32 command_index;
678698
u32 param_count;
679699
char *command_line;
@@ -689,7 +709,6 @@ acpi_db_command_dispatch(char *input_buffer,
689709

690710
param_count = acpi_db_get_line(input_buffer);
691711
command_index = acpi_db_match_command(acpi_gbl_db_args[0]);
692-
temp = 0;
693712

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

812+
case CMD_FIELDS:
813+
814+
status = acpi_ut_strtoul64(acpi_gbl_db_args[1], &temp64);
815+
816+
if (ACPI_FAILURE(status)
817+
|| temp64 >= ACPI_NUM_PREDEFINED_REGIONS) {
818+
acpi_os_printf
819+
("Invalid adress space ID: must be between 0 and %u inclusive\n",
820+
ACPI_NUM_PREDEFINED_REGIONS - 1);
821+
return (AE_OK);
822+
}
823+
824+
status = acpi_db_display_fields((u32)temp64);
825+
break;
826+
793827
case CMD_GO:
794828

795829
acpi_gbl_cm_single_step = FALSE;

drivers/acpi/acpica/dbmethod.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@ acpi_status acpi_db_disassemble_method(char *name)
321321
walk_state->parse_flags |= ACPI_PARSE_DISASSEMBLE;
322322

323323
status = acpi_ps_parse_aml(walk_state);
324+
if (ACPI_FAILURE(status)) {
325+
return (status);
326+
}
327+
324328
(void)acpi_dm_parse_deferred_ops(op);
325329

326330
/* Now we can disassemble the method */

drivers/acpi/acpica/dbnames.c

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "acnamesp.h"
1111
#include "acdebug.h"
1212
#include "acpredef.h"
13+
#include "acinterp.h"
1314

1415
#define _COMPONENT ACPI_CA_DEBUGGER
1516
ACPI_MODULE_NAME("dbnames")
@@ -502,6 +503,86 @@ acpi_db_walk_for_object_counts(acpi_handle obj_handle,
502503
return (AE_OK);
503504
}
504505

506+
/*******************************************************************************
507+
*
508+
* FUNCTION: acpi_db_walk_for_fields
509+
*
510+
* PARAMETERS: Callback from walk_namespace
511+
*
512+
* RETURN: Status
513+
*
514+
* DESCRIPTION: Display short info about objects in the namespace
515+
*
516+
******************************************************************************/
517+
518+
static acpi_status
519+
acpi_db_walk_for_fields(acpi_handle obj_handle,
520+
u32 nesting_level, void *context, void **return_value)
521+
{
522+
union acpi_object *ret_value;
523+
struct acpi_region_walk_info *info =
524+
(struct acpi_region_walk_info *)context;
525+
struct acpi_buffer buffer;
526+
acpi_status status;
527+
struct acpi_namespace_node *node = acpi_ns_validate_handle(obj_handle);
528+
529+
if (!node) {
530+
return (AE_OK);
531+
}
532+
if (node->object->field.region_obj->region.space_id !=
533+
info->address_space_id) {
534+
return (AE_OK);
535+
}
536+
537+
info->count++;
538+
539+
/* Get and display the full pathname to this object */
540+
541+
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
542+
status = acpi_ns_handle_to_pathname(obj_handle, &buffer, TRUE);
543+
if (ACPI_FAILURE(status)) {
544+
acpi_os_printf("Could Not get pathname for object %p\n",
545+
obj_handle);
546+
return (AE_OK);
547+
}
548+
549+
acpi_os_printf("%s ", (char *)buffer.pointer);
550+
ACPI_FREE(buffer.pointer);
551+
552+
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
553+
acpi_evaluate_object(obj_handle, NULL, NULL, &buffer);
554+
555+
/*
556+
* Since this is a field unit, surround the output in braces
557+
*/
558+
acpi_os_printf("{");
559+
560+
ret_value = (union acpi_object *)buffer.pointer;
561+
switch (ret_value->type) {
562+
case ACPI_TYPE_INTEGER:
563+
564+
acpi_os_printf("%8.8X%8.8X",
565+
ACPI_FORMAT_UINT64(ret_value->integer.value));
566+
break;
567+
568+
case ACPI_TYPE_BUFFER:
569+
570+
acpi_ut_dump_buffer(ret_value->buffer.pointer,
571+
ret_value->buffer.length,
572+
DB_DISPLAY_DATA_ONLY | DB_BYTE_DISPLAY, 0);
573+
break;
574+
575+
default:
576+
577+
break;
578+
}
579+
acpi_os_printf("}\n");
580+
581+
ACPI_FREE(buffer.pointer);
582+
583+
return (AE_OK);
584+
}
585+
505586
/*******************************************************************************
506587
*
507588
* FUNCTION: acpi_db_walk_for_specific_objects
@@ -628,6 +709,39 @@ acpi_status acpi_db_display_objects(char *obj_type_arg, char *display_count_arg)
628709
return (AE_OK);
629710
}
630711

712+
/*******************************************************************************
713+
*
714+
* FUNCTION: acpi_db_display_fields
715+
*
716+
* PARAMETERS: obj_type_arg - Type of object to display
717+
* display_count_arg - Max depth to display
718+
*
719+
* RETURN: None
720+
*
721+
* DESCRIPTION: Display objects in the namespace of the requested type
722+
*
723+
******************************************************************************/
724+
725+
acpi_status acpi_db_display_fields(u32 address_space_id)
726+
{
727+
struct acpi_region_walk_info info;
728+
729+
info.count = 0;
730+
info.owner_id = ACPI_OWNER_ID_MAX;
731+
info.debug_level = ACPI_UINT32_MAX;
732+
info.display_type = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
733+
info.address_space_id = address_space_id;
734+
735+
/* Walk the namespace from the root */
736+
737+
(void)acpi_walk_namespace(ACPI_TYPE_LOCAL_REGION_FIELD,
738+
ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
739+
acpi_db_walk_for_fields, NULL, (void *)&info,
740+
NULL);
741+
742+
return (AE_OK);
743+
}
744+
631745
/*******************************************************************************
632746
*
633747
* FUNCTION: acpi_db_integrity_walk

0 commit comments

Comments
 (0)