summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaximilian Brune <maximilian.brune@9elements.com>2023-09-16 20:08:41 +0200
committerLean Sheng Tan <sheng.tan@9elements.com>2024-06-22 04:02:04 +0000
commitda336cd5c61b3ec137ec21d059aa36b9f8e80269 (patch)
tree6d56c287e931cf18d257ec2cccb066eec8a21910 /src
parent5afdcd9190a83cb3a13e17cb59126bfcf58e739a (diff)
treewide: Move device_tree to commonlib
Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com> Change-Id: I990d74d9fff06b17ec8a6ee962955e4b0df8b907 Reviewed-on: https://review.coreboot.org/c/coreboot/+/77970 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r--src/commonlib/Makefile.mk3
-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.h2
-rw-r--r--src/lib/Makefile.mk3
-rw-r--r--src/mainboard/emulation/qemu-sbsa/cbmem.c2
-rw-r--r--src/mainboard/emulation/qemu-sbsa/mainboard.c2
-rw-r--r--src/mainboard/sifive/hifive-unleashed/fixup_fdt.c2
-rw-r--r--src/mainboard/sifive/hifive-unmatched/fixup_fdt.c2
9 files changed, 18 insertions, 13 deletions
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>