summaryrefslogtreecommitdiff
path: root/lib/utils/sys
AgeCommit message (Collapse)Author
2026-02-11lib: utils/hsm: factor out ATCSMU code into an HSM driverBen Zong-You Xie
Refactor ATCSMU (System Management Unit) support by moving it from a system utility into a dedicated FDT-based HSM driver. Key changes include: - Moving the functions in lib/utils/sys/atcsmu.c into the new HSM driver - Moving hart start and stop operations on AE350 platform into the new HSM driver - Converting the assembly-based functions in sleep.S to C code for the readability - Updating the ATCWDT200 driver Signed-off-by: Ben Zong-You Xie <[email protected]> Signed-off-by: Leo Yu-Chi Liang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Anup Patel <[email protected]>
2024-08-24util: atcsmu.c: modify sbi_printf() formattingYu Chien Peter Lin
Beautify multi-line printing. Signed-off-by: Leo Yu-Chi Liang <[email protected]> Reviewed-by: Yu Chien Peter Lin <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2024-08-24util: atcsmu.c: fix typo "%s/hard/hart/"Leo Yu-Chi Liang
%s/hard/hart Signed-off-by: Leo Yu-Chi Liang <[email protected]> Reviewed-by: Yu Chien Peter Lin <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2023-07-31lib: utils/reset: Remove SiFive Test reset driverAnup Patel
The functionality of SiFive Test reset driver is easily available through Syscon reset driver so let us remove the SiFive Test driver. Signed-off-by: Anup Patel <[email protected]>
2023-01-22lib: utils: atcsmu: Add Andes System Management Unit supportYu Chien Peter Lin
This patch adds atcsmu support for Andes AE350 platforms. The SMU provides system management capabilities, including clock, reset and power control based on power domain partitions. Signed-off-by: Yu Chien Peter Lin <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2023-01-06lib: utils/sys: Allow custom HTIF base address for RV32Bin Meng
commit 6dde43584f18 ("lib: utils/sys: Extend HTIF library to allow custom base address") forgot to update do_tohost_fromhost() codes for RV32, which still accesses the HTIF registers using the ELF symbol address directly. Fixes: 6dde43584f18 ("lib: utils/sys: Extend HTIF library to allow custom base address") Signed-off-by: Bin Meng <[email protected]> Tested-by: Daniel Henrique Barboza <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2022-08-08lib: utils/sys: Use kconfig for enabling/disabling driversAnup Patel
We update system drivers makefile to use kconfig for enabling/disabling drivers. To avoid compile errors, we also enable appropriate system drivers for each platform. Signed-off-by: Anup Patel <[email protected]> Tested-by: Andrew Jones <[email protected]> Acked-by: Atish Patra <[email protected]> Tested-by: Atish Patra <[email protected]>
2022-01-11lib: utils/sys: Extend HTIF library to allow custom base addressAnup Patel
Some of RISC-V emulators provide HTIF at fixed base address so for such emulators users have to hard-code HTIF base address in the linker script. To address this problem, we let users optionally provide fixed HTIF base address via platform support (or device tree). Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Dong Du <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2021-10-11lib: sbi: convert reset to listNikita Shubin
To support different handlers for different types of resets, we are adding a sbi_list of restart handlers. Instead of sbi_system_reset_set_device we use sbi_system_reset_add_device to reflect the actual meaning. Signed-off-by: Nikita Shubin <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2021-06-24platform: Replace CLINT library usage with ACLINT libraryAnup Patel
The ACLINT devices are backward compatible with SiFive CLINT so we replace all CLINT library usage in various platforms with ACLINT library. As a result of this replacement, the CLINT library is not used by any part of OpenSBI hence we remove it. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]> Reviewed-by: Xiang W <[email protected]>
2021-04-28lib: sbi: Simplify system reset platform operationsAnup Patel
Instead of having system_reset_check() and system_reset() callbacks in platform operations, it will be much simpler for reset driver to directly register these operations as a device to the sbi_system implementation. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Alistair Francis <[email protected]>
2021-04-28lib: sbi: Simplify ipi platform operationsAnup Patel
Instead of having ipi_send() and ipi_clear() callbacks in platform operations, it will be much simpler for ipi driver to directly register these operations as a device to sbi_ipi implementation. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Alistair Francis <[email protected]>
2021-04-28lib: sbi: Simplify timer platform operationsAnup Patel
Instead of having timer_value(), timer_event_start(), and timer_event_stop() callbacks in platform operations, it will be much simpler for timer driver to directly register these operations as device to the sbi_timer implementation. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Alistair Francis <[email protected]>
2021-04-28lib: sbi: Simplify console platform operationsAnup Patel
Instead of having console_putc() and console_getc() callbacks in platform operations, it will be much simpler for console driver to directly register these operations as device to the sbi_console implementation. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Alistair Francis <[email protected]> Reviewed-by: Xiang W <[email protected]>
2021-04-13lib: utils/sys: Add CLINT memregion in the root domainAnup Patel
The CLINT memory should not be accessed by the supervisor-mode software so let's protect it by adding CLINT memregion to the root domain. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Xiang W <[email protected]> Reviewed-by: Alistair Francis <[email protected]>
2020-12-01lib: sbi: Improve system reset platform operationsAnup Patel
To implement the SBI SRST extension, we need two platform operations for system reset: 1) system_reset_check() - This operation will check whether given reset type and reason are supported by the platform 2) system_reset() - This operation will do the actual platform system reset and it will not return if reset type and reason are supported by the platform This patch updates system reset related code everywhere as-per above. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-12-01include: sbi: Remove opensbi specific reset type definesAnup Patel
We can now use the standard SBI SRST extension reset types instead of the opensbi specific (SBI_PLATFORM_RESET_xyz) reset types hence remove related opensbi specific defines. The "platform_" prefix of the reset type parameter of sbi_system_reset() function should also be removed. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Alistair Francis <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-05-23lib: utils: Allow CLINT functions to be used for multiple CLINTsAnup Patel
We extend CLINT cold init function to have a "struct clint_data *" parameter pointing to CLINT details. This allows platforms to use CLINT functions for multiple CLINT instances. When multiple CLINTs are present, the platform can also provide one of the CLINT as reference CLINT for other CLINTs. This will help CLINTs to sync their time value with reference CLINT using a time_delta computed in warm init function. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-04-27lib: utils: Add SiFive test deviceAnup Patel
This patch factor-out SiFive test device related stuff into it's own source file from qemu/virt platform. In future, we can find SiFive test device address from device tree as well. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-04-27include: sbi_platform: Combine reboot and shutdown into one callbackAnup Patel
We can achieve shutdown, cold reboot, and warm reboot using just one sbi_platform callback so we combine system_reboot() and system_shutdown() callbacks into one system_reset() callback. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-03-13include: Make sbi_current_hartid() as macro in riscv_asm.hAnup Patel
The sbi_current_hartid() being a regular function is quite expensive because for callers it is a function call instead of a direct CSR read. This patch converts sbi_current_hartid() into a macro in riscv_asm.h. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-02-18lib: utils: htif: Fix 32-bit buildBin Meng
When building 32-bit OpenSBI images, we get: lib/utils/sys/htif.c: In function '__check_fromhost': lib/utils/sys/htif.c:12:31: error: left shift count >= width of type [-Werror=shift-count-overflow] #define HTIF_DATA_MASK ((1UL << HTIF_DATA_BITS) - 1) ^~ Fixes: c2f23cc6edd7 ("platform: Add Spike initial support") Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-02-17platform: Add Spike initial supportJames Clarke
This patch adds initial platform support Spike emulator. Signed-off-by: James Clarke <[email protected]> Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-02lib: utils: Support CLINT with 32bit MMIO access on RV64 systemAnup Patel
It is possible to have a CLINT implementation which supports only 32bit MMIO accesses on RV64 system so this patch extends our CLINT driver such that platform code can specify whether CLINT supports 64bit MMIO access. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra<[email protected]> Reviewed-by: Zong Li <[email protected]>
2019-08-31lib: Fix timer for 32 bitAtish Patra
To read 64bit time in 32 bit we have to read lower & upper half separately and 'or' them together. However, upper half time may have changed by the time we read lower half. Thus, the resultant 64 bit time may not be accurate. Consider lower half time value only if upper half time value has not changed. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2019-08-16platform: Remove the ipi_sync method from all platforms.Atish Patra
OpenSBI manages outstanding TLB flush requests by queueing them in a fifo synchronously. An ipi sync which uses an atomic operation on MMIO address is no longer required. Remove the ipi sync method from platform header and all usage. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2019-06-19platform: Enable all drivers by default.Atish Patra
The drivers and libfdt are built as libsbiutils.a instead of libplatsbi.a. libsbiutils.a are not built per platform specific. Thus, enable all drivers by default. Signed-off-by: Atish Patra <[email protected]> Acked-by: Anup Patel <[email protected]>
2019-06-19platform: Move platform common to lib/utils.Atish Patra
Currently, platform/common contains platform/non-platform specific common minimal drivers and libraries. This is helpful is all platforms are built within opensbi framework. Move them to lib/utils so that any external platform code also can reuse the minimalistic drivers or other common libraries. This patch doesn't introduce any functional changes. Signed-off-by: Atish Patra <[email protected]> Acked-by: Anup Patel <[email protected]>