lib: Use available hart mask for correct hbase value
As per the latest SBI specification, all online harts should receive IPI if hbase is set to -1. Set the target mask to all available hart mask if hbase is -1. Signed-off-by: Atish Patra <firstname.lastname@example.org> Reviewed-by: Anup Patel <email@example.com>
|2 days ago|
|docs||4 days ago|
|firmware||1 month ago|
|include||4 days ago|
|lib||1 day ago|
|platform||4 days ago|
|scripts||6 days ago|
|.clang-format||10 months ago|
|.gitignore||11 months ago|
|CONTRIBUTORS.md||8 months ago|
|COPYING.BSD||10 months ago|
|Makefile||2 weeks ago|
|README.md||5 months ago|
|ThirdPartyNotices.md||5 days ago|
Copyright (c) 2019 Western Digital Corporation or its affiliates and other contributors.
The RISC-V Supervisor Binary Interface (SBI) is the recommended interface between:
The goal of the OpenSBI project is to provide an open-source reference implementation of the RISC-V SBI specifications for platform-specific firmwares executing in M-mode (case 1 mentioned above). An OpenSBI implementation can be easily extended by RISC-V platform and system-on-chip vendors to fit a particular hardware configuration.
The main component of OpenSBI is provided in the form of a platform-independent static library libsbi.a implementing the SBI interface. A firmware or bootloader implementation can link against this library to ensure conformance with the SBI interface specifications. libsbi.a also defines an interface for integrating with platform-specific operations provided by the platform firmware implementation (e.g. console access functions, inter-processor interrupt control, etc).
To illustrate the use of the libsbi.a library, OpenSBI also provides a set of platform-specific support examples. For each example, a platform-specific static library libplatsbi.a can be compiled. This library implements SBI call processing by integrating libsbi.a with the necessary platform-dependent hardware manipulation functions. For all supported platforms, OpenSBI also provides several runtime firmware examples built using the platform libplatsbi.a. These example firmwares can be used to replace the legacy riscv-pk bootloader (aka BBL) and enable the use of well-known bootloaders such as U-Boot (https://git.denx.de/u-boot.git).
OpenSBI can be compiled natively or cross-compiled on a x86 host. For cross-compilation, you can build your own toolchain or just download a prebuilt one from the [Bootlin toolchain repository] (https://toolchains.bootlin.com/).
Please note that only a 64-bit version of the toolchain is available in the Bootlin toolchain repository for now.
The OpenSBI platform-independent static library libsbi.a can be compiled natively or it can be cross-compiled on a host with a different base architecture than RISC-V.
For cross-compiling, the environment variable CROSS_COMPILE must be defined to specify the name prefix of the RISC-V compiler toolchain executables, e.g. riscv64-unknown-elf- if the gcc executable used is riscv64-unknown-elf-gcc.
To build libsbi.a simply execute:
All compiled binaries as well as the resulting libsbi.a static library file will be placed in the build/lib directory. To specify an alternate build root directory path, run:
To generate files to be installed for using libsbi.a in other projects, run:
This will create the install directory with all necessary include files copied under the install/include directory and the library file copied into the install/lib directory. To specify an alternate installation root directory path, run:
make I=<install_directory> install
When the PLATFORM=<platform_subdir> argument is specified on the make command line, the platform-specific static library libplatsbi.a and firmware examples are built for the platform <platform_subdir> present in the directory platform in the OpenSBI top directory. For example, to compile the platform library and the firmware examples for the QEMU RISC-V virt machine, <platform_subdir> should be qemu/virt.
To build libsbi.a, libplatsbi.a and the firmware for one of the supported platforms, run:
An alternate build directory path can also be specified:
make PLATFORM=<platform_subdir> O=<build_directory>
The platform-specific library libplatsbi.a will be generated in the build/platform/<platform_subdir>/lib directory. The platform firmware files will be under the build/platform/<platform_subdir>/firmware directory. The compiled firmwares will be available in two different formats: an ELF file and an expanded image file.
To install libsbi.a, libplatsbi.a, and the compiled firmwares, run:
make PLATFORM=<platform_subdir> install
This will copy the compiled platform-specific libraries and firmware files under the install/platform/<platform_subdir>/ directory. An alternate install root directory path can be specified as follows:
make PLATFORM=<platform_subdir> I=<install_directory> install
In addition, platform-specific configuration options can be specified with the top-level make command line. These options, such as PLATFORM_ or FW_, are platform-specific and described in more details in the docs/platform/<platform_name>.md files and docs/firmware/<firmware_name>.md files.
By default, building OpenSBI generates 32-bit or 64-bit images based on the supplied RISC-V cross-compile toolchain. For example if CROSS_COMPILE is set to riscv64-unknown-elf-, 64-bit OpenSBI images will be generated. If building 32-bit OpenSBI images, CROSS_COMPILE should be set to a toolchain that is pre-configured to generate 32-bit RISC-V codes, like riscv32-unknown-elf-.
However it's possible to explicitly specify the image bits we want to build with a given RISC-V toolchain. This can be done by setting the environment variable PLATFORM_RISCV_XLEN to the desired width, for example:
export CROSS_COMPILE=riscv64-unknown-elf- export PLATFORM_RISCV_XLEN=32
will generate 32-bit OpenSBI images. And vice vesa.
OpenSBI is distributed under the terms of the BSD 2-clause license (“Simplified BSD License” or “FreeBSD License”, SPDX: BSD-2-Clause). A copy of this license with OpenSBI copyright can be found in the file COPYING.BSD.
All source files in OpenSBI contain the 2-Clause BSD license SPDX short identifier in place of the full license text.
This enables machine processing of license information based on the SPDX License Identifiers that are available on the SPDX web site.
OpenSBI source code also contains code reused from other projects as listed below. The original license text of these projects is included in the source files where the reused code is present.
See also the third party notices file for more information.
The OpenSBI project encourages and welcomes contributions. Contributions should follow the rules described in the OpenSBI Contribution Guideline document. In particular, all patches sent should contain a Signed-off-by tag.
The Contributors List document provides a list of individuals and organizations actively contributing to the OpenSBI project.
Detailed documentation of various aspects of OpenSBI can be found under the docs directory. The documentation covers the following topics.
OpenSBI source code is also well documented. For source level documentation, doxygen style is used. Please refer to the Doxygen manual for details on this format.
Doxygen can be installed on Linux distributions using .deb packages using the following command.
sudo apt-get install doxygen doxygen-latex doxygen-doc doxygen-gui graphviz
For .rpm based Linux distributions, the following commands can be used.
sudo yum install doxygen doxygen-latex doxywizard graphviz
sudo yum install doxygen doxygen-latex doxywizard graphviz
To build a consolidated refman.pdf of all documentation, run:
make O=<build_directory> docs
the resulting refman.pdf will be available under the directory <build_directory>/docs/latex. To install this file, run:
make I=<install_directory> install_docs
refman.pdf will be installed under <install_directory>/docs.