Skip to content

Commit

Permalink
riscv_internal.h: Remove riscv_sbi.h from the file
Browse files Browse the repository at this point in the history
riscv_internal.h is used literally everywhere, while the SBI definitions
are needed only by whomever needs the services.

Having the SBI definitions:
a) Copied from OpenSBI (why has this been done? even the names are same)
b) Presented publicly to 99% of risc-v modules

creates a build error when building with OpenSBI, due to duplicate
definitions of the SBI service identifiers:

In file included from /nuttx/arch/risc-v/src/common/riscv_internal.h:40,
                 from /nuttx/arch/risc-v/src/chip/chip.h:32,
                 from board/mpfs_domain.c:30:
/nuttx/arch/risc-v/src/common/riscv_sbi.h:36: error: "SBI_EXT_BASE" redefined [-Werror]
   36 | #define SBI_EXT_BASE            0x00000010

and so forth...

Fix this by removing riscv_sbi.h i.e. not exposing the ABI publicly.
  • Loading branch information
pussuw authored and xiaoxiang781216 committed Oct 8, 2024
1 parent f26ae83 commit e5aef87
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion arch/risc-v/src/common/riscv_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

#include <nuttx/irq.h>

#include "riscv_sbi.h"
#include "riscv_common_memorymap.h"

/****************************************************************************
Expand Down
1 change: 1 addition & 0 deletions arch/risc-v/src/common/riscv_ipi.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
****************************************************************************/

#include "riscv_internal.h"
#include "riscv_sbi.h"
#include "chip.h"

/****************************************************************************
Expand Down
3 changes: 2 additions & 1 deletion arch/risc-v/src/common/riscv_mtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@

#include <arch/barriers.h>

#include "riscv_mtimer.h"
#include "riscv_internal.h"
#include "riscv_mtimer.h"
#include "riscv_sbi.h"

/****************************************************************************
* Private Types
Expand Down
1 change: 1 addition & 0 deletions arch/risc-v/src/nuttsbi/sbi_mcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <stdint.h>

#include "riscv_internal.h"
#include "riscv_sbi.h"

#include "sbi_mcall.h"
#include "sbi_internal.h"
Expand Down
3 changes: 2 additions & 1 deletion arch/risc-v/src/qemu-rv/qemu_rv_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include <debug.h>
#include "riscv_internal.h"
#include "riscv_sbi.h"
#include "chip.h"

#include "qemu_rv_userspace.h"
Expand Down Expand Up @@ -253,4 +254,4 @@ void sbi_late_initialize(void)
riscv_append_pmp_region(NAPOT_RW, 0, SIZE_HALF);
riscv_append_pmp_region(NAPOT_RWX, SIZE_HALF, SIZE_HALF);
}
#endif
#endif
1 change: 1 addition & 0 deletions boards/risc-v/qemu-rv/rv-virt/src/qemu_rv_appinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "qemu_rv_rptun.h"

#include "riscv_internal.h"
#include "riscv_sbi.h"
#include "romfs.h"

#ifdef CONFIG_USERLED
Expand Down

0 comments on commit e5aef87

Please sign in to comment.