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>
This commit is contained in:
Maximilian Brune
2023-09-16 20:08:41 +02:00
committed by Lean Sheng Tan
parent 5afdcd9190
commit da336cd5c6
13 changed files with 26 additions and 20 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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>

View File

@@ -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__ */

View File

@@ -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>

View File

@@ -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

View File

@@ -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)

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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

View File

@@ -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>

View File

@@ -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