Skip to content

Commit 8850ada

Browse files
committed
Merge branch 'acpica'
Merge ACPICA material for 6.6-rc1. This includes some fixes, cleanups and new material, mostly related to parsing tables. Specifics: - Suppress a GCC 12 dangling-pointer warning (Philip Prindeville). - Reformat the ACPI_STATE_COMMON macro and its users (George Guo). - Replace the ternary operator with ACPI_MIN() (Jiangshan Yi). - Add support for _DSC as per ACPI 6.5 (Saket Dumbre). - Remove a duplicate macro from zephyr header (Najumon B.A). - Add data structures for GED and _EVT tracking (Jose Marinho). - Fix misspelled CDAT DSMAS define (Dave Jiang). - Simplify an error message in acpi_ds_result_push() (Christophe Jaillet). - Add a struct size macro related to SRAT (Dave Jiang). - Add AML_NO_OPERAND_RESOLVE flag to Timer (Abhishek Mainkar). - Add support for RISC-V external interrupt controllers in MADT (Sunil V L). - Add RHCT flags, CMO and MMU nodes (Sunil V L). - Change ACPICA version to 2023062 (Bob Moore). * acpica: ACPICA: Update version to 2023062 ACPICA: RHCT: Add flags, CMO and MMU nodes ACPICA: MADT: Add RISC-V external interrupt controllers ACPICA: Add AML_NO_OPERAND_RESOLVE flag to Timer ACPICA: Add a define for size of struct acpi_srat_generic_affinity device_handle ACPICA: Slightly simplify an error message in acpi_ds_result_push() ACPICA: Fix misspelled CDAT DSMAS define ACPICA: Add interrupt command to acpiexec ACPICA: Detect GED device and keep track of _EVT ACPICA: fix for conflict macro definition on zephyr interface ACPICA: Add support for _DSC as per ACPI 6.5 ACPICA: exserial.c: replace ternary operator with ACPI_MIN() ACPICA: Modify ACPI_STATE_COMMON ACPICA: Fix GCC 12 dangling-pointer warning
2 parents 93f5de5 + f3b091a commit 8850ada

File tree

17 files changed

+189
-24
lines changed

17 files changed

+189
-24
lines changed

drivers/acpi/acpica/acdebug.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,4 +287,6 @@ struct acpi_namespace_node *acpi_db_local_ns_lookup(char *name);
287287

288288
void acpi_db_uint32_to_hex_string(u32 value, char *buffer);
289289

290+
void acpi_db_generate_interrupt(char *gsiv_arg);
291+
290292
#endif /* __ACDEBUG_H__ */

drivers/acpi/acpica/acglobal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ ACPI_GLOBAL(acpi_table_handler, acpi_gbl_table_handler);
129129
ACPI_GLOBAL(void *, acpi_gbl_table_handler_context);
130130
ACPI_GLOBAL(acpi_interface_handler, acpi_gbl_interface_handler);
131131
ACPI_GLOBAL(struct acpi_sci_handler_info *, acpi_gbl_sci_handler_list);
132+
ACPI_GLOBAL(struct acpi_ged_handler_info *, acpi_gbl_ged_handler_list);
132133

133134
/* Owner ID support */
134135

drivers/acpi/acpica/aclocal.h

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,14 @@ struct acpi_field_info {
543543
u32 pkg_length;
544544
};
545545

546+
/* Information about the interrupt ID and _EVT of a GED device */
547+
548+
struct acpi_ged_handler_info {
549+
struct acpi_ged_handler_info *next;
550+
u32 int_id; /* The interrupt ID that triggers the execution ofthe evt_method. */
551+
struct acpi_namespace_node *evt_method; /* The _EVT method to be executed when an interrupt with ID = int_ID is received */
552+
};
553+
546554
/*****************************************************************************
547555
*
548556
* Generic "state" object for stacks
@@ -560,25 +568,28 @@ struct acpi_field_info {
560568
u8 descriptor_type; /* To differentiate various internal objs */\
561569
u8 flags; \
562570
u16 value; \
563-
u16 state;
571+
u16 state
564572

565573
/* There are 2 bytes available here until the next natural alignment boundary */
566574

567575
struct acpi_common_state {
568-
ACPI_STATE_COMMON};
576+
ACPI_STATE_COMMON;
577+
};
569578

570579
/*
571580
* Update state - used to traverse complex objects such as packages
572581
*/
573582
struct acpi_update_state {
574-
ACPI_STATE_COMMON union acpi_operand_object *object;
583+
ACPI_STATE_COMMON;
584+
union acpi_operand_object *object;
575585
};
576586

577587
/*
578588
* Pkg state - used to traverse nested package structures
579589
*/
580590
struct acpi_pkg_state {
581-
ACPI_STATE_COMMON u32 index;
591+
ACPI_STATE_COMMON;
592+
u32 index;
582593
union acpi_operand_object *source_object;
583594
union acpi_operand_object *dest_object;
584595
struct acpi_walk_state *walk_state;
@@ -591,7 +602,8 @@ struct acpi_pkg_state {
591602
* Allows nesting of these constructs
592603
*/
593604
struct acpi_control_state {
594-
ACPI_STATE_COMMON u16 opcode;
605+
ACPI_STATE_COMMON;
606+
u16 opcode;
595607
union acpi_parse_object *predicate_op;
596608
u8 *aml_predicate_start; /* Start of if/while predicate */
597609
u8 *package_end; /* End of if/while block */
@@ -602,11 +614,13 @@ struct acpi_control_state {
602614
* Scope state - current scope during namespace lookups
603615
*/
604616
struct acpi_scope_state {
605-
ACPI_STATE_COMMON struct acpi_namespace_node *node;
617+
ACPI_STATE_COMMON;
618+
struct acpi_namespace_node *node;
606619
};
607620

608621
struct acpi_pscope_state {
609-
ACPI_STATE_COMMON u32 arg_count; /* Number of fixed arguments */
622+
ACPI_STATE_COMMON;
623+
u32 arg_count; /* Number of fixed arguments */
610624
union acpi_parse_object *op; /* Current op being parsed */
611625
u8 *arg_end; /* Current argument end */
612626
u8 *pkg_end; /* Current package end */
@@ -618,7 +632,8 @@ struct acpi_pscope_state {
618632
* states are created when there are nested control methods executing.
619633
*/
620634
struct acpi_thread_state {
621-
ACPI_STATE_COMMON u8 current_sync_level; /* Mutex Sync (nested acquire) level */
635+
ACPI_STATE_COMMON;
636+
u8 current_sync_level; /* Mutex Sync (nested acquire) level */
622637
struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */
623638
union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */
624639
acpi_thread_id thread_id; /* Running thread ID */
@@ -629,8 +644,8 @@ struct acpi_thread_state {
629644
* AML arguments
630645
*/
631646
struct acpi_result_values {
632-
ACPI_STATE_COMMON
633-
union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM];
647+
ACPI_STATE_COMMON;
648+
union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM];
634649
};
635650

636651
typedef
@@ -652,7 +667,8 @@ struct acpi_global_notify_handler {
652667
* handler/dispatcher.
653668
*/
654669
struct acpi_notify_info {
655-
ACPI_STATE_COMMON u8 handler_list_id;
670+
ACPI_STATE_COMMON;
671+
u8 handler_list_id;
656672
struct acpi_namespace_node *node;
657673
union acpi_operand_object *handler_list_head;
658674
struct acpi_global_notify_handler *global;

drivers/acpi/acpica/acpredef.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,9 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
440440
{{"_DOS", METHOD_1ARGS(ACPI_TYPE_INTEGER),
441441
METHOD_NO_RETURN_VALUE}},
442442

443+
{{"_DSC", METHOD_0ARGS,
444+
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
445+
443446
{{"_DSD", METHOD_0ARGS, /* ACPI 6.0 */
444447
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each: 1 Buf, 1 Pkg */
445448
PACKAGE_INFO(ACPI_PTYPE2_UUID_PAIR, ACPI_RTYPE_BUFFER, 1,

drivers/acpi/acpica/dbcmds.c

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,64 @@ void acpi_db_display_resources(char *object_arg)
10101010
acpi_db_set_output_destination(ACPI_DB_CONSOLE_OUTPUT);
10111011
}
10121012

1013+
/*******************************************************************************
1014+
*
1015+
* FUNCTION: acpi_db_generate_ged
1016+
*
1017+
* PARAMETERS: ged_arg - Raw GED number, ascii string
1018+
*
1019+
* RETURN: None
1020+
*
1021+
* DESCRIPTION: Simulate firing of a GED
1022+
*
1023+
******************************************************************************/
1024+
1025+
void acpi_db_generate_interrupt(char *gsiv_arg)
1026+
{
1027+
u32 gsiv_number;
1028+
struct acpi_ged_handler_info *ged_info = acpi_gbl_ged_handler_list;
1029+
1030+
if (!ged_info) {
1031+
acpi_os_printf("No GED handling present\n");
1032+
}
1033+
1034+
gsiv_number = strtoul(gsiv_arg, NULL, 0);
1035+
1036+
while (ged_info) {
1037+
1038+
if (ged_info->int_id == gsiv_number) {
1039+
struct acpi_object_list arg_list;
1040+
union acpi_object arg0;
1041+
acpi_handle evt_handle = ged_info->evt_method;
1042+
acpi_status status;
1043+
1044+
acpi_os_printf("Evaluate GED _EVT (GSIV=%d)\n",
1045+
gsiv_number);
1046+
1047+
if (!evt_handle) {
1048+
acpi_os_printf("Undefined _EVT method\n");
1049+
return;
1050+
}
1051+
1052+
arg0.integer.type = ACPI_TYPE_INTEGER;
1053+
arg0.integer.value = gsiv_number;
1054+
1055+
arg_list.count = 1;
1056+
arg_list.pointer = &arg0;
1057+
1058+
status =
1059+
acpi_evaluate_object(evt_handle, NULL, &arg_list,
1060+
NULL);
1061+
if (ACPI_FAILURE(status)) {
1062+
acpi_os_printf("Could not evaluate _EVT\n");
1063+
return;
1064+
}
1065+
1066+
}
1067+
ged_info = ged_info->next;
1068+
}
1069+
}
1070+
10131071
#if (!ACPI_REDUCED_HARDWARE)
10141072
/*******************************************************************************
10151073
*

drivers/acpi/acpica/dbinput.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ enum acpi_ex_debugger_commands {
106106
CMD_THREADS,
107107

108108
CMD_TEST,
109+
CMD_INTERRUPT,
109110
#endif
110111
};
111112

@@ -185,6 +186,7 @@ static const struct acpi_db_command_info acpi_gbl_db_commands[] = {
185186
{"THREADS", 3},
186187

187188
{"TEST", 1},
189+
{"INTERRUPT", 1},
188190
#endif
189191
{NULL, 0}
190192
};
@@ -318,6 +320,7 @@ static const struct acpi_db_command_help acpi_gbl_db_command_help[] = {
318320
{1, " Gpes", "Display info on all GPE devices\n"},
319321
{1, " Sci", "Generate an SCI\n"},
320322
{1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
323+
{1, " Interrupt <GSIV>", "Simulate an interrupt\n"},
321324
#endif
322325
{0, NULL, NULL}
323326
};
@@ -1064,6 +1067,11 @@ acpi_db_command_dispatch(char *input_buffer,
10641067
acpi_os_printf("Event command not implemented\n");
10651068
break;
10661069

1070+
case CMD_INTERRUPT:
1071+
1072+
acpi_db_generate_interrupt(acpi_gbl_db_args[1]);
1073+
break;
1074+
10671075
case CMD_GPE:
10681076

10691077
acpi_db_generate_gpe(acpi_gbl_db_args[1], acpi_gbl_db_args[2]);

drivers/acpi/acpica/dswstate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ acpi_ds_result_push(union acpi_operand_object *object,
146146

147147
if (!object) {
148148
ACPI_ERROR((AE_INFO,
149-
"Null Object! Obj=%p State=%p Num=%u",
150-
object, walk_state, walk_state->result_count));
149+
"Null Object! State=%p Num=%u",
150+
walk_state, walk_state->result_count));
151151
return (AE_BAD_PARAMETER);
152152
}
153153

drivers/acpi/acpica/exserial.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,7 @@ acpi_ex_write_serial_bus(union acpi_operand_object *source_desc,
343343
/* Copy the input buffer data to the transfer buffer */
344344

345345
buffer = buffer_desc->buffer.pointer;
346-
data_length = (buffer_length < source_desc->buffer.length ?
347-
buffer_length : source_desc->buffer.length);
346+
data_length = ACPI_MIN(buffer_length, source_desc->buffer.length);
348347
memcpy(buffer, source_desc->buffer.pointer, data_length);
349348

350349
/* Lock entire transaction if requested */

drivers/acpi/acpica/psopcode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = {
603603

604604
/* 7E */ ACPI_OP("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY,
605605
AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R,
606-
AML_FLAGS_EXEC_0A_0T_1R),
606+
AML_FLAGS_EXEC_0A_0T_1R | AML_NO_OPERAND_RESOLVE),
607607

608608
/* ACPI 5.0 opcodes */
609609

drivers/acpi/acpica/utdebug.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ void acpi_ut_init_stack_ptr_trace(void)
3737
{
3838
acpi_size current_sp;
3939

40+
#pragma GCC diagnostic push
41+
#if defined(__GNUC__) && __GNUC__ >= 12
42+
#pragma GCC diagnostic ignored "-Wdangling-pointer="
43+
#endif
4044
acpi_gbl_entry_stack_pointer = &current_sp;
45+
#pragma GCC diagnostic pop
4146
}
4247

4348
/*******************************************************************************

0 commit comments

Comments
 (0)