Jakub Czapiga has submitted this change. ( https://review.coreboot.org/c/coreboot/+/77968?usp=email )
Change subject: treewide: Move list.h to commonlib ......................................................................
treewide: Move list.h to commonlib
It is needed in order to move device_tree.c into commonlib in a subsequent commit.
Signed-off-by: Maximilian Brune maximilian.brune@9elements.com Change-Id: I16eb7b743fb1d36301f0eda563a62364e7a9cfec Reviewed-on: https://review.coreboot.org/c/coreboot/+/77968 Reviewed-by: Julius Werner jwerner@chromium.org Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M payloads/libpayload/Makefile.mk M payloads/libpayload/libc/Makefile.mk M src/commonlib/Makefile.mk R src/commonlib/include/commonlib/list.h R src/commonlib/list.c M src/include/device_tree.h M src/include/fit.h M src/lib/Makefile.mk M src/lib/cbfs.c M src/lib/edid_fill_fb.c M tests/commonlib/Makefile.mk R tests/commonlib/list-test.c M tests/lib/Makefile.mk 13 files changed, 25 insertions(+), 17 deletions(-)
Approvals: Julius Werner: Looks good to me, approved build bot (Jenkins): Verified
diff --git a/payloads/libpayload/Makefile.mk b/payloads/libpayload/Makefile.mk index 61f932f..e000868 100644 --- a/payloads/libpayload/Makefile.mk +++ b/payloads/libpayload/Makefile.mk @@ -70,6 +70,9 @@ INCLUDES += -include include/kconfig.h INCLUDES += -include $(coreboottop)/src/commonlib/bsd/include/commonlib/bsd/compiler.h INCLUDES += -I$(coreboottop)/src/commonlib/bsd/include +ifeq ($(CONFIG_LP_GPL),y) +INCLUDES += -I$(coreboottop)/src/commonlib/include +endif INCLUDES += -I$(VBOOT_SOURCE)/firmware/include
CFLAGS += $(INCLUDES) -Os -pipe -nostdinc -ggdb3 diff --git a/payloads/libpayload/libc/Makefile.mk b/payloads/libpayload/libc/Makefile.mk index 306bebf..6ff1eb8 100644 --- a/payloads/libpayload/libc/Makefile.mk +++ b/payloads/libpayload/libc/Makefile.mk @@ -48,4 +48,7 @@ libc-srcs += $(coreboottop)/src/commonlib/bsd/elog.c libc-srcs += $(coreboottop)/src/commonlib/bsd/gcd.c libc-srcs += $(coreboottop)/src/commonlib/bsd/ipchksum.c +ifeq ($(CONFIG_LP_GPL),y) +libc-srcs += $(coreboottop)/src/commonlib/list.c +endif endif diff --git a/src/commonlib/Makefile.mk b/src/commonlib/Makefile.mk index 7ec4de9..30aaddf 100644 --- a/src/commonlib/Makefile.mk +++ b/src/commonlib/Makefile.mk @@ -53,6 +53,8 @@ ramstage-y += bsd/lz4_wrapper.c postcar-y += bsd/lz4_wrapper.c
+all-y += list.c + ramstage-y += sort.c
romstage-y += bsd/elog.c diff --git a/src/include/list.h b/src/commonlib/include/commonlib/list.h similarity index 88% rename from src/include/list.h rename to src/commonlib/include/commonlib/list.h index bfd92a7..6c8a5d2 100644 --- a/src/include/list.h +++ b/src/commonlib/include/commonlib/list.h @@ -1,8 +1,10 @@ /* Taken from depthcharge: src/base/list.h */ /* SPDX-License-Identifier: GPL-2.0-or-later */
-#ifndef __LIST_H__ -#define __LIST_H__ +#ifndef __COMMONLIB_LIST_H__ +#define __COMMONLIB_LIST_H__ + +#include <commonlib/helpers.h>
struct list_node { struct list_node *next; @@ -24,4 +26,4 @@ (ptr) = container_of((ptr)->member.next, \ typeof(*(ptr)), member))
-#endif /* __LIST_H__ */ +#endif /* __COMMONLIB_LIST_H__ */ diff --git a/src/lib/list.c b/src/commonlib/list.c similarity index 96% rename from src/lib/list.c rename to src/commonlib/list.c index c3f8ee4..b1030c8 100644 --- a/src/lib/list.c +++ b/src/commonlib/list.c @@ -1,7 +1,7 @@ /* Taken from depthcharge: src/base/list.c */ /* SPDX-License-Identifier: GPL-2.0-or-later */
-#include <list.h> +#include <commonlib/list.h>
void list_remove(struct list_node *node) { diff --git a/src/include/device_tree.h b/src/include/device_tree.h index 02fcaa7..e7b79e1 100644 --- a/src/include/device_tree.h +++ b/src/include/device_tree.h @@ -6,7 +6,7 @@
#include <stddef.h> #include <stdint.h> -#include <list.h> +#include <commonlib/list.h>
/* * Flattened device tree structures/constants. diff --git a/src/include/fit.h b/src/include/fit.h index a1e970d..d587750 100644 --- a/src/include/fit.h +++ b/src/include/fit.h @@ -4,11 +4,11 @@ #ifndef __LIB_FIT_H__ #define __LIB_FIT_H__
+#include <commonlib/list.h> +#include <device_tree.h> +#include <program_loading.h> #include <stddef.h> #include <stdint.h> -#include <device_tree.h> -#include <list.h> -#include <program_loading.h>
struct fit_image_node { const char *name; diff --git a/src/lib/Makefile.mk b/src/lib/Makefile.mk index 2a95be9..fe24156 100644 --- a/src/lib/Makefile.mk +++ b/src/lib/Makefile.mk @@ -28,8 +28,6 @@ $(obj)/ramstage/lib/asan.o: CFLAGS_asan = endif
-all-y += list.c - decompressor-y += decompressor.c $(call src-to-obj,decompressor,$(dir)/decompressor.c): $(objcbfs)/bootblock.lz4 $(call src-to-obj,decompressor,$(dir)/decompressor.c): CCACHE_EXTRAFILES=$(objcbfs)/bootblock.lz4 diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c index 92a00e4..03624bf 100644 --- a/src/lib/cbfs.c +++ b/src/lib/cbfs.c @@ -6,10 +6,10 @@ #include <cbmem.h> #include <commonlib/bsd/cbfs_private.h> #include <commonlib/bsd/compression.h> +#include <commonlib/list.h> #include <console/console.h> #include <fmap.h> #include <lib.h> -#include <list.h> #include <metadata_hash.h> #include <security/tpm/tspi/crtm.h> #include <security/vboot/vboot_common.h> diff --git a/src/lib/edid_fill_fb.c b/src/lib/edid_fill_fb.c index 1df37e8..e4fb08c 100644 --- a/src/lib/edid_fill_fb.c +++ b/src/lib/edid_fill_fb.c @@ -6,7 +6,7 @@ #include <framebuffer_info.h> #include <string.h> #include <stdlib.h> -#include <list.h> +#include <commonlib/list.h>
struct fb_info { struct list_node node; diff --git a/tests/commonlib/Makefile.mk b/tests/commonlib/Makefile.mk index 6df1db8..55c3ddd 100644 --- a/tests/commonlib/Makefile.mk +++ b/tests/commonlib/Makefile.mk @@ -2,9 +2,13 @@
subdirs-y += bsd
+tests-y += list-test tests-y += rational-test tests-y += region-test
+list-test-srcs += tests/commonlib/list-test.c +list-test-srcs += src/commonlib/list.c + rational-test-srcs += tests/commonlib/rational-test.c rational-test-srcs += src/commonlib/rational.c
diff --git a/tests/lib/list-test.c b/tests/commonlib/list-test.c similarity index 98% rename from tests/lib/list-test.c rename to tests/commonlib/list-test.c index 39bfb17..4ca48a4 100644 --- a/tests/lib/list-test.c +++ b/tests/commonlib/list-test.c @@ -3,7 +3,7 @@ #include <tests/test.h> #include <stdlib.h> #include <string.h> -#include <list.h> +#include <commonlib/list.h>
struct test_container { int value; diff --git a/tests/lib/Makefile.mk b/tests/lib/Makefile.mk index b8c4c71..0177717 100644 --- a/tests/lib/Makefile.mk +++ b/tests/lib/Makefile.mk @@ -9,7 +9,6 @@ tests-y += edid-test tests-y += cbmem_console-romstage-test tests-y += cbmem_console-ramstage-test -tests-y += list-test tests-y += fmap-test tests-y += imd_cbmem-romstage-test tests-y += imd_cbmem-ramstage-test @@ -74,9 +73,6 @@ cbmem_console-ramstage-test-srcs += tests/lib/cbmem_console-test.c cbmem_console-ramstage-test-srcs += tests/stubs/console.c
-list-test-srcs += tests/lib/list-test.c -list-test-srcs += src/lib/list.c - fmap-test-srcs += tests/lib/fmap-test.c fmap-test-srcs += src/lib/fmap.c fmap-test-srcs += tests/stubs/console.c