mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 23:41:23 +01:00
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>
|
#include <sbi/sbi_types.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_FDT_DOMAIN
|
||||||
|
|
||||||
struct sbi_domain;
|
struct sbi_domain;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,4 +72,11 @@ void fdt_domain_fixup(void *fdt);
|
|||||||
*/
|
*/
|
||||||
int fdt_domains_populate(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__ */
|
#endif /* __FDT_DOMAIN_H__ */
|
||||||
|
@@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
#include <sbi/sbi_types.h>
|
#include <sbi/sbi_types.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_FDT_PMU
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fix up the PMU node in the device tree
|
* 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);
|
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
|
#endif
|
||||||
|
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
menu "Utils and Drivers Support"
|
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/gpio/Kconfig"
|
||||||
|
|
||||||
source "$(OPENSBI_SRC_DIR)/lib/utils/i2c/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/irqchip/Kconfig"
|
||||||
|
|
||||||
|
source "$(OPENSBI_SRC_DIR)/lib/utils/libfdt/Kconfig"
|
||||||
|
|
||||||
source "$(OPENSBI_SRC_DIR)/lib/utils/reset/Kconfig"
|
source "$(OPENSBI_SRC_DIR)/lib/utils/reset/Kconfig"
|
||||||
|
|
||||||
source "$(OPENSBI_SRC_DIR)/lib/utils/serial/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>
|
# Copyright (C) 2020 Bin Meng <bmeng.cn@gmail.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
libsbiutils-objs-y += fdt/fdt_domain.o
|
libsbiutils-objs-$(CONFIG_FDT_DOMAIN) += fdt/fdt_domain.o
|
||||||
libsbiutils-objs-y += fdt/fdt_pmu.o
|
libsbiutils-objs-$(CONFIG_FDT_PMU) += fdt/fdt_pmu.o
|
||||||
libsbiutils-objs-y += fdt/fdt_helper.o
|
libsbiutils-objs-$(CONFIG_FDT) += fdt/fdt_helper.o
|
||||||
libsbiutils-objs-y += fdt/fdt_fixup.o
|
libsbiutils-objs-$(CONFIG_FDT) += fdt/fdt_fixup.o
|
||||||
|
@@ -4,6 +4,7 @@ menu "GPIO Support"
|
|||||||
|
|
||||||
config FDT_GPIO
|
config FDT_GPIO
|
||||||
bool "FDT based GPIO drivers"
|
bool "FDT based GPIO drivers"
|
||||||
|
depends on FDT
|
||||||
select GPIO
|
select GPIO
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
@@ -4,6 +4,7 @@ menu "I2C Support"
|
|||||||
|
|
||||||
config FDT_I2C
|
config FDT_I2C
|
||||||
bool "FDT based I2C drivers"
|
bool "FDT based I2C drivers"
|
||||||
|
depends on FDT
|
||||||
select I2C
|
select I2C
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
@@ -4,6 +4,7 @@ menu "IPI Device Support"
|
|||||||
|
|
||||||
config FDT_IPI
|
config FDT_IPI
|
||||||
bool "FDT based ipi drivers"
|
bool "FDT based ipi drivers"
|
||||||
|
depends on FDT
|
||||||
default n
|
default n
|
||||||
|
|
||||||
if FDT_IPI
|
if FDT_IPI
|
||||||
|
@@ -4,6 +4,7 @@ menu "Interrupt Controller Support"
|
|||||||
|
|
||||||
config FDT_IRQCHIP
|
config FDT_IRQCHIP
|
||||||
bool "FDT based interrupt controller drivers"
|
bool "FDT based interrupt controller drivers"
|
||||||
|
depends on FDT
|
||||||
default n
|
default n
|
||||||
|
|
||||||
if FDT_IRQCHIP
|
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), \
|
$(foreach file, $(libfdt_files), \
|
||||||
$(eval CFLAGS_$(file) = -I$(src)/../../utils/libfdt))
|
$(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/
|
libsbiutils-genflags-y += -I$(libsbiutils_dir)/libfdt/
|
||||||
|
@@ -4,6 +4,7 @@ menu "System Reset Support"
|
|||||||
|
|
||||||
config FDT_RESET
|
config FDT_RESET
|
||||||
bool "FDT based reset drivers"
|
bool "FDT based reset drivers"
|
||||||
|
depends on FDT
|
||||||
default n
|
default n
|
||||||
|
|
||||||
if FDT_RESET
|
if FDT_RESET
|
||||||
|
@@ -4,6 +4,7 @@ menu "Serial Device Support"
|
|||||||
|
|
||||||
config FDT_SERIAL
|
config FDT_SERIAL
|
||||||
bool "FDT based serial drivers"
|
bool "FDT based serial drivers"
|
||||||
|
depends on FDT
|
||||||
default n
|
default n
|
||||||
|
|
||||||
if FDT_SERIAL
|
if FDT_SERIAL
|
||||||
|
@@ -4,6 +4,7 @@ menu "Timer Device Support"
|
|||||||
|
|
||||||
config FDT_TIMER
|
config FDT_TIMER
|
||||||
bool "FDT based timer drivers"
|
bool "FDT based timer drivers"
|
||||||
|
depends on FDT
|
||||||
default n
|
default n
|
||||||
|
|
||||||
if FDT_TIMER
|
if FDT_TIMER
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
config PLATFORM_ANDES_AE350
|
config PLATFORM_ANDES_AE350
|
||||||
bool
|
bool
|
||||||
|
select FDT
|
||||||
select IRQCHIP_PLIC
|
select IRQCHIP_PLIC
|
||||||
select SERIAL_UART8250
|
select SERIAL_UART8250
|
||||||
default y
|
default y
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
config PLATFORM_ARIANE_FPGA
|
config PLATFORM_ARIANE_FPGA
|
||||||
bool
|
bool
|
||||||
|
select FDT
|
||||||
select IPI_MSWI
|
select IPI_MSWI
|
||||||
select IRQCHIP_PLIC
|
select IRQCHIP_PLIC
|
||||||
select SERIAL_UART8250
|
select SERIAL_UART8250
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
config PLATFORM_OPENPITON_FPGA
|
config PLATFORM_OPENPITON_FPGA
|
||||||
bool
|
bool
|
||||||
|
select FDT
|
||||||
select IPI_MSWI
|
select IPI_MSWI
|
||||||
select IRQCHIP_PLIC
|
select IRQCHIP_PLIC
|
||||||
select SERIAL_UART8250
|
select SERIAL_UART8250
|
||||||
|
@@ -2,4 +2,7 @@
|
|||||||
|
|
||||||
config PLATFORM_GENERIC
|
config PLATFORM_GENERIC
|
||||||
bool
|
bool
|
||||||
|
select FDT
|
||||||
|
select FDT_DOMAIN
|
||||||
|
select FDT_PMU
|
||||||
default y
|
default y
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
config PLATFORM_KENDRYTE_K210
|
config PLATFORM_KENDRYTE_K210
|
||||||
bool
|
bool
|
||||||
|
select FDT
|
||||||
select IPI_MSWI
|
select IPI_MSWI
|
||||||
select IRQCHIP_PLIC
|
select IRQCHIP_PLIC
|
||||||
select SERIAL_SIFIVE
|
select SERIAL_SIFIVE
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
config PLATFORM_NUCLEI_UX600
|
config PLATFORM_NUCLEI_UX600
|
||||||
bool
|
bool
|
||||||
|
select FDT
|
||||||
select IPI_MSWI
|
select IPI_MSWI
|
||||||
select IRQCHIP_PLIC
|
select IRQCHIP_PLIC
|
||||||
select SERIAL_SIFIVE
|
select SERIAL_SIFIVE
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
* hqfang <578567190@qq.com>
|
* hqfang <578567190@qq.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <libfdt.h>
|
|
||||||
#include <sbi/riscv_asm.h>
|
#include <sbi/riscv_asm.h>
|
||||||
#include <sbi/riscv_io.h>
|
#include <sbi/riscv_io.h>
|
||||||
#include <sbi/riscv_encoding.h>
|
#include <sbi/riscv_encoding.h>
|
||||||
|
Reference in New Issue
Block a user