summaryrefslogtreecommitdiff
path: root/include/sbi/riscv_locks.h
AgeCommit message (Collapse)Author
2021-05-14lib: sbi: Have spinlock checks return boolDaniel Schaefer
spin_lock_check already returned bool in the source file but not in the header. With some toolchains that causes an error, as it should. Because it and related functions all essentially return a bool, we can use this opportunity to change them. Signed-off-by: Daniel Schaefer <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2021-04-09lib: sbi: Replace test-and-set locks by ticket locksChristoph Muellner
Replace the test-and-set spinlock implementation with ticket locks in order to get fairness (in form of FIFO order). The implementation uses a 32-bit wide struct, which consists of two 16-bit counters (owner and next). This is inspired by similar spinlock implementations on other architectures. This allows that the code works for both, RV32 and RV64. Signed-off-by: Christoph Muellner <[email protected]> Reviewed-by: Anup Patel <[email protected]> Reviewed-by: Xiang W <[email protected]>
2021-04-09include: sbi: Allow direct initialization via SPIN_LOCK_INIT()Christoph Muellner
The current implementation of SPIN_LOCK_INIT() provides the spinlock to be initialized as reference. This does not allow a direct initialization of the spinlock object at the creation site. Let's pass the spinlock directly instead (like Linux does as well) and adjust all users of the macro (in fact there is only one user). Signed-off-by: Christoph Muellner <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2019-04-24all: run clang-format and update checked-in filesOlof Johansson
Noisy commit, no functional changes. Generated with an current upstream clang-format and: clang-format -i $(find . -name \*.[ch]) Signed-off-by: Olof Johansson <[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]>
2018-12-11Initial commit.Anup Patel
Signed-off-by: Anup Patel <[email protected]>