2023-10-12 18:53:54 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/*
|
|
|
|
* fw_tables.h - Parsing support for ACPI and ACPI-like tables provided by
|
|
|
|
* platform or device firmware
|
|
|
|
*
|
|
|
|
* Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
|
|
|
|
* Copyright (C) 2023 Intel Corp.
|
|
|
|
*/
|
|
|
|
#ifndef _FW_TABLE_H_
|
|
|
|
#define _FW_TABLE_H_
|
|
|
|
|
|
|
|
union acpi_subtable_headers;
|
|
|
|
|
|
|
|
typedef int (*acpi_tbl_entry_handler)(union acpi_subtable_headers *header,
|
|
|
|
const unsigned long end);
|
|
|
|
|
|
|
|
typedef int (*acpi_tbl_entry_handler_arg)(union acpi_subtable_headers *header,
|
|
|
|
void *arg, const unsigned long end);
|
|
|
|
|
|
|
|
struct acpi_subtable_proc {
|
|
|
|
int id;
|
|
|
|
acpi_tbl_entry_handler handler;
|
|
|
|
acpi_tbl_entry_handler_arg handler_arg;
|
|
|
|
void *arg;
|
|
|
|
int count;
|
|
|
|
};
|
|
|
|
|
2023-12-21 22:02:31 +00:00
|
|
|
union fw_table_header {
|
|
|
|
struct acpi_table_header acpi;
|
|
|
|
struct acpi_table_cdat cdat;
|
|
|
|
};
|
|
|
|
|
2023-10-12 18:53:54 +00:00
|
|
|
union acpi_subtable_headers {
|
|
|
|
struct acpi_subtable_header common;
|
|
|
|
struct acpi_hmat_structure hmat;
|
|
|
|
struct acpi_prmt_module_header prmt;
|
|
|
|
struct acpi_cedt_header cedt;
|
2023-12-21 22:02:31 +00:00
|
|
|
struct acpi_cdat_header cdat;
|
2023-10-12 18:53:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int acpi_parse_entries_array(char *id, unsigned long table_size,
|
2023-12-21 22:02:31 +00:00
|
|
|
union fw_table_header *table_header,
|
2024-02-17 21:39:46 +00:00
|
|
|
unsigned long max_length,
|
2023-10-12 18:53:54 +00:00
|
|
|
struct acpi_subtable_proc *proc,
|
|
|
|
int proc_num, unsigned int max_entries);
|
|
|
|
|
2023-12-21 22:02:31 +00:00
|
|
|
int cdat_table_parse(enum acpi_cdat_type type,
|
|
|
|
acpi_tbl_entry_handler_arg handler_arg, void *arg,
|
2024-02-17 21:39:46 +00:00
|
|
|
struct acpi_table_cdat *table_header,
|
|
|
|
unsigned long length);
|
2023-12-21 22:02:31 +00:00
|
|
|
|
|
|
|
/* CXL is the only non-ACPI consumer of the FIRMWARE_TABLE library */
|
|
|
|
#if IS_ENABLED(CONFIG_ACPI) && !IS_ENABLED(CONFIG_CXL_BUS)
|
|
|
|
#define EXPORT_SYMBOL_FWTBL_LIB(x) EXPORT_SYMBOL_ACPI_LIB(x)
|
|
|
|
#define __init_or_fwtbl_lib __init_or_acpilib
|
|
|
|
#else
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 14:59:47 +00:00
|
|
|
#define EXPORT_SYMBOL_FWTBL_LIB(x) EXPORT_SYMBOL_NS_GPL(x, "CXL")
|
2023-12-21 22:02:31 +00:00
|
|
|
#define __init_or_fwtbl_lib
|
|
|
|
#endif
|
|
|
|
|
2023-10-12 18:53:54 +00:00
|
|
|
#endif
|