mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-10-22 20:02:04 +01:00
platform: Move platform common to lib/utils.
Currently, platform/common contains platform/non-platform specific common minimal drivers and libraries. This is helpful is all platforms are built within opensbi framework. Move them to lib/utils so that any external platform code also can reuse the minimalistic drivers or other common libraries. This patch doesn't introduce any functional changes. Signed-off-by: Atish Patra <atish.patra@wdc.com> Acked-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
1 parent
98aaf8317b
commit
793e5e1184
38 files changed
+48
-38
No files matched your search
@@ -57,9 +57,9 @@ endif
|
||||
export platform_subdir=$(PLATFORM)
|
||||
export platform_src_dir=$(platform_parent_dir)/$(platform_subdir)
|
||||
export platform_build_dir=$(build_dir)/platform/$(platform_subdir)
|
||||
export platform_common_src_dir=$(src_dir)/platform/common
|
||||
export include_dir=$(CURDIR)/include
|
||||
export libsbi_dir=$(CURDIR)/lib/sbi
|
||||
export libsbiutils_dir=$(CURDIR)/lib/utils
|
||||
export firmware_dir=$(CURDIR)/firmware
|
||||
|
||||
# Find library version
|
||||
@@ -98,9 +98,9 @@ endif
|
||||
# Setup list of objects.mk files
|
||||
ifdef PLATFORM
|
||||
platform-object-mks=$(shell if [ -d $(platform_src_dir)/ ]; then find $(platform_src_dir) -iname "objects.mk" | sort -r; fi)
|
||||
platform-common-object-mks=$(shell if [ -d $(platform_common_src_dir) ]; then find $(platform_common_src_dir) -iname "objects.mk" | sort -r; fi)
|
||||
endif
|
||||
libsbi-object-mks=$(shell if [ -d $(libsbi_dir) ]; then find $(libsbi_dir) -iname "objects.mk" | sort -r; fi)
|
||||
libsbiutils-object-mks=$(shell if [ -d $(libsbiutils_dir) ]; then find $(libsbiutils_dir) -iname "objects.mk" | sort -r; fi)
|
||||
firmware-object-mks=$(shell if [ -d $(firmware_dir) ]; then find $(firmware_dir) -iname "objects.mk" | sort -r; fi)
|
||||
|
||||
# Include platform specifig config.mk
|
||||
@@ -111,17 +111,17 @@ endif
|
||||
# Include all object.mk files
|
||||
ifdef PLATFORM
|
||||
include $(platform-object-mks)
|
||||
include $(platform-common-object-mks)
|
||||
endif
|
||||
include $(libsbi-object-mks)
|
||||
include $(libsbiutils-object-mks)
|
||||
include $(firmware-object-mks)
|
||||
|
||||
# Setup list of objects
|
||||
libsbi-objs-path-y=$(foreach obj,$(libsbi-objs-y),$(build_dir)/lib/sbi/$(obj))
|
||||
libsbiutils-objs-path-y=$(foreach obj,$(libsbiutils-objs-y),$(build_dir)/lib/utils/$(obj))
|
||||
ifdef PLATFORM
|
||||
platform-objs-path-y=$(foreach obj,$(platform-objs-y),$(platform_build_dir)/$(obj))
|
||||
platform-dtb-path-y=$(foreach obj,$(platform-dtb-y),$(platform_build_dir)/$(obj))
|
||||
platform-common-objs-path-y=$(foreach obj,$(platform-common-objs-y),$(build_dir)/platform/common/$(obj))
|
||||
firmware-bins-path-y=$(foreach bin,$(firmware-bins-y),$(platform_build_dir)/firmware/$(bin))
|
||||
endif
|
||||
firmware-elfs-path-y=$(firmware-bins-path-y:.bin=.elf)
|
||||
@@ -129,8 +129,8 @@ firmware-objs-path-y=$(firmware-bins-path-y:.bin=.o)
|
||||
|
||||
# Setup list of deps files for objects
|
||||
deps-y=$(platform-objs-path-y:.o=.dep)
|
||||
deps-y+=$(platform-common-objs-path-y:.o=.dep)
|
||||
deps-y+=$(libsbi-objs-path-y:.o=.dep)
|
||||
deps-y+=$(libsbiutils-objs-path-y:.o=.dep)
|
||||
deps-y+=$(firmware-objs-path-y:.o=.dep)
|
||||
|
||||
# Setup platform ABI, ISA and Code Model
|
||||
@@ -150,9 +150,8 @@ endif
|
||||
|
||||
# Setup compilation commands flags
|
||||
GENFLAGS = -I$(platform_src_dir)/include
|
||||
GENFLAGS += -I$(platform_common_src_dir)/include
|
||||
GENFLAGS += -I$(include_dir)
|
||||
GENFLAGS += $(platform-common-genflags-y)
|
||||
GENFLAGS += $(libsbiutils-genflags-y)
|
||||
GENFLAGS += $(platform-genflags-y)
|
||||
GENFLAGS += $(firmware-genflags-y)
|
||||
|
||||
@@ -254,6 +253,7 @@ compile_dts = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
|
||||
$(DTC) $(DTCFLAGS) -o $(1) $(2)
|
||||
|
||||
targets-y = $(build_dir)/lib/libsbi.a
|
||||
targets-y += $(build_dir)/lib/libsbiutils.a
|
||||
ifdef PLATFORM
|
||||
targets-y += $(platform_build_dir)/lib/libplatsbi.a
|
||||
targets-y += $(platform-dtb-path-y)
|
||||
@@ -279,7 +279,10 @@ $(platform_build_dir)/%.ld: $(src_dir)/%.ldS
|
||||
$(build_dir)/lib/libsbi.a: $(libsbi-objs-path-y)
|
||||
$(call compile_ar,$@,$^)
|
||||
|
||||
$(platform_build_dir)/lib/libplatsbi.a: $(libsbi-objs-path-y) $(platform-common-objs-path-y) $(platform-objs-path-y)
|
||||
$(build_dir)/lib/libsbiutils.a: $(libsbi-objs-path-y) $(libsbiutils-objs-path-y)
|
||||
$(call compile_ar,$@,$^)
|
||||
|
||||
$(platform_build_dir)/lib/libplatsbi.a: $(libsbi-objs-path-y) $(libsbiutils-objs-path-y) $(platform-objs-path-y)
|
||||
$(call compile_ar,$@,$^)
|
||||
|
||||
$(build_dir)/%.dep: $(src_dir)/%.c
|
||||
@@ -359,6 +362,7 @@ endif
|
||||
endif
|
||||
|
||||
install_targets-y = install_libsbi
|
||||
install_targets-y += install_libsbiutils
|
||||
ifdef PLATFORM
|
||||
install_targets-y += install_libplatsbi
|
||||
install_targets-y += install_firmwares
|
||||
@@ -373,12 +377,17 @@ install_libsbi: $(build_dir)/lib/libsbi.a
|
||||
$(call inst_header_dir,$(install_dir)/include,$(include_dir)/sbi)
|
||||
$(call inst_file,$(install_dir)/lib/libsbi.a,$(build_dir)/lib/libsbi.a)
|
||||
|
||||
.PHONY: install_libsbiutils
|
||||
install_libsbiutils: $(build_dir)/lib/libsbiutils.a
|
||||
$(call inst_header_dir,$(install_dir)/include,$(include_dir)/sbi_utils)
|
||||
$(call inst_file,$(install_dir)/lib/libsbiutils.a,$(build_dir)/lib/libsbiutils.a)
|
||||
|
||||
.PHONY: install_libplatsbi
|
||||
install_libplatsbi: $(platform_build_dir)/lib/libplatsbi.a $(build_dir)/lib/libsbi.a
|
||||
install_libplatsbi: $(platform_build_dir)/lib/libplatsbi.a $(build_dir)/lib/libsbi.a $(build_dir)/lib/libsbiutils.a
|
||||
$(call inst_file,$(install_dir)/platform/$(platform_subdir)/lib/libplatsbi.a,$(platform_build_dir)/lib/libplatsbi.a)
|
||||
|
||||
.PHONY: install_firmwares
|
||||
install_firmwares: $(platform_build_dir)/lib/libplatsbi.a $(build_dir)/lib/libsbi.a $(firmware-bins-path-y)
|
||||
install_firmwares: $(platform_build_dir)/lib/libplatsbi.a $(build_dir)/lib/libsbi.a $(build_dir)/lib/libsbiutils.a $(firmware-bins-path-y)
|
||||
$(call inst_file_list,$(install_dir),$(build_dir),platform/$(platform_subdir)/firmware,$(firmware-elfs-path-y))
|
||||
$(call inst_file_list,$(install_dir),$(build_dir),platform/$(platform_subdir)/firmware,$(firmware-bins-path-y))
|
||||
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -7,4 +7,4 @@
|
||||
# Anup Patel <anup.patel@wdc.com>
|
||||
#
|
||||
|
||||
platform-common-objs-$(PLATFORM_IRQCHIP_PLIC) += irqchip/plic.o
|
||||
libsbiutils-objs-$(PLATFORM_IRQCHIP_PLIC) += irqchip/plic.o
|
||||
@@ -11,8 +11,8 @@
|
||||
#include <sbi/riscv_encoding.h>
|
||||
#include <sbi/sbi_console.h>
|
||||
#include <sbi/string.h>
|
||||
#include <plat/tinyfdt.h>
|
||||
#include <plat/irqchip/plic.h>
|
||||
#include <sbi_utils/tinyfdt.h>
|
||||
#include <sbi_utils/irqchip/plic.h>
|
||||
|
||||
#define PLIC_PRIORITY_BASE 0x0
|
||||
#define PLIC_PENDING_BASE 0x1000
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -58,8 +58,6 @@
|
||||
#define INT_MAX ((int)(~0U >> 1))
|
||||
#define UINT_MAX ((unsigned int)~0U)
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __CHECKER__
|
||||
#define FDT_FORCE __attribute__((force))
|
||||
#define FDT_BITWISE __attribute__((bitwise))
|
||||
File renamed without changes.
@@ -10,7 +10,7 @@
|
||||
libfdt_files = fdt.o fdt_ro.o fdt_wip.o fdt_rw.o fdt_sw.o fdt_strerror.o \
|
||||
fdt_empty_tree.o
|
||||
$(foreach file, $(libfdt_files), \
|
||||
$(eval CFLAGS_$(file) = -I$(src)/../../common/libfdt))
|
||||
$(eval CFLAGS_$(file) = -I$(src)/../../utils/libfdt))
|
||||
|
||||
platform-common-objs-$(PLATFORM_INCLUDE_LIBFDT) += $(addprefix libfdt/,$(libfdt_files))
|
||||
platform-common-genflags-$(PLATFORM_INCLUDE_LIBFDT) += -I$(platform_common_src_dir)/libfdt/
|
||||
libsbiutils-objs-$(PLATFORM_INCLUDE_LIBFDT) += $(addprefix libfdt/,$(libfdt_files))
|
||||
libsbiutils-genflags-$(PLATFORM_INCLUDE_LIBFDT) += -I$(libsbiutils_dir)/libfdt/
|
||||
File renamed without changes.
@@ -7,4 +7,4 @@
|
||||
# Anup Patel <anup.patel@wdc.com>
|
||||
#
|
||||
|
||||
platform-common-objs-y += tinyfdt.o
|
||||
libsbiutils-objs-y += tinyfdt.o
|
||||
@@ -7,5 +7,5 @@
|
||||
# Anup Patel <anup.patel@wdc.com>
|
||||
#
|
||||
|
||||
platform-common-objs-$(PLATFORM_SERIAL_UART8250) += serial/uart8250.o
|
||||
platform-common-objs-$(PLATFORM_SERIAL_SIFIVE_UART) += serial/sifive-uart.o
|
||||
libsbiutils-objs-$(PLATFORM_SERIAL_UART8250) += serial/uart8250.o
|
||||
libsbiutils-objs-$(PLATFORM_SERIAL_SIFIVE_UART) += serial/sifive-uart.o
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <sbi/riscv_io.h>
|
||||
#include <sbi/sbi_console.h>
|
||||
#include <plat/serial/sifive-uart.h>
|
||||
#include <sbi_utils/serial/sifive-uart.h>
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <sbi/riscv_io.h>
|
||||
#include <plat/serial/uart8250.h>
|
||||
#include <sbi_utils/serial/uart8250.h>
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <sbi/riscv_io.h>
|
||||
#include <sbi/riscv_atomic.h>
|
||||
#include <sbi/sbi_hart.h>
|
||||
#include <plat/sys/clint.h>
|
||||
#include <sbi_utils/sys/clint.h>
|
||||
|
||||
static u32 clint_ipi_hart_count;
|
||||
static volatile void *clint_ipi_base;
|
||||
@@ -7,4 +7,4 @@
|
||||
# Anup Patel <anup.patel@wdc.com>
|
||||
#
|
||||
|
||||
platform-common-objs-$(PLATFORM_SYS_CLINT) += sys/clint.o
|
||||
libsbiutils-objs-$(PLATFORM_SYS_CLINT) += sys/clint.o
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <sbi/string.h>
|
||||
#include <plat/tinyfdt.h>
|
||||
#include <sbi_utils/tinyfdt.h>
|
||||
|
||||
#define FDT_MAGIC 0xd00dfeed
|
||||
#define FDT_VERSION 17
|
||||
@@ -12,8 +12,8 @@
|
||||
#include <sbi/sbi_hart.h>
|
||||
#include <sbi/sbi_platform.h>
|
||||
#include <sbi/sbi_console.h>
|
||||
#include <plat/irqchip/plic.h>
|
||||
#include <plat/sys/clint.h>
|
||||
#include <sbi_utils/irqchip/plic.h>
|
||||
#include <sbi_utils/sys/clint.h>
|
||||
#include "platform.h"
|
||||
#include "uarths.h"
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
#include <sbi/sbi_const.h>
|
||||
#include <sbi/sbi_hart.h>
|
||||
#include <sbi/sbi_platform.h>
|
||||
#include <plat/irqchip/plic.h>
|
||||
#include <plat/serial/sifive-uart.h>
|
||||
#include <plat/sys/clint.h>
|
||||
#include <sbi_utils/irqchip/plic.h>
|
||||
#include <sbi_utils/serial/sifive-uart.h>
|
||||
#include <sbi_utils/sys/clint.h>
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
#include <sbi/sbi_const.h>
|
||||
#include <sbi/sbi_hart.h>
|
||||
#include <sbi/sbi_platform.h>
|
||||
#include <plat/irqchip/plic.h>
|
||||
#include <plat/serial/uart8250.h>
|
||||
#include <plat/sys/clint.h>
|
||||
#include <sbi_utils/irqchip/plic.h>
|
||||
#include <sbi_utils/serial/uart8250.h>
|
||||
#include <sbi_utils/sys/clint.h>
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
#include <sbi/sbi_console.h>
|
||||
#include <sbi/sbi_platform.h>
|
||||
#include <sbi/riscv_io.h>
|
||||
#include <plat/irqchip/plic.h>
|
||||
#include <plat/serial/sifive-uart.h>
|
||||
#include <plat/sys/clint.h>
|
||||
#include <sbi_utils/irqchip/plic.h>
|
||||
#include <sbi_utils/serial/sifive-uart.h>
|
||||
#include <sbi_utils/sys/clint.h>
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
|
||||
@@ -103,10 +103,13 @@ esac
|
||||
# Ensure output directory is present
|
||||
mkdir -p "${BUILD_OUTPUT_PATH}"
|
||||
|
||||
# Do a clean build first
|
||||
make distclean
|
||||
|
||||
# Build and install generic library
|
||||
echo "Build and install generic library XLEN=${BUILD_RISCV_XLEN}"
|
||||
echo ""
|
||||
make -C "${BUILD_OPENSBI_SOURCE_PATH}" O="${BUILD_OUTPUT_PATH}" I="${BUILD_OUTPUT_PATH}/${BUILD_ARCHIVE_NAME}" PLATFORM_RISCV_XLEN="${BUILD_RISCV_XLEN}" install_libsbi -j "${BUILD_NUM_THREADS}"
|
||||
make -C "${BUILD_OPENSBI_SOURCE_PATH}" O="${BUILD_OUTPUT_PATH}" I="${BUILD_OUTPUT_PATH}/${BUILD_ARCHIVE_NAME}" PLATFORM_RISCV_XLEN="${BUILD_RISCV_XLEN}" install_libsbi install_libsbiutils -j "${BUILD_NUM_THREADS}"
|
||||
echo ""
|
||||
|
||||
# Build and install relevant platforms
|
||||
|
||||
Reference in new issue
Block a user