diff options
| author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2023-04-24 17:31:41 +0200 | 
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2023-04-24 17:31:41 +0200 | 
| commit | c90b29cede952452f76477296cef3ef411727dd3 (patch) | |
| tree | 3208451a51dc442148cbe43b03f1a6e2252e784c /include/acpi | |
| parent | 03c57b0160f621e1b2a05f9d4b7832ccfb10c391 (diff) | |
| parent | df2286655ce126ed6f54a76e1cb66d53cd185242 (diff) | |
Merge branch 'acpica'
Merge ACPICA material for 6.4-rc1:
 - Delete bogus node_array array of pointers from AEST table (Jessica
   Clarke).
 - Add support for trace buffer extension in GICC to the ACPI MADT
   parser (Xiongfeng Wang).
 - Add missing macro ACPI_FUNCTION_TRACE() for acpi_ns_repair_HID()
   (Xiongfeng Wang).
 - Add missing tables to astable (Pedro Falcato).
 - Add support for 64 bit loong_arch compilation to ACPICA (Huacai
   Chen).
 - Add support for ASPT table in disassembler to ACPICA (Jeremi
   Piotrowski).
 - Add support for Arm's MPAM ACPI table version 2 (Hesham Almatary).
 - Update all copyrights/signons in ACPICA to 2023 (Bob Moore).
 - Add support for ClockInput resource (v6.5) (Niyas Sait).
 - Add RISC-V INTC interrupt controller definition to the list of
   supported interrupt controllers for MADT (Sunil V L).
 - Add structure definitions for the RISC-V RHCT ACPI table (Sunil V L).
 - Address several cases in which the ACPICA code might lead to
   undefined behavior (Tamir Duberstein).
 - Make ACPICA code support flexible arrays properly (Kees Cook).
 - Check null return of ACPI_ALLOCATE_ZEROED in
   acpi_db_display_objects() (void0red).
 - Add os specific support for Zephyr RTOS to ACPICA (Najumon).
 - Update version to 20230331 (Bob Moore).
* acpica: (32 commits)
  ACPICA: Update version to 20230331
  ACPICA: add os specific support for Zephyr RTOS
  ACPICA: ACPICA: check null return of ACPI_ALLOCATE_ZEROED in acpi_db_display_objects
  ACPICA: acpi_resource_irq: Replace 1-element arrays with flexible array
  ACPICA: acpi_madt_oem_data: Fix flexible array member definition
  ACPICA: acpi_dmar_andd: Replace 1-element array with flexible array
  ACPICA: acpi_pci_routing_table: Replace fixed-size array with flex array member
  ACPICA: struct acpi_resource_dma: Replace 1-element array with flexible array
  ACPICA: Introduce ACPI_FLEX_ARRAY
  ACPICA: struct acpi_nfit_interleave: Replace 1-element array with flexible array
  ACPICA: actbl2: Replace 1-element arrays with flexible arrays
  ACPICA: actbl1: Replace 1-element arrays with flexible arrays
  ACPICA: struct acpi_resource_vendor: Replace 1-element array with flexible array
  ACPICA: Avoid undefined behavior: load of misaligned address
  ACPICA: Avoid undefined behavior: member access within misaligned address
  ACPICA: Avoid undefined behavior: member access within misaligned address
  ACPICA: Avoid undefined behavior: member access within misaligned address
  ACPICA: Avoid undefined behavior: member access within misaligned address
  ACPICA: Avoid undefined behavior: member access within null pointer
  ACPICA: Avoid undefined behavior: applying zero offset to null pointer
  ...
Diffstat (limited to 'include/acpi')
| -rw-r--r-- | include/acpi/acbuffer.h | 2 | ||||
| -rw-r--r-- | include/acpi/acconfig.h | 2 | ||||
| -rw-r--r-- | include/acpi/acexcep.h | 2 | ||||
| -rw-r--r-- | include/acpi/acnames.h | 2 | ||||
| -rw-r--r-- | include/acpi/acoutput.h | 2 | ||||
| -rw-r--r-- | include/acpi/acpi.h | 2 | ||||
| -rw-r--r-- | include/acpi/acpiosxf.h | 2 | ||||
| -rw-r--r-- | include/acpi/acpixf.h | 4 | ||||
| -rw-r--r-- | include/acpi/acrestyp.h | 39 | ||||
| -rw-r--r-- | include/acpi/actbl.h | 2 | ||||
| -rw-r--r-- | include/acpi/actbl1.h | 59 | ||||
| -rw-r--r-- | include/acpi/actbl2.h | 211 | ||||
| -rw-r--r-- | include/acpi/actbl3.h | 2 | ||||
| -rw-r--r-- | include/acpi/actypes.h | 8 | ||||
| -rw-r--r-- | include/acpi/acuuid.h | 2 | ||||
| -rw-r--r-- | include/acpi/platform/acenv.h | 4 | ||||
| -rw-r--r-- | include/acpi/platform/acenvex.h | 2 | ||||
| -rw-r--r-- | include/acpi/platform/acgcc.h | 13 | ||||
| -rw-r--r-- | include/acpi/platform/acgccex.h | 2 | ||||
| -rw-r--r-- | include/acpi/platform/aclinux.h | 7 | ||||
| -rw-r--r-- | include/acpi/platform/aclinuxex.h | 2 | ||||
| -rw-r--r-- | include/acpi/platform/aczephyr.h | 48 | 
22 files changed, 371 insertions, 48 deletions
| diff --git a/include/acpi/acbuffer.h b/include/acpi/acbuffer.h index 8cbfcbca7b7e..252b235dce5a 100644 --- a/include/acpi/acbuffer.h +++ b/include/acpi/acbuffer.h @@ -3,7 +3,7 @@   *   * Name: acbuffer.h - Support for buffers returned by ACPI predefined names   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 151e40385673..d768d9c568cf 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h @@ -3,7 +3,7 @@   *   * Name: acconfig.h - Global configuration constants   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index 28943c900be7..c5ecd0a0170c 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h @@ -3,7 +3,7 @@   *   * Name: acexcep.h - Exception codes returned by the ACPI subsystem   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h index 6f22e92b1744..d71291f25a80 100644 --- a/include/acpi/acnames.h +++ b/include/acpi/acnames.h @@ -3,7 +3,7 @@   *   * Name: acnames.h - Global names and strings   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index 73781aae2119..b1571dd96310 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h @@ -3,7 +3,7 @@   *   * Name: acoutput.h -- debug output   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h index 416e59bcf149..8b4a497c1300 100644 --- a/include/acpi/acpi.h +++ b/include/acpi/acpi.h @@ -3,7 +3,7 @@   *   * Name: acpi.h - Master public include file used to interface to ACPICA   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 52844cc5eeb5..914c029f64c9 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -5,7 +5,7 @@   *                    interfaces must be implemented by OSL to interface the   *                    ACPI components to the host operating system.   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 8e364cbdd14a..e6098a08c914 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -3,7 +3,7 @@   *   * Name: acpixf.h - External interfaces to the ACPI subsystem   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ @@ -12,7 +12,7 @@  /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION                 0x20221020 +#define ACPI_CA_VERSION                 0x20230331  #include <acpi/acconfig.h>  #include <acpi/actypes.h> diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h index a7fb8ddb3dc6..efef208b0324 100644 --- a/include/acpi/acrestyp.h +++ b/include/acpi/acrestyp.h @@ -3,7 +3,7 @@   *   * Name: acrestyp.h - Defines, types, and structures for resource descriptors   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ @@ -142,7 +142,10 @@ struct acpi_resource_irq {  	u8 shareable;  	u8 wake_capable;  	u8 interrupt_count; -	u8 interrupts[1]; +	union { +		u8 interrupt; +		 ACPI_FLEX_ARRAY(u8, interrupts); +	};  };  struct acpi_resource_dma { @@ -150,7 +153,10 @@ struct acpi_resource_dma {  	u8 bus_master;  	u8 transfer;  	u8 channel_count; -	u8 channels[1]; +	union { +		u8 channel; +		 ACPI_FLEX_ARRAY(u8, channels); +	};  };  struct acpi_resource_start_dependent { @@ -194,7 +200,7 @@ struct acpi_resource_fixed_dma {  struct acpi_resource_vendor {  	u16 byte_length; -	u8 byte_data[1]; +	u8 byte_data[];  };  /* Vendor resource with UUID info (introduced in ACPI 3.0) */ @@ -203,7 +209,7 @@ struct acpi_resource_vendor_typed {  	u16 byte_length;  	u8 uuid_subtype;  	u8 uuid[ACPI_UUID_LENGTH]; -	u8 byte_data[1]; +	u8 byte_data[];  };  struct acpi_resource_end_tag { @@ -332,7 +338,10 @@ struct acpi_resource_extended_irq {  	u8 wake_capable;  	u8 interrupt_count;  	struct acpi_resource_source resource_source; -	u32 interrupts[1]; +	union { +		u32 interrupt; +		 ACPI_FLEX_ARRAY(u32, interrupts); +	};  };  struct acpi_resource_generic_register { @@ -536,6 +545,15 @@ struct acpi_resource_pin_config {  	u8 *vendor_data;  }; +struct acpi_resource_clock_input { +	u8 revision_id; +	u8 mode; +	u8 scale; +	u16 frequency_divisor; +	u32 frequency_numerator; +	struct acpi_resource_source resource_source; +}; +  /* Values for pin_config_type field above */  #define ACPI_PIN_CONFIG_DEFAULT                 0 @@ -613,7 +631,8 @@ struct acpi_resource_pin_group_config {  #define ACPI_RESOURCE_TYPE_PIN_GROUP            22	/* ACPI 6.2 */  #define ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION   23	/* ACPI 6.2 */  #define ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG     24	/* ACPI 6.2 */ -#define ACPI_RESOURCE_TYPE_MAX                  24 +#define ACPI_RESOURCE_TYPE_CLOCK_INPUT          25	/* ACPI 6.5 */ +#define ACPI_RESOURCE_TYPE_MAX                  25  /* Master union for resource descriptors */ @@ -647,6 +666,7 @@ union acpi_resource_data {  	struct acpi_resource_pin_group pin_group;  	struct acpi_resource_pin_group_function pin_group_function;  	struct acpi_resource_pin_group_config pin_group_config; +	struct acpi_resource_clock_input clock_input;  	/* Common fields */ @@ -679,7 +699,10 @@ struct acpi_pci_routing_table {  	u32 pin;  	u64 address;		/* here for 64-bit alignment */  	u32 source_index; -	char source[4];		/* pad to 64 bits so sizeof() works in all cases */ +	union { +		char pad[4];	/* pad to 64 bits so sizeof() works in all cases */ +		 ACPI_FLEX_ARRAY(char, source); +	};  };  #endif				/* __ACRESTYP_H__ */ diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index c6af579f74f4..e5dfb6f4de52 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h @@ -3,7 +3,7 @@   *   * Name: actbl.h - Basic ACPI Table Definitions   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index 81b9e794424d..58b0490a2ad1 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h @@ -3,7 +3,7 @@   *   * Name: actbl1.h - Additional ACPI table definitions   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ @@ -26,6 +26,7 @@   */  #define ACPI_SIG_AEST           "AEST"	/* Arm Error Source Table */  #define ACPI_SIG_ASF            "ASF!"	/* Alert Standard Format table */ +#define ACPI_SIG_ASPT           "ASPT"	/* AMD Secure Processor Table */  #define ACPI_SIG_BERT           "BERT"	/* Boot Error Record Table */  #define ACPI_SIG_BGRT           "BGRT"	/* Boot Graphics Resource Table */  #define ACPI_SIG_BOOT           "BOOT"	/* Simple Boot Flag Table */ @@ -109,6 +110,51 @@ struct acpi_whea_header {  	u64 mask;		/* Bitmask required for this register instruction */  }; +/* https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/acpitabl/ns-acpitabl-aspt_table */ +#define ASPT_REVISION_ID 0x01 +struct acpi_table_aspt { +	struct acpi_table_header header; +	u32 num_entries; +}; + +struct acpi_aspt_header { +	u16 type; +	u16 length; +}; + +enum acpi_aspt_type { +	ACPI_ASPT_TYPE_GLOBAL_REGS = 0, +	ACPI_ASPT_TYPE_SEV_MBOX_REGS = 1, +	ACPI_ASPT_TYPE_ACPI_MBOX_REGS = 2, +}; + +/* 0: ASPT Global Registers */ +struct acpi_aspt_global_regs { +	struct acpi_aspt_header header; +	u32 reserved; +	u64 feature_reg_addr; +	u64 irq_en_reg_addr; +	u64 irq_st_reg_addr; +}; + +/* 1: ASPT SEV Mailbox Registers */ +struct acpi_aspt_sev_mbox_regs { +	struct acpi_aspt_header header; +	u8 mbox_irq_id; +	u8 reserved[3]; +	u64 cmd_resp_reg_addr; +	u64 cmd_buf_lo_reg_addr; +	u64 cmd_buf_hi_reg_addr; +}; + +/* 2: ASPT ACPI Mailbox Registers */ +struct acpi_aspt_acpi_mbox_regs { +	struct acpi_aspt_header header; +	u32 reserved1; +	u64 cmd_resp_reg_addr; +	u64 reserved2[2]; +}; +  /*******************************************************************************   *   * ASF - Alert Standard Format table (Signature "ASF!") @@ -855,7 +901,10 @@ struct acpi_dmar_andd {  	struct acpi_dmar_header header;  	u8 reserved[3];  	u8 device_number; -	char device_name[1]; +	union { +		char __pad; +		 ACPI_FLEX_ARRAY(char, device_name); +	};  };  /* 5: SOC Integrated Address Translation Cache Reporting Structure */ @@ -898,7 +947,7 @@ struct acpi_table_drtm {  struct acpi_drtm_vtable_list {  	u32 validated_table_count; -	u64 validated_tables[1]; +	u64 validated_tables[];  };  /* 2) Resources List (of Resource Descriptors) */ @@ -913,7 +962,7 @@ struct acpi_drtm_resource {  struct acpi_drtm_resource_list {  	u32 resource_count; -	struct acpi_drtm_resource resources[1]; +	struct acpi_drtm_resource resources[];  };  /* 3) Platform-specific Identifiers List */ @@ -936,7 +985,7 @@ struct acpi_table_ecdt {  	struct acpi_generic_address data;	/* Address of EC data register */  	u32 uid;		/* Unique ID - must be same as the EC _UID method */  	u8 gpe;			/* The GPE for the EC */ -	u8 id[1];		/* Full namepath of the EC in the ACPI namespace */ +	u8 id[];		/* Full namepath of the EC in the ACPI namespace */  };  /******************************************************************************* diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index b2973dbe37ee..0029336775a9 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h @@ -3,7 +3,7 @@   *   * Name: actbl2.h - ACPI Table Definitions (tables not in ACPI spec)   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ @@ -35,6 +35,7 @@  #define ACPI_SIG_MADT           "APIC"	/* Multiple APIC Description Table */  #define ACPI_SIG_MCFG           "MCFG"	/* PCI Memory Mapped Configuration table */  #define ACPI_SIG_MCHI           "MCHI"	/* Management Controller Host Interface table */ +#define ACPI_SIG_MPAM           "MPAM"	/* Memory System Resource Partitioning and Monitoring Table */  #define ACPI_SIG_MPST           "MPST"	/* Memory Power State Table */  #define ACPI_SIG_MSDM           "MSDM"	/* Microsoft Data Management Table */  #define ACPI_SIG_NFIT           "NFIT"	/* NVDIMM Firmware Interface Table */ @@ -47,6 +48,7 @@  #define ACPI_SIG_PRMT           "PRMT"	/* Platform Runtime Mechanism Table */  #define ACPI_SIG_RASF           "RASF"	/* RAS Feature table */  #define ACPI_SIG_RGRT           "RGRT"	/* Regulatory Graphics Resource Table */ +#define ACPI_SIG_RHCT           "RHCT"	/* RISC-V Hart Capabilities Table */  #define ACPI_SIG_SBST           "SBST"	/* Smart Battery Specification Table */  #define ACPI_SIG_SDEI           "SDEI"	/* Software Delegated Exception Interface Table */  #define ACPI_SIG_SDEV           "SDEV"	/* Secure Devices table */ @@ -82,7 +84,6 @@  struct acpi_table_aest {  	struct acpi_table_header header; -	void *node_array[];  };  /* Common Subtable header - one per Node Structure (Subtable) */ @@ -396,7 +397,7 @@ struct acpi_iort_node {  	u32 identifier;  	u32 mapping_count;  	u32 mapping_offset; -	char node_data[1]; +	char node_data[];  };  /* Values for subtable Type above */ @@ -452,14 +453,14 @@ struct acpi_iort_memory_access {   */  struct acpi_iort_its_group {  	u32 its_count; -	u32 identifiers[1];	/* GIC ITS identifier array */ +	u32 identifiers[];	/* GIC ITS identifier array */  };  struct acpi_iort_named_component {  	u32 node_flags;  	u64 memory_properties;	/* Memory access properties */  	u8 memory_address_limit;	/* Memory address size limit */ -	char device_name[1];	/* Path of namespace object */ +	char device_name[];	/* Path of namespace object */  };  /* Masks for Flags field above */ @@ -473,7 +474,7 @@ struct acpi_iort_root_complex {  	u32 pci_segment_number;  	u8 memory_address_limit;	/* Memory address size limit */  	u16 pasid_capabilities;	/* PASID Capabilities */ -	u8 reserved[1];		/* Reserved, must be zero */ +	u8 reserved[];		/* Reserved, must be zero */  };  /* Masks for ats_attribute field above */ @@ -495,7 +496,7 @@ struct acpi_iort_smmu {  	u32 context_interrupt_offset;  	u32 pmu_interrupt_count;  	u32 pmu_interrupt_offset; -	u64 interrupts[1];	/* Interrupt array */ +	u64 interrupts[];	/* Interrupt array */  };  /* Values for Model field above */ @@ -891,7 +892,8 @@ enum acpi_madt_type {  	ACPI_MADT_TYPE_MSI_PIC = 21,  	ACPI_MADT_TYPE_BIO_PIC = 22,  	ACPI_MADT_TYPE_LPC_PIC = 23, -	ACPI_MADT_TYPE_RESERVED = 24,	/* 24 to 0x7F are reserved */ +	ACPI_MADT_TYPE_RINTC = 24, +	ACPI_MADT_TYPE_RESERVED = 25,	/* 25 to 0x7F are reserved */  	ACPI_MADT_TYPE_OEM_RESERVED = 0x80	/* 0x80 to 0xFF are reserved for OEM use */  }; @@ -973,7 +975,7 @@ struct acpi_madt_local_sapic {  	u8 reserved[3];		/* Reserved, must be zero */  	u32 lapic_flags;  	u32 uid;		/* Numeric UID - ACPI 3.0 */ -	char uid_string[1];	/* String UID  - ACPI 3.0 */ +	char uid_string[];	/* String UID  - ACPI 3.0 */  };  /* 8: Platform Interrupt Source */ @@ -1013,7 +1015,7 @@ struct acpi_madt_local_x2apic_nmi {  	u8 reserved[3];		/* reserved - must be zero */  }; -/* 11: Generic interrupt - GICC (ACPI 5.0 + ACPI 6.0 + ACPI 6.3 changes) */ +/* 11: Generic interrupt - GICC (ACPI 5.0 + ACPI 6.0 + ACPI 6.3 + ACPI 6.5 changes) */  struct acpi_madt_generic_interrupt {  	struct acpi_subtable_header header; @@ -1033,6 +1035,7 @@ struct acpi_madt_generic_interrupt {  	u8 efficiency_class;  	u8 reserved2[1];  	u16 spe_interrupt;	/* ACPI 6.3 */ +	u16 trbe_interrupt;	/* ACPI 6.5 */  };  /* Masks for Flags field above */ @@ -1250,10 +1253,28 @@ enum acpi_madt_lpc_pic_version {  	ACPI_MADT_LPC_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */  }; +/* 24: RISC-V INTC */ +struct acpi_madt_rintc { +	struct acpi_subtable_header header; +	u8 version; +	u8 reserved; +	u32 flags; +	u64 hart_id; +	u32 uid;		/* ACPI processor UID */ +}; + +/* Values for RISC-V INTC Version field above */ + +enum acpi_madt_rintc_version { +	ACPI_MADT_RINTC_VERSION_NONE = 0, +	ACPI_MADT_RINTC_VERSION_V1 = 1, +	ACPI_MADT_RINTC_VERSION_RESERVED = 2	/* 2 and greater are reserved */ +}; +  /* 80: OEM data */  struct acpi_madt_oem_data { -	u8 oem_data[0]; +	ACPI_FLEX_ARRAY(u8, oem_data);  };  /* @@ -1334,6 +1355,121 @@ struct acpi_table_mchi {  /*******************************************************************************   * + * MPAM - Memory System Resource Partitioning and Monitoring + * + * Conforms to "ACPI for Memory System Resource Partitioning and Monitoring 2.0" + * Document number: ARM DEN 0065, December, 2022. + * + ******************************************************************************/ + +/* MPAM RIS locator types. Table 11, Location types */ +enum acpi_mpam_locator_type { +	ACPI_MPAM_LOCATION_TYPE_PROCESSOR_CACHE = 0, +	ACPI_MPAM_LOCATION_TYPE_MEMORY = 1, +	ACPI_MPAM_LOCATION_TYPE_SMMU = 2, +	ACPI_MPAM_LOCATION_TYPE_MEMORY_CACHE = 3, +	ACPI_MPAM_LOCATION_TYPE_ACPI_DEVICE = 4, +	ACPI_MPAM_LOCATION_TYPE_INTERCONNECT = 5, +	ACPI_MPAM_LOCATION_TYPE_UNKNOWN = 0xFF +}; + +/* MPAM Functional dependency descriptor. Table 10 */ +struct acpi_mpam_func_deps { +	u32 producer; +	u32 reserved; +}; + +/* MPAM Processor cache locator descriptor. Table 13 */ +struct acpi_mpam_resource_cache_locator { +	u64 cache_reference; +	u32 reserved; +}; + +/* MPAM Memory locator descriptor. Table 14 */ +struct acpi_mpam_resource_memory_locator { +	u64 proximity_domain; +	u32 reserved; +}; + +/* MPAM SMMU locator descriptor. Table 15 */ +struct acpi_mpam_resource_smmu_locator { +	u64 smmu_interface; +	u32 reserved; +}; + +/* MPAM Memory-side cache locator descriptor. Table 16 */ +struct acpi_mpam_resource_memcache_locator { +	u8 reserved[7]; +	u8 level; +	u32 reference; +}; + +/* MPAM ACPI device locator descriptor. Table 17 */ +struct acpi_mpam_resource_acpi_locator { +	u64 acpi_hw_id; +	u32 acpi_unique_id; +}; + +/* MPAM Interconnect locator descriptor. Table 18 */ +struct acpi_mpam_resource_interconnect_locator { +	u64 inter_connect_desc_tbl_off; +	u32 reserved; +}; + +/* MPAM Locator structure. Table 12 */ +struct acpi_mpam_resource_generic_locator { +	u64 descriptor1; +	u32 descriptor2; +}; + +union acpi_mpam_resource_locator { +	struct acpi_mpam_resource_cache_locator cache_locator; +	struct acpi_mpam_resource_memory_locator memory_locator; +	struct acpi_mpam_resource_smmu_locator smmu_locator; +	struct acpi_mpam_resource_memcache_locator mem_cache_locator; +	struct acpi_mpam_resource_acpi_locator acpi_locator; +	struct acpi_mpam_resource_interconnect_locator interconnect_ifc_locator; +	struct acpi_mpam_resource_generic_locator generic_locator; +}; + +/* Memory System Component Resource Node Structure Table 9 */ +struct acpi_mpam_resource_node { +	u32 identifier; +	u8 ris_index; +	u16 reserved1; +	u8 locator_type; +	union acpi_mpam_resource_locator locator; +	u32 num_functional_deps; +}; + +/* Memory System Component (MSC) Node Structure. Table 4 */ +struct acpi_mpam_msc_node { +	u16 length; +	u8 interface_type; +	u8 reserved; +	u32 identifier; +	u64 base_address; +	u32 mmio_size; +	u32 overflow_interrupt; +	u32 overflow_interrupt_flags; +	u32 reserved1; +	u32 overflow_interrupt_affinity; +	u32 error_interrupt; +	u32 error_interrupt_flags; +	u32 reserved2; +	u32 error_interrupt_affinity; +	u32 max_nrdy_usec; +	u64 hardware_id_linked_device; +	u32 instance_id_linked_device; +	u32 num_resouce_nodes; +}; + +struct acpi_table_mpam { +	struct acpi_table_header header;	/* Common ACPI table header */ +}; + +/******************************************************************************* + *   * MPST - Memory Power State Table (ACPI 5.0)   *        Version 1   * @@ -1564,7 +1700,7 @@ struct acpi_nfit_interleave {  	u16 reserved;		/* Reserved, must be zero */  	u32 line_count;  	u32 line_size; -	u32 line_offset[1];	/* Variable length */ +	u32 line_offset[];	/* Variable length */  };  /* 3: SMBIOS Management Information Structure */ @@ -1572,7 +1708,7 @@ struct acpi_nfit_interleave {  struct acpi_nfit_smbios {  	struct acpi_nfit_header header;  	u32 reserved;		/* Reserved, must be zero */ -	u8 data[1];		/* Variable length */ +	u8 data[];		/* Variable length */  };  /* 4: NVDIMM Control Region Structure */ @@ -1629,7 +1765,7 @@ struct acpi_nfit_flush_address {  	u32 device_handle;  	u16 hint_count;  	u8 reserved[6];		/* Reserved, must be zero */ -	u64 hint_address[1];	/* Variable length */ +	u64 hint_address[];	/* Variable length */  };  /* 7: Platform Capabilities Structure */ @@ -2587,6 +2723,53 @@ enum acpi_rgrt_image_type {  /*******************************************************************************   * + * RHCT - RISC-V Hart Capabilities Table + *        Version 1 + * + ******************************************************************************/ + +struct acpi_table_rhct { +	struct acpi_table_header header;	/* Common ACPI table header */ +	u32 reserved; +	u64 time_base_freq; +	u32 node_count; +	u32 node_offset; +}; + +/* + * RHCT subtables + */ +struct acpi_rhct_node_header { +	u16 type; +	u16 length; +	u16 revision; +}; + +/* Values for RHCT subtable Type above */ + +enum acpi_rhct_node_type { +	ACPI_RHCT_NODE_TYPE_ISA_STRING = 0x0000, +	ACPI_RHCT_NODE_TYPE_HART_INFO = 0xFFFF, +}; + +/* + * RHCT node specific subtables + */ + +/* ISA string node structure */ +struct acpi_rhct_isa_string { +	u16 isa_length; +	char isa[]; +}; + +/* Hart Info node structure */ +struct acpi_rhct_hart_info { +	u16 num_offsets; +	u32 uid;		/* ACPI processor UID */ +}; + +/******************************************************************************* + *   * SBST - Smart Battery Specification Table   *        Version 1   * diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h index 832c6464f063..f51c46f4e3e4 100644 --- a/include/acpi/actbl3.h +++ b/include/acpi/actbl3.h @@ -3,7 +3,7 @@   *   * Name: actbl3.h - ACPI Table Definitions   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 95e4f56f9754..cf6ee2cb0eb9 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -3,7 +3,7 @@   *   * Name: actypes.h - Common data types for the entire ACPI subsystem   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ @@ -1240,7 +1240,7 @@ struct acpi_mem_space_context {  	struct acpi_mem_mapping *first_mm;  }; -struct acpi_data_table_space_context { +struct acpi_data_table_mapping {  	void *pointer;  }; @@ -1323,4 +1323,8 @@ typedef enum {  #define ACPI_FALLTHROUGH do {} while(0)  #endif +#ifndef ACPI_FLEX_ARRAY +#define ACPI_FLEX_ARRAY(TYPE, NAME)     TYPE NAME[0] +#endif +  #endif				/* __ACTYPES_H__ */ diff --git a/include/acpi/acuuid.h b/include/acpi/acuuid.h index 171bb0b708a2..52a84523bfac 100644 --- a/include/acpi/acuuid.h +++ b/include/acpi/acuuid.h @@ -3,7 +3,7 @@   *   * Name: acuuid.h - ACPI-related UUID/GUID definitions   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index 9e4f7564201a..337ffa931ee8 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h @@ -3,7 +3,7 @@   *   * Name: acenv.h - Host and compiler configuration   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ @@ -209,6 +209,8 @@  #elif defined(_AED_EFI) || defined(_GNU_EFI) || defined(_EDK2_EFI)  #include "acefi.h" +#elif defined(__ZEPHYR__) +#include "aczephyr.h"  #else  /* Unknown environment */ diff --git a/include/acpi/platform/acenvex.h b/include/acpi/platform/acenvex.h index 72cc7bab469e..7e67e3503f7b 100644 --- a/include/acpi/platform/acenvex.h +++ b/include/acpi/platform/acenvex.h @@ -3,7 +3,7 @@   *   * Name: acenvex.h - Extra host and compiler configuration   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h index ac80111f503c..04b4bf620517 100644 --- a/include/acpi/platform/acgcc.h +++ b/include/acpi/platform/acgcc.h @@ -3,7 +3,7 @@   *   * Name: acgcc.h - GCC specific defines, etc.   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ @@ -61,4 +61,15 @@  #define ACPI_FALLTHROUGH __attribute__((__fallthrough__))  #endif +/* + * Flexible array members are not allowed to be part of a union under + * C99, but this is not for any technical reason. Work around the + * limitation. + */ +#define ACPI_FLEX_ARRAY(TYPE, NAME)             \ +        struct {                                \ +                struct { } __Empty_ ## NAME;    \ +                TYPE NAME[];                    \ +        } +  #endif				/* __ACGCC_H__ */ diff --git a/include/acpi/platform/acgccex.h b/include/acpi/platform/acgccex.h index 302ea1b724b9..7c9f10e9633a 100644 --- a/include/acpi/platform/acgccex.h +++ b/include/acpi/platform/acgccex.h @@ -3,7 +3,7 @@   *   * Name: acgccex.h - Extra GCC specific defines, etc.   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index a5550dd4d507..1ca450e35c0d 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h @@ -3,7 +3,7 @@   *   * Name: aclinux.h - OS specific defines, etc. for Linux   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ @@ -180,7 +180,10 @@  #define ACPI_USE_STANDARD_HEADERS  #ifdef ACPI_USE_STANDARD_HEADERS +#include <stddef.h>  #include <unistd.h> + +#define ACPI_OFFSET(d, f)   offsetof(d, f)  #endif  /* Define/disable kernel-specific declarators */ @@ -199,7 +202,7 @@  #if defined(__ia64__)    || (defined(__x86_64__) && !defined(__ILP32__)) ||\  	defined(__aarch64__) || defined(__PPC64__) ||\ -	defined(__s390x__) ||\ +	defined(__s390x__)   || defined(__loongarch__) ||\  	(defined(__riscv) && (defined(__LP64__) || defined(_LP64)))  #define ACPI_MACHINE_WIDTH          64  #define COMPILER_DEPENDENT_INT64    long diff --git a/include/acpi/platform/aclinuxex.h b/include/acpi/platform/aclinuxex.h index 28c72744decf..600d4e2641da 100644 --- a/include/acpi/platform/aclinuxex.h +++ b/include/acpi/platform/aclinuxex.h @@ -3,7 +3,7 @@   *   * Name: aclinuxex.h - Extra OS specific defines, etc. for Linux   * - * Copyright (C) 2000 - 2022, Intel Corp. + * Copyright (C) 2000 - 2023, Intel Corp.   *   *****************************************************************************/ diff --git a/include/acpi/platform/aczephyr.h b/include/acpi/platform/aczephyr.h new file mode 100644 index 000000000000..2f0d30c3c5fd --- /dev/null +++ b/include/acpi/platform/aczephyr.h @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */ +/****************************************************************************** + * + * Module Name: aczephyr.h - OS specific defines, etc. + * + * Copyright (C) 2000 - 2023, Intel Corp. + * + *****************************************************************************/ + +#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 +#undef ACPI_DEBUG_OUTPUT +#define ACPI_USE_SYSTEM_CLIBRARY +#undef ACPI_DBG_TRACK_ALLOCATIONS +#define ACPI_SINGLE_THREADED +#define ACPI_USE_NATIVE_RSDP_POINTER + +#include <zephyr/kernel.h> +#include <zephyr/device.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <zephyr/fs/fs.h> +#include <zephyr/sys/printk.h> +#include <zephyr/sys/__assert.h> + +/****************************************************************************** + * + * FUNCTION:    acpi_enable_dbg_print + * + * PARAMETERS:  Enable, 	            - Enable/Disable debug print + * + * RETURN:      None + * + * DESCRIPTION: Enable/disable debug print + * + *****************************************************************************/ + +void acpi_enable_dbg_print(bool enable); +#endif | 
