Hey Stephen, Just a heads up that you will see a conflict with current ACPI content with the next pull of cxl.git/next tree. Here are the commits in -next that conflict: f47507988145 thermal: ACPI: Move the ACPI thermal library to drivers/acpi/ 4b3805daaacb ACPI: tables: Correct and clean up the logic of acpi_parse_entries_array() My proposed resolution below, and this branch has otherwise got a build success notification from 0day. commit 43d2e52a911396164845727e5d92f1d73c4ac195 Merge: 39676dfe5233 185c1a489f87 Author: Dan Williams <dan.j.williams@xxxxxxxxx> Date: Fri Dec 22 16:04:54 2023 -0800 Merge branch 'for-6.8/cxl-cdat' into test diff --cc include/linux/acpi.h index 118a18b7ff84,8b0761c682f9..b7165e52b3c6 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@@ -424,13 -425,16 +425,23 @@@ extern int acpi_blacklisted(void) extern void acpi_osi_setup(char *str); extern bool acpi_osi_is_win8(void); +#ifdef CONFIG_ACPI_THERMAL_LIB +int thermal_acpi_active_trip_temp(struct acpi_device *adev, int id, int *ret_temp); +int thermal_acpi_passive_trip_temp(struct acpi_device *adev, int *ret_temp); +int thermal_acpi_hot_trip_temp(struct acpi_device *adev, int *ret_temp); +int thermal_acpi_critical_trip_temp(struct acpi_device *adev, int *ret_temp); +#endif + + #ifdef CONFIG_ACPI_HMAT + int acpi_get_genport_coordinates(u32 uid, struct access_coordinate *coord); + #else + static inline int acpi_get_genport_coordinates(u32 uid, + struct access_coordinate *coord) + { + return -EOPNOTSUPP; + } + #endif + #ifdef CONFIG_ACPI_NUMA int acpi_map_pxm_to_node(int pxm); int acpi_get_node(acpi_handle handle); diff --cc lib/fw_table.c index c49a09ee3853,1e5e0b2f7012..c3569d2ba503 --- a/lib/fw_table.c +++ b/lib/fw_table.c @@@ -85,9 -98,27 +98,22 @@@ acpi_get_subtable_type(char *id return ACPI_SUBTABLE_COMMON; } - static __init_or_acpilib int call_handler(struct acpi_subtable_proc *proc, - union acpi_subtable_headers *hdr, - unsigned long end) + static unsigned long __init_or_fwtbl_lib + acpi_table_get_length(enum acpi_subtable_type type, + union fw_table_header *header) + { + if (type == CDAT_SUBTABLE) { + __le32 length = (__force __le32)header->cdat.length; + + return le32_to_cpu(length); + } + + return header->acpi.length; + } + -static __init_or_fwtbl_lib bool has_handler(struct acpi_subtable_proc *proc) -{ - return proc->handler || proc->handler_arg; -} - + static __init_or_fwtbl_lib int call_handler(struct acpi_subtable_proc *proc, + union acpi_subtable_headers *hdr, + unsigned long end) { if (proc->handler) return proc->handler(hdr, end); @@@ -127,10 -158,14 +153,13 @@@ acpi_parse_entries_array(char *id, unsi { unsigned long table_end, subtable_len, entry_len; struct acpi_subtable_entry entry; + enum acpi_subtable_type type; int count = 0; - int errs = 0; int i; - table_end = (unsigned long)table_header + table_header->length; + type = acpi_get_subtable_type(id); + table_end = (unsigned long)table_header + + acpi_table_get_length(type, table_header); /* Parse all entries looking for a match. */ @@@ -168,9 -209,31 +197,31 @@@ } if (max_entries && count > max_entries) { - pr_warn("[%4.4s:0x%02x] found the maximum %i entries\n", - id, proc->id, count); + pr_warn("[%4.4s:0x%02x] ignored %i entries of %i found\n", + id, proc->id, count - max_entries, count); } - return errs ? -EINVAL : count; + return count; } + + int __init_or_fwtbl_lib + cdat_table_parse(enum acpi_cdat_type type, + acpi_tbl_entry_handler_arg handler_arg, + void *arg, + struct acpi_table_cdat *table_header) + { + struct acpi_subtable_proc proc = { + .id = type, + .handler_arg = handler_arg, + .arg = arg, + }; + + if (!table_header) + return -EINVAL; + + return acpi_parse_entries_array(ACPI_SIG_CDAT, + sizeof(struct acpi_table_cdat), + (union fw_table_header *)table_header, + &proc, 1, 0); + } + EXPORT_SYMBOL_FWTBL_LIB(cdat_table_parse);