Skip to content

Commit

Permalink
acpi: Create a new Kconfig for ACPI
Browse files Browse the repository at this point in the history
We have several Kconfig options for ACPI, but all relate to specific
functions, such as generating tables and AML code.

Add a new option which controls including basic ACPI library code,
including the lib/acpi directory. This will allow us to add functions
which are available even if table generation is not supported.

Adjust the command to avoid a build error when ACPIGEN is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
  • Loading branch information
sjg20 authored and lbmeng committed May 11, 2023
1 parent d8062e9 commit 0992a90
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 3 deletions.
2 changes: 2 additions & 0 deletions arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ config SANDBOX
imply PHYLIB
imply DM_MDIO
imply DM_MDIO_MUX
imply ACPI
imply ACPI_PMC
imply ACPI_PMC_SANDBOX
imply CMD_PMC
Expand Down Expand Up @@ -261,6 +262,7 @@ config X86
imply PCH
imply PHYSMEM
imply RTC_MC146818
imply ACPI
imply ACPIGEN if !QEMU && !EFI_APP
imply SYSINFO if GENERATE_SMBIOS_TABLE
imply SYSINFO_SMBIOS if GENERATE_SMBIOS_TABLE
Expand Down
2 changes: 1 addition & 1 deletion cmd/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ menu "Info commands"

config CMD_ACPI
bool "acpi"
depends on ACPIGEN
depends on ACPI
default y
help
List and dump ACPI tables. ACPI (Advanced Configuration and Power
Expand Down
4 changes: 4 additions & 0 deletions cmd/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ static int do_acpi_items(struct cmd_tbl *cmdtp, int flag, int argc,
bool dump_contents;

dump_contents = argc >= 2 && !strcmp("-d", argv[1]);
if (!IS_ENABLED(CONFIG_ACPIGEN)) {
printf("Not supported (enable ACPIGEN)\n");
return CMD_RET_FAILURE;
}
acpi_dump_items(dump_contents ? ACPI_DUMP_CONTENTS : ACPI_DUMP_LIST);

return 0;
Expand Down
1 change: 1 addition & 0 deletions drivers/core/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ config OFNODE_MULTI_TREE_MAX

config ACPIGEN
bool "Support ACPI table generation in driver model"
depends on ACPI
default y if SANDBOX || (GENERATE_ACPI_TABLE && !QEMU)
select LIB_UUID
help
Expand Down
10 changes: 9 additions & 1 deletion lib/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,17 @@ config SUPPORT_ACPI
U-Boot can generate these tables and pass them to the Operating
System.

config ACPI
bool "Enable support for ACPI libraries"
depends on SUPPORT_ACPI
help
Provides library functions for dealing with ACPI tables. This does
not necessarily include generation of tables
(see GENERATE_ACPI_TABLE), but allows for tables to be located.

config GENERATE_ACPI_TABLE
bool "Generate an ACPI (Advanced Configuration and Power Interface) table"
depends on SUPPORT_ACPI
depends on ACPI
select QFW if QEMU
help
The Advanced Configuration and Power Interface (ACPI) specification
Expand Down
2 changes: 1 addition & 1 deletion lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ obj-$(CONFIG_$(SPL_TPL_)CRC8) += crc8.o

obj-y += crypto/

obj-$(CONFIG_$(SPL_TPL_)GENERATE_ACPI_TABLE) += acpi/
obj-$(CONFIG_$(SPL_TPL_)ACPI) += acpi/
obj-$(CONFIG_$(SPL_)MD5) += md5.o
obj-$(CONFIG_ECDSA) += ecdsa/
obj-$(CONFIG_$(SPL_)RSA) += rsa/
Expand Down
4 changes: 4 additions & 0 deletions lib/acpi/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# SPDX-License-Identifier: GPL-2.0+
#

ifdef CONFIG_$(SPL_TPL_)GENERATE_ACPI_TABLE

obj-$(CONFIG_$(SPL_)ACPIGEN) += acpigen.o
obj-$(CONFIG_$(SPL_)ACPIGEN) += acpi_device.o
obj-$(CONFIG_$(SPL_)ACPIGEN) += acpi_dp.o
Expand All @@ -21,3 +23,5 @@ endif
obj-y += facs.o
obj-y += ssdt.o
endif

endif # GENERATE_ACPI_TABLE

0 comments on commit 0992a90

Please sign in to comment.