1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * fw_tables.h - Parsing support for ACPI and ACPI-like tables provided by
4 * platform or device firmware
6 * Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
7 * Copyright (C) 2023 Intel Corp.
12 union acpi_subtable_headers
;
14 typedef int (*acpi_tbl_entry_handler
)(union acpi_subtable_headers
*header
,
15 const unsigned long end
);
17 typedef int (*acpi_tbl_entry_handler_arg
)(union acpi_subtable_headers
*header
,
18 void *arg
, const unsigned long end
);
20 struct acpi_subtable_proc
{
22 acpi_tbl_entry_handler handler
;
23 acpi_tbl_entry_handler_arg handler_arg
;
28 union fw_table_header
{
29 struct acpi_table_header acpi
;
30 struct acpi_table_cdat cdat
;
33 union acpi_subtable_headers
{
34 struct acpi_subtable_header common
;
35 struct acpi_hmat_structure hmat
;
36 struct acpi_prmt_module_header prmt
;
37 struct acpi_cedt_header cedt
;
38 struct acpi_cdat_header cdat
;
41 int acpi_parse_entries_array(char *id
, unsigned long table_size
,
42 union fw_table_header
*table_header
,
43 unsigned long max_length
,
44 struct acpi_subtable_proc
*proc
,
45 int proc_num
, unsigned int max_entries
);
47 int cdat_table_parse(enum acpi_cdat_type type
,
48 acpi_tbl_entry_handler_arg handler_arg
, void *arg
,
49 struct acpi_table_cdat
*table_header
,
50 unsigned long length
);
52 /* CXL is the only non-ACPI consumer of the FIRMWARE_TABLE library */
53 #if IS_ENABLED(CONFIG_ACPI) && !IS_ENABLED(CONFIG_CXL_BUS)
54 #define EXPORT_SYMBOL_FWTBL_LIB(x) EXPORT_SYMBOL_ACPI_LIB(x)
55 #define __init_or_fwtbl_lib __init_or_acpilib
57 #define EXPORT_SYMBOL_FWTBL_LIB(x) EXPORT_SYMBOL_NS_GPL(x, "CXL")
58 #define __init_or_fwtbl_lib