lib/firmware_table: tables: Add CDAT table parsing support
authorDave Jiang <dave.jiang@intel.com>
Thu, 21 Dec 2023 22:02:31 +0000 (15:02 -0700)
committerDan Williams <dan.j.williams@intel.com>
Fri, 22 Dec 2023 22:23:13 +0000 (14:23 -0800)
commit60e43fe5285e2077ce9904d78cd42a230d03b788
tree1caa778784f5476121e899180ef39eef9b31e271
parentceb6a6f023fd3e8b07761ed900352ef574010bcb
lib/firmware_table: tables: Add CDAT table parsing support

The CDAT table is very similar to ACPI tables when it comes to sub-table
and entry structures. The helper functions can be also used to parse the
CDAT table. Add support to the helper functions to deal with an external
CDAT table, and also handle the endieness since CDAT can be processed by a
BE host. Export a function cdat_table_parse() for CXL driver to parse
a CDAT table.

In order to minimize ACPICA code changes, __force is being utilized to deal
with the case of a big endian (BE) host parsing a CDAT. All CDAT data
structure variables are being force casted to __leX as appropriate.

Cc: Rafael J. Wysocki <rafael@kernel.org>
Cc: Len Brown <lenb@kernel.org>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/170319615131.2212653.10932785667981494238.stgit@djiang5-mobl3
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/acpi/tables.c
include/linux/fw_table.h
lib/fw_table.c