forked from Mirrors/opensbi
lib: utils/fdt: Use kconfig for enabling/disabling
We update FDT support makefile to use kconfig for enabling/disabling. To avoid compilation errors, we also enable FDT for each platform. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Tested-by: Andrew Jones <ajones@ventanamicro.com> Acked-by: Atish Patra <atishp@rivosinc.com> Tested-by: Atish Patra <atishp@rivosinc.com>
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
|
||||
#include <sbi/sbi_types.h>
|
||||
|
||||
#ifdef CONFIG_FDT_DOMAIN
|
||||
|
||||
struct sbi_domain;
|
||||
|
||||
/**
|
||||
@@ -70,4 +72,11 @@ void fdt_domain_fixup(void *fdt);
|
||||
*/
|
||||
int fdt_domains_populate(void *fdt);
|
||||
|
||||
#else
|
||||
|
||||
static inline void fdt_domain_fixup(void *fdt) { }
|
||||
static inline int fdt_domains_populate(void *fdt) { return 0; }
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __FDT_DOMAIN_H__ */
|
||||
|
@@ -13,6 +13,8 @@
|
||||
|
||||
#include <sbi/sbi_types.h>
|
||||
|
||||
#ifdef CONFIG_FDT_PMU
|
||||
|
||||
/**
|
||||
* Fix up the PMU node in the device tree
|
||||
*
|
||||
@@ -43,4 +45,12 @@ int fdt_pmu_setup(void *fdt);
|
||||
*/
|
||||
uint64_t fdt_pmu_get_select_value(uint32_t event_idx);
|
||||
|
||||
#else
|
||||
|
||||
static inline void fdt_pmu_fixup(void *fdt) { }
|
||||
static inline int fdt_pmu_setup(void *fdt) { return 0; }
|
||||
static inline uint64_t fdt_pmu_get_select_value(uint32_t event_idx) { return 0; }
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -2,6 +2,8 @@
|
||||
|
||||
menu "Utils and Drivers Support"
|
||||
|
||||
source "$(OPENSBI_SRC_DIR)/lib/utils/fdt/Kconfig"
|
||||
|
||||
source "$(OPENSBI_SRC_DIR)/lib/utils/gpio/Kconfig"
|
||||
|
||||
source "$(OPENSBI_SRC_DIR)/lib/utils/i2c/Kconfig"
|
||||
@@ -10,6 +12,8 @@ source "$(OPENSBI_SRC_DIR)/lib/utils/ipi/Kconfig"
|
||||
|
||||
source "$(OPENSBI_SRC_DIR)/lib/utils/irqchip/Kconfig"
|
||||
|
||||
source "$(OPENSBI_SRC_DIR)/lib/utils/libfdt/Kconfig"
|
||||
|
||||
source "$(OPENSBI_SRC_DIR)/lib/utils/reset/Kconfig"
|
||||
|
||||
source "$(OPENSBI_SRC_DIR)/lib/utils/serial/Kconfig"
|
||||
|
18
lib/utils/fdt/Kconfig
Normal file
18
lib/utils/fdt/Kconfig
Normal file
@@ -0,0 +1,18 @@
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
menuconfig FDT
|
||||
bool "Flattened Device Tree (FDT) support"
|
||||
select LIBFDT
|
||||
default n
|
||||
|
||||
if FDT
|
||||
|
||||
config FDT_DOMAIN
|
||||
bool "FDT domain support"
|
||||
default n
|
||||
|
||||
config FDT_PMU
|
||||
bool "FDT performance monitoring unit (PMU) support"
|
||||
default n
|
||||
|
||||
endif
|
@@ -4,7 +4,7 @@
|
||||
# Copyright (C) 2020 Bin Meng <bmeng.cn@gmail.com>
|
||||
#
|
||||
|
||||
libsbiutils-objs-y += fdt/fdt_domain.o
|
||||
libsbiutils-objs-y += fdt/fdt_pmu.o
|
||||
libsbiutils-objs-y += fdt/fdt_helper.o
|
||||
libsbiutils-objs-y += fdt/fdt_fixup.o
|
||||
libsbiutils-objs-$(CONFIG_FDT_DOMAIN) += fdt/fdt_domain.o
|
||||
libsbiutils-objs-$(CONFIG_FDT_PMU) += fdt/fdt_pmu.o
|
||||
libsbiutils-objs-$(CONFIG_FDT) += fdt/fdt_helper.o
|
||||
libsbiutils-objs-$(CONFIG_FDT) += fdt/fdt_fixup.o
|
||||
|
@@ -4,6 +4,7 @@ menu "GPIO Support"
|
||||
|
||||
config FDT_GPIO
|
||||
bool "FDT based GPIO drivers"
|
||||
depends on FDT
|
||||
select GPIO
|
||||
default n
|
||||
|
||||
|
@@ -4,6 +4,7 @@ menu "I2C Support"
|
||||
|
||||
config FDT_I2C
|
||||
bool "FDT based I2C drivers"
|
||||
depends on FDT
|
||||
select I2C
|
||||
default n
|
||||
|
||||
|
@@ -4,6 +4,7 @@ menu "IPI Device Support"
|
||||
|
||||
config FDT_IPI
|
||||
bool "FDT based ipi drivers"
|
||||
depends on FDT
|
||||
default n
|
||||
|
||||
if FDT_IPI
|
||||
|
@@ -4,6 +4,7 @@ menu "Interrupt Controller Support"
|
||||
|
||||
config FDT_IRQCHIP
|
||||
bool "FDT based interrupt controller drivers"
|
||||
depends on FDT
|
||||
default n
|
||||
|
||||
if FDT_IRQCHIP
|
||||
|
5
lib/utils/libfdt/Kconfig
Normal file
5
lib/utils/libfdt/Kconfig
Normal file
@@ -0,0 +1,5 @@
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
config LIBFDT
|
||||
bool
|
||||
default n
|
@@ -12,5 +12,5 @@ libfdt_files = fdt.o fdt_addresses.o fdt_check.o fdt_empty_tree.o fdt_ro.o fdt_r
|
||||
$(foreach file, $(libfdt_files), \
|
||||
$(eval CFLAGS_$(file) = -I$(src)/../../utils/libfdt))
|
||||
|
||||
libsbiutils-objs-y += $(addprefix libfdt/,$(libfdt_files))
|
||||
libsbiutils-objs-$(CONFIG_LIBFDT) += $(addprefix libfdt/,$(libfdt_files))
|
||||
libsbiutils-genflags-y += -I$(libsbiutils_dir)/libfdt/
|
||||
|
@@ -4,6 +4,7 @@ menu "System Reset Support"
|
||||
|
||||
config FDT_RESET
|
||||
bool "FDT based reset drivers"
|
||||
depends on FDT
|
||||
default n
|
||||
|
||||
if FDT_RESET
|
||||
|
@@ -4,6 +4,7 @@ menu "Serial Device Support"
|
||||
|
||||
config FDT_SERIAL
|
||||
bool "FDT based serial drivers"
|
||||
depends on FDT
|
||||
default n
|
||||
|
||||
if FDT_SERIAL
|
||||
|
@@ -4,6 +4,7 @@ menu "Timer Device Support"
|
||||
|
||||
config FDT_TIMER
|
||||
bool "FDT based timer drivers"
|
||||
depends on FDT
|
||||
default n
|
||||
|
||||
if FDT_TIMER
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
config PLATFORM_ANDES_AE350
|
||||
bool
|
||||
select FDT
|
||||
select IRQCHIP_PLIC
|
||||
select SERIAL_UART8250
|
||||
default y
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
config PLATFORM_ARIANE_FPGA
|
||||
bool
|
||||
select FDT
|
||||
select IPI_MSWI
|
||||
select IRQCHIP_PLIC
|
||||
select SERIAL_UART8250
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
config PLATFORM_OPENPITON_FPGA
|
||||
bool
|
||||
select FDT
|
||||
select IPI_MSWI
|
||||
select IRQCHIP_PLIC
|
||||
select SERIAL_UART8250
|
||||
|
@@ -2,4 +2,7 @@
|
||||
|
||||
config PLATFORM_GENERIC
|
||||
bool
|
||||
select FDT
|
||||
select FDT_DOMAIN
|
||||
select FDT_PMU
|
||||
default y
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
config PLATFORM_KENDRYTE_K210
|
||||
bool
|
||||
select FDT
|
||||
select IPI_MSWI
|
||||
select IRQCHIP_PLIC
|
||||
select SERIAL_SIFIVE
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
config PLATFORM_NUCLEI_UX600
|
||||
bool
|
||||
select FDT
|
||||
select IPI_MSWI
|
||||
select IRQCHIP_PLIC
|
||||
select SERIAL_SIFIVE
|
||||
|
@@ -8,7 +8,6 @@
|
||||
* hqfang <578567190@qq.com>
|
||||
*/
|
||||
|
||||
#include <libfdt.h>
|
||||
#include <sbi/riscv_asm.h>
|
||||
#include <sbi/riscv_io.h>
|
||||
#include <sbi/riscv_encoding.h>
|
||||
|
Reference in New Issue
Block a user