summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)Author
2019-04-03lib: Add a fifo implementation.Atish Patra
Implement a fifo to accomodate outstanding IPIs for a specific hart at the same time. Signed-off-by: Atish Patra <[email protected]>
2019-04-01include: Make mstatus parameter optional for get_insn()Anup Patel
The mstatus parameter of get_insn() is used to return MSTATUS CSR value which get_insn() saw. Most of the get_insn() callers don't use the value returned in mstatus so this patch makes mstatus parameter optional for get_insn(). Signed-off-by: Anup Patel <[email protected]>
2019-04-01include: Rename sbi_unpriv.h to riscv_unpriv.hAnup Patel
The sbi_unpriv.h has quite a few load_xyz() and store_xyz() helper routines based on RISC-V inline assembly for unpriviledged accesses from M-mode. These helper routines are similar to helper routines present in riscv_locks.h, riscv_io.h, and riscv_atomic.h so let's rename sbi_unpriv.h to riscv_unpriv.h. Signed-off-by: Anup Patel <[email protected]>
2019-04-01lib: Remove unused mepc arg from load_xyz() and store_xyz() functionsAnup Patel
This patch removes unused mepc arg from load_xyz() and store_xyz() unpriviledge access functions. Signed-off-by: Anup Patel <[email protected]>
2019-03-29lib: Disable the boot prints if SBI_SCRATCH_NO_BOOT_PRINTS is setBin Meng
Use the newly introduced "options" in "struct sbi_scratch" to conditionally disable the boot prints. Signed-off-by: Bin Meng <[email protected]>
2019-03-29firmware: Introduce "options" in "struct sbi_scratch"Bin Meng
Introduce "options" in "struct sbi_scratch" and firmware can update it based on optional compile time flags before calling sbi_init(). Signed-off-by: Bin Meng <[email protected]>
2019-03-12lib: Implement sfence.vma correctly.Atish Patra
Currently, OpenSBI doesn't distinguish between sfence.vma and sfence.vm asid calls. Moreover, it ignores the page ranges and just flush entire TLB everytime. Fix the sfence implementation by keeping all the tlb flush info in scratch area. The relevant Linux kernel code was added by https://patchwork.kernel.org/project/linux-riscv/list/?series=89695 However, this patch is backward compatible with older version kernel that doesn't have the above patches as well. Fixes #87 Signed-off-by: Atish Patra <[email protected]>
2019-03-10lib: Create a sbi_ipi_data structureAlistair Francis
Create a sbi_ipi_data structure that holds unpacked IPI information. At the same time remove ipi_type from the sbi_scratch struct and use a fixed offset to access it. This structure fits in behind the sbi_scratch structure. This fixes https://github.com/riscv/opensbi/issues/81 Signed-off-by: Alistair Francis <[email protected]>
2019-03-06platform: Make the `platform` read-onlyXiang Wang
platform should be a read-only variable, if it is placed in the data segment, it may be exploited. Signed-off-by: Xiang Wang <[email protected]>
2019-03-05lib:platform: Fix sbi_getc return type.Atish Patra
As per the current SBI specification, sbi_getc should return an int instead of char. In case of FIFO is empty, return -1 as per the specification. Reported-by: Sergi Granell <[email protected]> Suggested-by:Thadeu Lima de Souza Cascardo <[email protected]> Signed-off-by: Atish Patra <[email protected]>
2019-02-26include: Bump-up version to 0.3v0.3Anup Patel
This patch updates OpenSBI version to 0.3 as part of release preparation. Signed-off-by: Anup Patel <[email protected]>
2019-02-22include: Bump-up version to 0.2v0.2Anup Patel
This patch increases OpenSBI version to 0.2. Signed-off-by: Anup Patel <[email protected]>
2019-02-20firmware: Improve low-level trap handler for M-mode to M-mode trapsAnup Patel
This patch extends our low-level trap handler in fw_base.S for handling M-mode to M-mode traps without overwritting stack. Signed-off-by: Anup Patel <[email protected]>
2019-02-20include: Add PRILX define to help print unsigned longAnup Patel
The unsigned long is always machine word size. This means it is 4 bytes on 32bit system and 8 bytes on 64bit system. This patch adds PRILX define for sbi_printf() which will help us print unsigned long without worrying whether it is 32bit or 64bit system. Signed-off-by: Anup Patel <[email protected]>
2019-02-14lib: Use CSR_<FOO> instead of <foo> for csr_*()Atish Patra
Some older toolchains may not have all the csr's defined. Update all the csr functions to use the CSR_ #define values instead of the toolchain defined values. Suggested-by: Olof Johansson <[email protected]> Signed-off-by: Atish Patra <[email protected]>
2019-02-08firmware: Use lw instead of lwu for 32-bit architecturesAlistair Francis
Signed-off-by: Alistair Francis <[email protected]>
2019-02-05riscv_asm.h: Use CSR_<FOO> instead of <foo> for csr_read()Olof Johansson
Some toolchains might not have all the CSRs available (as seen with GCC 7.2). So, instead use the defined CSR_ values. Signed-off-by: Olof Johansson <[email protected]>
2019-01-25include: Add separate header for OpenSBI versionAnup Patel
Currently, the OpenSBI version is in top-level Makefile so firmware linking to OpenSBI static library have no-way to know OpenSBI version. This patch moves OpenSBI version from top-level Makefile to sbi/sbi_version.h header which provides OPENSBI_VERSION_MAJOR and OPENSBI_VERSION_MINOR defines. NOTE: the SBI spec (or SBI ecall interface) version is different. The SBI spec version is provided by functions sbi_ecall_version_major() and sbi_ecall_version_minor(). Signed-off-by: Anup Patel <[email protected]>
2019-01-24all: Update copyright header in all filesAnup patel
This patch updates copyright header in all files as follows: 1. Makes "SPDX-License-Identifier: BSD-2-Clause" as first line 2. Change copyright year to 2019 for Western Digital Signed-off-by: Anup Patel <[email protected]>
2019-01-23include: Use TRUE/FALSE as return values in sbi_platform_hart_disabled()Anup Patel
The sbi_platform_hart_disabled() returns bool hence explicitly return TRUE or FALSE instead of 1 or 0. Signed-off-by: Anup Patel <[email protected]>
2019-01-23include: Rename ipi_inject() to ipi_send() for sbi_platformAnup Patel
For better naming, we rename ipi_inject() to ipi_send() in struct sbi_platform. We also replace term "inject" with "send" in all related places. Signed-off-by: Anup Patel <[email protected]>
2019-01-23include: Drop MMIO from SBI_PLATFORM_HAS_MMIO_TIMER_VALUEAnup Patel
It is not necessary that platform has MMIO-based timer value register. It can also have some custom (implementation specific) CSR for timer value. This patch renames SBI_PLATFORM_HAS_MMIO_TIMER_VALUE to SBI_PLATFORM_HAS_TIMER_VALUE to imply "platform timer value" instead of "mmio timer value". Signed-off-by: Anup Patel <[email protected]>
2019-01-23include: Update documentation of sbi_platform after callback cleanupAnup Patel
The prototypes of sbi_platform callbacks have changed hence we update related documentation. Signed-off-by: Anup Patel <[email protected]>
2019-01-23lib: Remove target_hart and hartid parameter from TIMER callbacksAnup Patel
The target_hart and hartid paramter of TIMER callbacks is not required because it always current hartid which can be obtained using sbi_current_hartid() API. Signed-off-by: Anup Patel <[email protected]>
2019-01-23lib: Remove hartid parameter from IRQCHIP callbacksAnup Patel
The hartid parameter in IRQCHIP callbacks of sbi_platform is not required because current hartid can be determined using sbi_current_hartid() API. Signed-off-by: Anup Patel <[email protected]>
2019-01-23lib: Remove source_hart and hartid parameter from IPI callbacksAnup patel
The source_hart and hartid parameter is really not required in IPI callbacks of sbi_platform because current hartid can always be obtained by calling sbi_current_hartid() API. Signed-off-by: Anup Patel <[email protected]>
2019-01-23lib: Remove hartid paramter from early_init() and final_init() callbacksAnup Patel
We simplify early_init() and final_init() callbacks of sbi_platform by removing "hartid" parameter. Signed-off-by: Anup Patel <[email protected]>
2019-01-22lib: Add doxygen style documentation for sbi_platformAnup Patel
This patch adds doxygen style documenation for struct sbi_platform and related functions/macros/defines. Signed-off-by: Anup Patel <[email protected]>
2019-01-22lib: Add atomic bit set/clear operations.Atish Patra
Add addtional functionlities for set/clear bits atomically. Signed-off-by: Atish Patra <[email protected]>
2019-01-21sbi: Add ecall helpersDamien Le Moal
Define sbi_ecall_console_puts() using sbi_ecall_console_putchar() renamed as sbi_ecall_console_putc() and remove the hardcoded version of the same funtion in the test payload code. Signed-off-by: Damien Le Moal <[email protected]>
2019-01-18platform: Add libfdt support.Atish Patra
Some of the platform (i.e. SiFive FU540) requires Device Tree modification before it is passed to higher stages. Add libfdt support now to help this process. Libfdt should only be included per platform basis. Signed-off-by: Atish Patra <[email protected]>
2019-01-16include: Add documentation for sbi_trap_regs and friendsAnup Patel
This patch adds doxygen style documentation for struct sbi_trap_regs and related macros/defines/functions. Signed-off-by: Anup Patel <[email protected]>
2019-01-16include: Add __packed define for packed structuresAnup Patel
This patch adds __packed define for specifying packed attribute of structures. Signed-off-by: Anup Patel <[email protected]>
2019-01-16include: Add documentation for sbi_scratch and friendsAnup Patel
This patch adds doxygen style documentation for struct sbi_scratch and related helper macros/defines. Signed-off-by: Anup Patel <[email protected]>
2019-01-16lib: Add documentation for sbi_init() APIAnup Patel
This patch adds doxygen style documentation for sbi_init() API. Signed-off-by: Anup Patel <[email protected]>
2019-01-16include: Add __noreturn define for noreturn function attributeAnup Patel
There are quite a few noreturn functions in OpenSBI hence we add commong __noreturn define for noreturn functin attribute. Signed-off-by: Anup Patel <[email protected]>
2019-01-03include: Add hard FP access macros and definesAnup Patel
This patch adds hardware floating-point (hard FP) access macros and defines. Signed-off-by: Anup Patel <[email protected]>
2019-01-02include: Remove redundant tmp0 from struct sbi_scratchAnup Patel
The tmp0 member was added in struct sbi_scratch to assist register save/restore at time of trap handling. This tmp0 is not unsed any more hence removing it. Signed-off-by: Anup Patel <[email protected]>
2019-01-02include: Move RISCV_TRAP_REGS_xyz defines to sbi_trap.hAnup Patel
The struct sbi_trap_regs related defines RISCV_TRAP_REGS_xyz should be in sbi_trap.h so that we can keep these defines in-sync with changes in struct sbi_trap_regs. Signed-off-by: Anup Patel <[email protected]>
2019-01-02include: Move RISCV_PLATFORM_xyz defines to sbi_platform.hAnup Patel
The struct sbi_platform related defines RISCV_PLATFORM_xyz should be in sbi_platform.h so that we can keep these defines in-sync with changes in struct sbi_platform. Signed-off-by: Anup Patel <[email protected]>
2019-01-02include: Move RISCV_SCRATCH_xyz defines to sbi_scratch.hAnup Patel
The struct sbi_scratch related defines RISCV_SCRATCH_xyz should be in sbi_scratch.h so that we can keep these defines in-sync with changes in struct sbi_scratch. Signed-off-by: Anup Patel <[email protected]>
2019-01-02include: Replace #csr with __ASM_STR(csr) in csr_xyz() macrosAnup Patel
We replace #csr with __ASM_STR(csr) in all csr_xyz() macros so that we can pass CSR number instead of CSR name when GCC is not aware of CSR name. Signed-off-by: Anup Patel <[email protected]>
2019-01-02include: Remove redundant csr_read_n() and csr_write_n()Anup Patel
The patch removes redundant csr_read_n() and csr_write_n() because same thing can be achieved by using __ASM_STR() macro in csr_read() and csr_write() macros. Signed-off-by: Anup Patel <[email protected]>
2018-12-31lib: Redirect illegal instruction trap to S-mode when not handledAnup Patel
Currently, we fail with error SBI_ENOTSUPP when we are not able to handle illegal instruction trap. Instead, we should just redirect illegal instruction trap to S-mode when not handled. This redirection of illegal instruction trap will help lazy save/restore of floating point registers to work correctly in Linux kernel. Signed-off-by: Anup Patel <[email protected]>
2018-12-27lib: Rename target_hart parameter to hartid for PMP platform callbacksAnup Patel
We rename target_hart parameter of PMP platform callbacks to hartid for clarity because the parameter represents current hartid. Signed-off-by: Anup Patel <[email protected]>
2018-12-27lib: Simplify sbi_platform timer_init() hooksAnup Patel
Instead of having separate timer_init() hooks for cold and warm boot, this patch updates struct sbi_platform to have just one timer_init() hook. The type of boot (cold or warm) is now a boolean flag parameter for the updated timer_init() hook. Signed-off-by: Anup Patel <[email protected]>
2018-12-27lib: Simplify sbi_platform ipi_init() hooksAnup Patel
Instead of having separate ipi_init() hooks for cold and warm boot, this patch updates struct sbi_platform to have just one ipi_init() hook. The type of boot (cold or warm) is now a boolean flag parameter for the updated ipi_init() hook. Signed-off-by: Anup Patel <[email protected]>
2018-12-27lib: Simplify sbi_platform irqchip_init() hooksAnup Patel
Instead of having separate irqchip_init() hooks for cold and warm boot, this patch updates struct sbi_platform to have just one irqchip_init() hook. The type of boot (cold or warm) is now a boolean flag parameter for the updated irqchip_init() hook. Signed-off-by: Anup Patel <[email protected]>
2018-12-27lib: Simplify sbi_platform early_init() and final_init() hooksAnup Patel
Instead of having separate early_init() and final_init() hooks for cold and warm boot, this patch updates struct sbi_platform to have just one early_init() and one final_init() hook. The type of boot (cold or warm) is now a boolean flag parameter for the updated early_init() and final_init() hooks. Signed-off-by: Anup Patel <[email protected]>
2018-12-27lib: Move ECALL defines to sbi_ecall_interface.hAnup Patel
This patch moves all ECALL defines to sbi_ecall_interface.h so that it can be shared with firmware payloads. Signed-off-by: Anup Patel <[email protected]>