diff options
-rw-r--r-- | payloads/libpayload/libc/Makefile.mk | 1 | ||||
-rw-r--r-- | src/commonlib/Makefile.mk | 3 | ||||
-rw-r--r-- | src/commonlib/device_tree.c (renamed from src/lib/device_tree.c) | 9 | ||||
-rw-r--r-- | src/commonlib/include/commonlib/device_tree.h (renamed from src/include/device_tree.h) | 6 | ||||
-rw-r--r-- | src/include/fit.h | 2 | ||||
-rw-r--r-- | src/lib/Makefile.mk | 3 | ||||
-rw-r--r-- | src/mainboard/emulation/qemu-sbsa/cbmem.c | 2 | ||||
-rw-r--r-- | src/mainboard/emulation/qemu-sbsa/mainboard.c | 2 | ||||
-rw-r--r-- | src/mainboard/sifive/hifive-unleashed/fixup_fdt.c | 2 | ||||
-rw-r--r-- | src/mainboard/sifive/hifive-unmatched/fixup_fdt.c | 2 | ||||
-rw-r--r-- | tests/commonlib/Makefile.mk | 6 | ||||
-rw-r--r-- | tests/commonlib/device_tree-test.c (renamed from tests/lib/device_tree-test.c) | 2 | ||||
-rw-r--r-- | tests/lib/Makefile.mk | 6 |
13 files changed, 26 insertions, 20 deletions
diff --git a/payloads/libpayload/libc/Makefile.mk b/payloads/libpayload/libc/Makefile.mk index 5a65565e55..3d070ebe5b 100644 --- a/payloads/libpayload/libc/Makefile.mk +++ b/payloads/libpayload/libc/Makefile.mk @@ -49,6 +49,7 @@ libc-srcs += $(coreboottop)/src/commonlib/bsd/gcd.c libc-srcs += $(coreboottop)/src/commonlib/bsd/ipchksum.c libc-srcs += $(coreboottop)/src/commonlib/bsd/string.c ifeq ($(CONFIG_LP_GPL),y) +libc-srcs += $(coreboottop)/src/commonlib/device_tree.c libc-srcs += $(coreboottop)/src/commonlib/list.c endif endif diff --git a/src/commonlib/Makefile.mk b/src/commonlib/Makefile.mk index 00f3629c1e..a274d5fc96 100644 --- a/src/commonlib/Makefile.mk +++ b/src/commonlib/Makefile.mk @@ -32,6 +32,9 @@ romstage-$(CONFIG_PLATFORM_USES_FSP2_0) += fsp_relocate.c endif ramstage-$(CONFIG_PLATFORM_USES_FSP2_0) += fsp_relocate.c +romstage-$(CONFIG_FLATTENED_DEVICE_TREE) += device_tree.c +ramstage-$(CONFIG_FLATTENED_DEVICE_TREE) += device_tree.c + bootblock-y += bsd/cbfs_private.c verstage-y += bsd/cbfs_private.c romstage-y += bsd/cbfs_private.c diff --git a/src/lib/device_tree.c b/src/commonlib/device_tree.c index 5087d3940d..f70aaf7115 100644 --- a/src/lib/device_tree.c +++ b/src/commonlib/device_tree.c @@ -2,12 +2,17 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include <assert.h> -#include <console/console.h> +#include <commonlib/device_tree.h> #include <ctype.h> -#include <device_tree.h> #include <endian.h> #include <stdbool.h> #include <stdint.h> +#ifdef __COREBOOT__ +#include <console/console.h> +#else +#include <stdio.h> +#define printk(level, ...) printf(__VA_ARGS__) +#endif #include <stdio.h> #include <string.h> #include <stddef.h> diff --git a/src/include/device_tree.h b/src/commonlib/include/commonlib/device_tree.h index bb522bf1da..be7335783f 100644 --- a/src/include/device_tree.h +++ b/src/commonlib/include/commonlib/device_tree.h @@ -1,8 +1,8 @@ /* Taken from depthcharge: src/base/device_tree.h */ /* SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __DEVICE_TREE_H__ -#define __DEVICE_TREE_H__ +#ifndef __COMMONLIB_DEVICE_TREE_H__ +#define __COMMONLIB_DEVICE_TREE_H__ #include <stdbool.h> #include <stddef.h> @@ -229,4 +229,4 @@ int dt_apply_fixups(struct device_tree *tree); */ struct device_tree_node *dt_init_reserved_memory_node(struct device_tree *tree); -#endif /* __DEVICE_TREE_H__ */ +#endif /* __COMMONLIB_DEVICE_TREE_H__ */ diff --git a/src/include/fit.h b/src/include/fit.h index d587750743..25f85ab41a 100644 --- a/src/include/fit.h +++ b/src/include/fit.h @@ -4,8 +4,8 @@ #ifndef __LIB_FIT_H__ #define __LIB_FIT_H__ +#include <commonlib/device_tree.h> #include <commonlib/list.h> -#include <device_tree.h> #include <program_loading.h> #include <stddef.h> #include <stdint.h> diff --git a/src/lib/Makefile.mk b/src/lib/Makefile.mk index 59e2116e30..56d8b1afd5 100644 --- a/src/lib/Makefile.mk +++ b/src/lib/Makefile.mk @@ -163,9 +163,6 @@ ramstage-$(CONFIG_ACPI_NHLT) += nhlt.c ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit.c ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit_payload.c -romstage-$(CONFIG_FLATTENED_DEVICE_TREE) += device_tree.c -ramstage-$(CONFIG_FLATTENED_DEVICE_TREE) += device_tree.c - romstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c ramstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c diff --git a/src/mainboard/emulation/qemu-sbsa/cbmem.c b/src/mainboard/emulation/qemu-sbsa/cbmem.c index ebc8a78da3..d6d5861014 100644 --- a/src/mainboard/emulation/qemu-sbsa/cbmem.c +++ b/src/mainboard/emulation/qemu-sbsa/cbmem.c @@ -2,7 +2,7 @@ #include <cbmem.h> #include <symbols.h> -#include <device_tree.h> +#include <commonlib/device_tree.h> #include <console/console.h> DECLARE_REGION(fdt_pointer) diff --git a/src/mainboard/emulation/qemu-sbsa/mainboard.c b/src/mainboard/emulation/qemu-sbsa/mainboard.c index 112e1183e4..9d64b73c6b 100644 --- a/src/mainboard/emulation/qemu-sbsa/mainboard.c +++ b/src/mainboard/emulation/qemu-sbsa/mainboard.c @@ -6,7 +6,7 @@ #include <bootmem.h> #include <cbfs.h> #include <device/device.h> -#include <device_tree.h> +#include <commonlib/device_tree.h> #include <bootmem.h> #include <arch/mmu.h> #include <mainboard/addressmap.h> diff --git a/src/mainboard/sifive/hifive-unleashed/fixup_fdt.c b/src/mainboard/sifive/hifive-unleashed/fixup_fdt.c index dda71b6766..c4999a5d91 100644 --- a/src/mainboard/sifive/hifive-unleashed/fixup_fdt.c +++ b/src/mainboard/sifive/hifive-unleashed/fixup_fdt.c @@ -7,7 +7,7 @@ #include <soc/otp.h> #include <soc/sdram.h> #include <cbfs.h> -#include <device_tree.h> +#include <commonlib/device_tree.h> #include <bootstate.h> #include <mcall.h> diff --git a/src/mainboard/sifive/hifive-unmatched/fixup_fdt.c b/src/mainboard/sifive/hifive-unmatched/fixup_fdt.c index ed24ee36d7..766258a88a 100644 --- a/src/mainboard/sifive/hifive-unmatched/fixup_fdt.c +++ b/src/mainboard/sifive/hifive-unmatched/fixup_fdt.c @@ -7,7 +7,7 @@ #include <soc/otp.h> #include <soc/sdram.h> #include <cbfs.h> -#include <device_tree.h> +#include <commonlib/device_tree.h> #include <bootstate.h> #include <mcall.h> diff --git a/tests/commonlib/Makefile.mk b/tests/commonlib/Makefile.mk index 55c3ddd702..e593b14404 100644 --- a/tests/commonlib/Makefile.mk +++ b/tests/commonlib/Makefile.mk @@ -5,6 +5,12 @@ subdirs-y += bsd tests-y += list-test tests-y += rational-test tests-y += region-test +tests-y += device_tree-test + +device_tree-test-srcs += tests/commonlib/device_tree-test.c +device_tree-test-srcs += tests/stubs/console.c +device_tree-test-srcs += src/commonlib/device_tree.c +device_tree-test-syssrcs += tests/helpers/file.c list-test-srcs += tests/commonlib/list-test.c list-test-srcs += src/commonlib/list.c diff --git a/tests/lib/device_tree-test.c b/tests/commonlib/device_tree-test.c index 21f81c6beb..0c1e2dd8f3 100644 --- a/tests/lib/device_tree-test.c +++ b/tests/commonlib/device_tree-test.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include <commonlib/device_tree.h> #include <console/console.h> -#include <device_tree.h> #include <helpers/file.h> #include <stddef.h> #include <stdint.h> diff --git a/tests/lib/Makefile.mk b/tests/lib/Makefile.mk index 2090ef8831..7fc5471529 100644 --- a/tests/lib/Makefile.mk +++ b/tests/lib/Makefile.mk @@ -39,15 +39,9 @@ tests-y += cbfs-lookup-no-mcache-test tests-y += cbfs-lookup-has-mcache-test tests-y += lzma-test tests-y += ux_locales-test -tests-y += device_tree-test lib-test-srcs += tests/lib/lib-test.c -device_tree-test-srcs += tests/lib/device_tree-test.c -device_tree-test-srcs += tests/stubs/console.c -device_tree-test-srcs += src/lib/device_tree.c -device_tree-test-syssrcs += tests/helpers/file.c - string-test-srcs += tests/lib/string-test.c string-test-srcs += src/lib/string.c |