Commit 8850ada6 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

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 20230628 (Bob Moore).

* acpica:
  ACPICA: Update version to 20230628
  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
parents 93f5de5f f3b091a9
......@@ -287,4 +287,6 @@ struct acpi_namespace_node *acpi_db_local_ns_lookup(char *name);
void acpi_db_uint32_to_hex_string(u32 value, char *buffer);
void acpi_db_generate_interrupt(char *gsiv_arg);
#endif /* __ACDEBUG_H__ */
......@@ -129,6 +129,7 @@ ACPI_GLOBAL(acpi_table_handler, acpi_gbl_table_handler);
ACPI_GLOBAL(void *, acpi_gbl_table_handler_context);
ACPI_GLOBAL(acpi_interface_handler, acpi_gbl_interface_handler);
ACPI_GLOBAL(struct acpi_sci_handler_info *, acpi_gbl_sci_handler_list);
ACPI_GLOBAL(struct acpi_ged_handler_info *, acpi_gbl_ged_handler_list);
/* Owner ID support */
......
......@@ -543,6 +543,14 @@ struct acpi_field_info {
u32 pkg_length;
};
/* Information about the interrupt ID and _EVT of a GED device */
struct acpi_ged_handler_info {
struct acpi_ged_handler_info *next;
u32 int_id; /* The interrupt ID that triggers the execution ofthe evt_method. */
struct acpi_namespace_node *evt_method; /* The _EVT method to be executed when an interrupt with ID = int_ID is received */
};
/*****************************************************************************
*
* Generic "state" object for stacks
......@@ -560,25 +568,28 @@ struct acpi_field_info {
u8 descriptor_type; /* To differentiate various internal objs */\
u8 flags; \
u16 value; \
u16 state;
u16 state
/* There are 2 bytes available here until the next natural alignment boundary */
struct acpi_common_state {
ACPI_STATE_COMMON};
ACPI_STATE_COMMON;
};
/*
* Update state - used to traverse complex objects such as packages
*/
struct acpi_update_state {
ACPI_STATE_COMMON union acpi_operand_object *object;
ACPI_STATE_COMMON;
union acpi_operand_object *object;
};
/*
* Pkg state - used to traverse nested package structures
*/
struct acpi_pkg_state {
ACPI_STATE_COMMON u32 index;
ACPI_STATE_COMMON;
u32 index;
union acpi_operand_object *source_object;
union acpi_operand_object *dest_object;
struct acpi_walk_state *walk_state;
......@@ -591,7 +602,8 @@ struct acpi_pkg_state {
* Allows nesting of these constructs
*/
struct acpi_control_state {
ACPI_STATE_COMMON u16 opcode;
ACPI_STATE_COMMON;
u16 opcode;
union acpi_parse_object *predicate_op;
u8 *aml_predicate_start; /* Start of if/while predicate */
u8 *package_end; /* End of if/while block */
......@@ -602,11 +614,13 @@ struct acpi_control_state {
* Scope state - current scope during namespace lookups
*/
struct acpi_scope_state {
ACPI_STATE_COMMON struct acpi_namespace_node *node;
ACPI_STATE_COMMON;
struct acpi_namespace_node *node;
};
struct acpi_pscope_state {
ACPI_STATE_COMMON u32 arg_count; /* Number of fixed arguments */
ACPI_STATE_COMMON;
u32 arg_count; /* Number of fixed arguments */
union acpi_parse_object *op; /* Current op being parsed */
u8 *arg_end; /* Current argument end */
u8 *pkg_end; /* Current package end */
......@@ -618,7 +632,8 @@ struct acpi_pscope_state {
* states are created when there are nested control methods executing.
*/
struct acpi_thread_state {
ACPI_STATE_COMMON u8 current_sync_level; /* Mutex Sync (nested acquire) level */
ACPI_STATE_COMMON;
u8 current_sync_level; /* Mutex Sync (nested acquire) level */
struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */
union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */
acpi_thread_id thread_id; /* Running thread ID */
......@@ -629,8 +644,8 @@ struct acpi_thread_state {
* AML arguments
*/
struct acpi_result_values {
ACPI_STATE_COMMON
union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM];
ACPI_STATE_COMMON;
union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM];
};
typedef
......@@ -652,7 +667,8 @@ struct acpi_global_notify_handler {
* handler/dispatcher.
*/
struct acpi_notify_info {
ACPI_STATE_COMMON u8 handler_list_id;
ACPI_STATE_COMMON;
u8 handler_list_id;
struct acpi_namespace_node *node;
union acpi_operand_object *handler_list_head;
struct acpi_global_notify_handler *global;
......
......@@ -440,6 +440,9 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
{{"_DOS", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
{{"_DSC", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
{{"_DSD", METHOD_0ARGS, /* ACPI 6.0 */
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each: 1 Buf, 1 Pkg */
PACKAGE_INFO(ACPI_PTYPE2_UUID_PAIR, ACPI_RTYPE_BUFFER, 1,
......
......@@ -1010,6 +1010,64 @@ void acpi_db_display_resources(char *object_arg)
acpi_db_set_output_destination(ACPI_DB_CONSOLE_OUTPUT);
}
/*******************************************************************************
*
* FUNCTION: acpi_db_generate_ged
*
* PARAMETERS: ged_arg - Raw GED number, ascii string
*
* RETURN: None
*
* DESCRIPTION: Simulate firing of a GED
*
******************************************************************************/
void acpi_db_generate_interrupt(char *gsiv_arg)
{
u32 gsiv_number;
struct acpi_ged_handler_info *ged_info = acpi_gbl_ged_handler_list;
if (!ged_info) {
acpi_os_printf("No GED handling present\n");
}
gsiv_number = strtoul(gsiv_arg, NULL, 0);
while (ged_info) {
if (ged_info->int_id == gsiv_number) {
struct acpi_object_list arg_list;
union acpi_object arg0;
acpi_handle evt_handle = ged_info->evt_method;
acpi_status status;
acpi_os_printf("Evaluate GED _EVT (GSIV=%d)\n",
gsiv_number);
if (!evt_handle) {
acpi_os_printf("Undefined _EVT method\n");
return;
}
arg0.integer.type = ACPI_TYPE_INTEGER;
arg0.integer.value = gsiv_number;
arg_list.count = 1;
arg_list.pointer = &arg0;
status =
acpi_evaluate_object(evt_handle, NULL, &arg_list,
NULL);
if (ACPI_FAILURE(status)) {
acpi_os_printf("Could not evaluate _EVT\n");
return;
}
}
ged_info = ged_info->next;
}
}
#if (!ACPI_REDUCED_HARDWARE)
/*******************************************************************************
*
......
......@@ -106,6 +106,7 @@ enum acpi_ex_debugger_commands {
CMD_THREADS,
CMD_TEST,
CMD_INTERRUPT,
#endif
};
......@@ -185,6 +186,7 @@ static const struct acpi_db_command_info acpi_gbl_db_commands[] = {
{"THREADS", 3},
{"TEST", 1},
{"INTERRUPT", 1},
#endif
{NULL, 0}
};
......@@ -318,6 +320,7 @@ static const struct acpi_db_command_help acpi_gbl_db_command_help[] = {
{1, " Gpes", "Display info on all GPE devices\n"},
{1, " Sci", "Generate an SCI\n"},
{1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
{1, " Interrupt <GSIV>", "Simulate an interrupt\n"},
#endif
{0, NULL, NULL}
};
......@@ -1064,6 +1067,11 @@ acpi_db_command_dispatch(char *input_buffer,
acpi_os_printf("Event command not implemented\n");
break;
case CMD_INTERRUPT:
acpi_db_generate_interrupt(acpi_gbl_db_args[1]);
break;
case CMD_GPE:
acpi_db_generate_gpe(acpi_gbl_db_args[1], acpi_gbl_db_args[2]);
......
......@@ -146,8 +146,8 @@ acpi_ds_result_push(union acpi_operand_object *object,
if (!object) {
ACPI_ERROR((AE_INFO,
"Null Object! Obj=%p State=%p Num=%u",
object, walk_state, walk_state->result_count));
"Null Object! State=%p Num=%u",
walk_state, walk_state->result_count));
return (AE_BAD_PARAMETER);
}
......
......@@ -343,8 +343,7 @@ acpi_ex_write_serial_bus(union acpi_operand_object *source_desc,
/* Copy the input buffer data to the transfer buffer */
buffer = buffer_desc->buffer.pointer;
data_length = (buffer_length < source_desc->buffer.length ?
buffer_length : source_desc->buffer.length);
data_length = ACPI_MIN(buffer_length, source_desc->buffer.length);
memcpy(buffer, source_desc->buffer.pointer, data_length);
/* Lock entire transaction if requested */
......
......@@ -603,7 +603,7 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = {
/* 7E */ ACPI_OP("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R,
AML_FLAGS_EXEC_0A_0T_1R),
AML_FLAGS_EXEC_0A_0T_1R | AML_NO_OPERAND_RESOLVE),
/* ACPI 5.0 opcodes */
......
......@@ -37,7 +37,12 @@ void acpi_ut_init_stack_ptr_trace(void)
{
acpi_size current_sp;
#pragma GCC diagnostic push
#if defined(__GNUC__) && __GNUC__ >= 12
#pragma GCC diagnostic ignored "-Wdangling-pointer="
#endif
acpi_gbl_entry_stack_pointer = &current_sp;
#pragma GCC diagnostic pop
}
/*******************************************************************************
......
......@@ -22,6 +22,7 @@
#define METHOD_NAME__DDN "_DDN"
#define METHOD_NAME__DIS "_DIS"
#define METHOD_NAME__DMA "_DMA"
#define METHOD_NAME__EVT "_EVT"
#define METHOD_NAME__HID "_HID"
#define METHOD_NAME__INI "_INI"
#define METHOD_NAME__PLD "_PLD"
......
......@@ -12,7 +12,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20230331
#define ACPI_CA_VERSION 0x20230628
#include <acpi/acconfig.h>
#include <acpi/actypes.h>
......
......@@ -402,7 +402,7 @@ struct acpi_cdat_dsmas {
/* Flags for subtable above */
#define ACPI_CEDT_DSMAS_NON_VOLATILE (1 << 2)
#define ACPI_CDAT_DSMAS_NON_VOLATILE (1 << 2)
/* Subtable 1: Device scoped Latency and Bandwidth Information Structure (DSLBIS) */
......
......@@ -893,7 +893,10 @@ enum acpi_madt_type {
ACPI_MADT_TYPE_BIO_PIC = 22,
ACPI_MADT_TYPE_LPC_PIC = 23,
ACPI_MADT_TYPE_RINTC = 24,
ACPI_MADT_TYPE_RESERVED = 25, /* 25 to 0x7F are reserved */
ACPI_MADT_TYPE_IMSIC = 25,
ACPI_MADT_TYPE_APLIC = 26,
ACPI_MADT_TYPE_PLIC = 27,
ACPI_MADT_TYPE_RESERVED = 28, /* 28 to 0x7F are reserved */
ACPI_MADT_TYPE_OEM_RESERVED = 0x80 /* 0x80 to 0xFF are reserved for OEM use */
};
......@@ -1261,6 +1264,9 @@ struct acpi_madt_rintc {
u32 flags;
u64 hart_id;
u32 uid; /* ACPI processor UID */
u32 ext_intc_id; /* External INTC Id */
u64 imsic_addr; /* IMSIC base address */
u32 imsic_size; /* IMSIC size */
};
/* Values for RISC-V INTC Version field above */
......@@ -1271,6 +1277,48 @@ enum acpi_madt_rintc_version {
ACPI_MADT_RINTC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
};
/* 25: RISC-V IMSIC */
struct acpi_madt_imsic {
struct acpi_subtable_header header;
u8 version;
u8 reserved;
u32 flags;
u16 num_ids;
u16 num_guest_ids;
u8 guest_index_bits;
u8 hart_index_bits;
u8 group_index_bits;
u8 group_index_shift;
};
/* 26: RISC-V APLIC */
struct acpi_madt_aplic {
struct acpi_subtable_header header;
u8 version;
u8 id;
u32 flags;
u8 hw_id[8];
u16 num_idcs;
u16 num_sources;
u32 gsi_base;
u64 base_addr;
u32 size;
};
/* 27: RISC-V PLIC */
struct acpi_madt_plic {
struct acpi_subtable_header header;
u8 version;
u8 id;
u8 hw_id[8];
u16 num_irqs;
u16 max_prio;
u32 flags;
u32 size;
u64 base_addr;
u32 gsi_base;
};
/* 80: OEM data */
struct acpi_madt_oem_data {
......@@ -2730,12 +2778,15 @@ enum acpi_rgrt_image_type {
struct acpi_table_rhct {
struct acpi_table_header header; /* Common ACPI table header */
u32 reserved;
u32 flags; /* RHCT flags */
u64 time_base_freq;
u32 node_count;
u32 node_offset;
};
/* RHCT Flags */
#define ACPI_RHCT_TIMER_CANNOT_WAKEUP_CPU (1)
/*
* RHCT subtables
*/
......@@ -2749,6 +2800,9 @@ struct acpi_rhct_node_header {
enum acpi_rhct_node_type {
ACPI_RHCT_NODE_TYPE_ISA_STRING = 0x0000,
ACPI_RHCT_NODE_TYPE_CMO = 0x0001,
ACPI_RHCT_NODE_TYPE_MMU = 0x0002,
ACPI_RHCT_NODE_TYPE_RESERVED = 0x0003,
ACPI_RHCT_NODE_TYPE_HART_INFO = 0xFFFF,
};
......@@ -2762,6 +2816,24 @@ struct acpi_rhct_isa_string {
char isa[];
};
struct acpi_rhct_cmo_node {
u8 reserved; /* Must be zero */
u8 cbom_size; /* CBOM size in powerof 2 */
u8 cbop_size; /* CBOP size in powerof 2 */
u8 cboz_size; /* CBOZ size in powerof 2 */
};
struct acpi_rhct_mmu_node {
u8 reserved; /* Must be zero */
u8 mmu_type; /* Virtual Address Scheme */
};
enum acpi_rhct_mmu_type {
ACPI_RHCT_MMU_TYPE_SV39 = 0,
ACPI_RHCT_MMU_TYPE_SV48 = 1,
ACPI_RHCT_MMU_TYPE_SV57 = 2
};
/* Hart Info node structure */
struct acpi_rhct_hart_info {
u16 num_offsets;
......
......@@ -279,12 +279,14 @@ struct acpi_srat_gic_its_affinity {
* 6: ACPI_SRAT_TYPE_GENERIC_PORT_AFFINITY
*/
#define ACPI_SRAT_DEVICE_HANDLE_SIZE 16
struct acpi_srat_generic_affinity {
struct acpi_subtable_header header;
u8 reserved;
u8 device_handle_type;
u32 proximity_domain;
u8 device_handle[16];
u8 device_handle[ACPI_SRAT_DEVICE_HANDLE_SIZE];
u32 flags;
u32 reserved1;
};
......
......@@ -182,6 +182,7 @@
#ifdef ACPI_USE_STANDARD_HEADERS
#include <stddef.h>
#include <unistd.h>
#include <stdint.h>
#define ACPI_OFFSET(d, f) offsetof(d, f)
#endif
......
......@@ -10,9 +10,6 @@
#ifndef __ACZEPHYR_H__
#define __ACZEPHYR_H__
#define SEEK_SET FS_SEEK_SET
#define SEEK_END FS_SEEK_END
#define ACPI_MACHINE_WIDTH 64
#define ACPI_NO_ERROR_MESSAGES
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment