diff --git a/arch/risc-v/src/Makefile b/arch/risc-v/src/Makefile index e7008106f4a..a6add5f5903 100644 --- a/arch/risc-v/src/Makefile +++ b/arch/risc-v/src/Makefile @@ -38,10 +38,9 @@ INCLUDES += ${shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip} INCLUDES += ${shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)common} INCLUDES += ${shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)$(ARCH_SUBDIR)} INCLUDES += ${shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)sched} -ifeq ($(CONFIG_OPENSBI),y) -INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)opensbi) +#ifeq ($(CONFIG_OPENSBI),y) INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)opensbi$(DELIM)opensbi-3rdparty$(DELIM)include) -endif +#endif CPPFLAGS += $(INCLUDES) CFLAGS += $(INCLUDES) diff --git a/arch/risc-v/src/mpfs/mpfs_opensbi.c b/arch/risc-v/src/mpfs/mpfs_opensbi.c index 442e820a366..f45ff512613 100644 --- a/arch/risc-v/src/mpfs/mpfs_opensbi.c +++ b/arch/risc-v/src/mpfs/mpfs_opensbi.c @@ -23,19 +23,24 @@ ****************************************************************************/ #include - #include #include #include - -#include "riscv_internal.h" -#include "riscv_arch.h" +#include #include #include #include #include +/* OpenSBI will also define NULL. Undefine NULL in order to avoid warning: + * 'warning: "NULL" redefined' + */ + +#ifdef NULL + #undef NULL +#endif + #include #include #include @@ -112,6 +117,16 @@ static int mpfs_irqchip_init(bool cold_boot); static int mpfs_ipi_init(bool cold_boot); static int mpfs_timer_init(bool cold_boot); +/**************************************************************************** + * Extern Function Declarations + ****************************************************************************/ + +/* riscv_internal.h cannot be included due to a number of redefinition + * conflicts. Thus, define the riscv_lowputc() with the extern definition. + */ + +extern void riscv_lowputc(char ch); + /**************************************************************************** * Private Data ****************************************************************************/ diff --git a/arch/risc-v/src/opensbi/Kconfig b/arch/risc-v/src/opensbi/Kconfig index 1c538be6b62..f24337e0b2f 100644 --- a/arch/risc-v/src/opensbi/Kconfig +++ b/arch/risc-v/src/opensbi/Kconfig @@ -9,4 +9,4 @@ config OPENSBI default n ---help--- Enable or disable Open Source Supervisor Binary Interface (OpenSBI) features - for RISC-V. + for RISC-V. diff --git a/arch/risc-v/src/opensbi/Make.defs b/arch/risc-v/src/opensbi/Make.defs index e9ca5d0a4a4..0e1d83fd0f7 100644 --- a/arch/risc-v/src/opensbi/Make.defs +++ b/arch/risc-v/src/opensbi/Make.defs @@ -37,8 +37,6 @@ OPENSBI_URL = https://github.com/riscv-software-src/opensbi/tarball OPENSBI_TARBALL = opensbi.tar.gz OPENSBI_DIR = riscv-software-src-opensbi-48f91ee -CFLAGS += -DOPENSBI_EXTERNAL_SBI_TYPES=nuttx_sbi_types.h - $(OPENSBI_TARBALL): $(Q) echo "Downloading: OpenSBI" $(Q) curl -L $(OPENSBI_URL)/$(OPENSBI_COMMIT) -o opensbi/$(OPENSBI_TARBALL) diff --git a/arch/risc-v/src/opensbi/nuttx_sbi_types.h b/arch/risc-v/src/opensbi/nuttx_sbi_types.h deleted file mode 100644 index e9636ed51e5..00000000000 --- a/arch/risc-v/src/opensbi/nuttx_sbi_types.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** - * arch/risc-v/src/opensbi/nuttx_sbi_types.h - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. The - * ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - ****************************************************************************/ - -#ifndef __ARCH_RISCV_SRC_OPENSBI_NUTTX_SBI_TYPES_H -#define __ARCH_RISCV_SRC_OPENSBI_NUTTX_SBI_TYPES_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include -#include - -#include -#include - -#include "riscv_internal.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define PRILX PRIxREG - -#define __packed end_packed_struct -#define __noreturn noreturn_function -#define __aligned(x) aligned_data(x) - -#define likely(x) __builtin_expect((x), 1) -#define unlikely(x) __builtin_expect((x), 0) - -#define array_size(x) (sizeof(x) / sizeof((x)[0])) - -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#define CLAMP(a, lo, hi) MIN(MAX(a, lo), hi) - -#define ROUNDUP(a, b) ((((a) - 1) / (b) + 1) * (b)) -#define ROUNDDOWN(a, b) ((a) / (b) * (b)) - -/**************************************************************************** - * Type Definitions - ****************************************************************************/ - -typedef int8_t s8; -typedef uint8_t u8; - -typedef int16_t s16; -typedef uint16_t u16; - -typedef int32_t s32; -typedef uint32_t u32; - -typedef int64_t s64; -typedef uint64_t u64; - -typedef uintptr_t virtual_addr_t; -typedef uintptr_t virtual_size_t; -typedef uintptr_t physical_addr_t; -typedef uintptr_t physical_size_t; - -#endif /* __ARCH_RISCV_SRC_OPENSBI_NUTTX_SBI_TYPES_H */