summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-03-10lib: sbi: Clear IPIs before init_warm_startup in non-boot hartsHEADVF2_v3.8.2VF2_v3.7.5VF2_v3.6.1VF2_v3.4.5VF2_v3.1.5VF2_v3.0.4VF2_v2.11.5VF2_6.1_v3.8.2VF2_6.1_v3.7.5JH7110_VF2_6.6_v5.12.0JH7110_VF2_6.1_v5.12.0JH7110_VF2_6.1_v5.11.4JH7110_VF2_6.1_v5.11.3JH7110_VF2_6.1_v5.10.3JH7110_VF2_6.1_v3.9.3JH7110_VF2_515_v5.12.0JH7110_VF2_515_v5.11.4JH7110_VF2_515_v5.11.3JH7110_VF2_515_v5.10.3JH7110_VF2_515_v3.9.3masterJH7110_VisionFive2_develEvgenii Shatokhin3-2/+12
Since commit 50d4fde1c5a4 ("lib: Remove redundant sbi_platform_ipi_clear() calls"), the IPI sent from the boot hart in wake_coldboot_harts() is not cleared in the secondary harts until they reach sbi_ipi_init(). However, sbi_hsm_init() and sbi_hsm_hart_wait() are called earlier, so a secondary hart might enter sbi_hsm_hart_wait() with an already pending IPI. sbi_hsm_hart_wait() makes sure the hart leaves the loop only when it is actually ready, so a pending unrelated IPI should not cause safety issues. However, it might be inefficient on certain hardware, because it prevents "wfi" from stalling the hart even if the hardware supports this, making the hart needlessly spin in a "busy-wait" loop. This behaviour can be observed, for example, in a QEMU VM (QEMU 7.2.0) with "-machine virt" running a Linux guest. Inserting delays in sbi_hsm_hart_start() allows reproducing the issue more reliably. The comment in wait_for_coldboot() suggests that the initial IPI is needed in the warm resume path, so let us clear it before init_warm_startup() only. To do this, sbi_ipi_raw_clear() was created similar to sbi_ipi_raw_send(). Signed-off-by: Evgenii Shatokhin <e.shatokhin@yadro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-03-10lib: sbi: Set the state of a hart to START_PENDING after the hart is readyEvgenii Shatokhin1-16/+67
When a boot hart executes sbi_hsm_hart_start() to start a secondary hart, next_arg1, next_addr and next_mode for the latter are stored in the scratch area after the state has been set to SBI_HSM_STATE_START_PENDING. The secondary hart waits in the loop with wfi() in sbi_hsm_hart_wait() at that time. However, "wfi" instruction is not guaranteed to wait for an interrupt to be received by the hart, it is just a hint for the CPU. According to RISC-V Privileged Architectures spec. v20211203, even an implementation of "wfi" as "nop" is legal. So, the secondary might leave the loop in sbi_hsm_hart_wait() as soon as its state has been set to SBI_HSM_STATE_START_PENDING, even if it got no IPI or it got an IPI unrelated to sbi_hsm_hart_start(). This could lead to the following race condition when booting Linux, for example: Boot hart (#0) Secondary hart (#1) runs Linux startup code waits in sbi_hsm_hart_wait() sbi_ecall(SBI_EXT_HSM, SBI_EXT_HSM_HART_START, ...) enters sbi_hsm_hart_start() sets state of hart #1 to START_PENDING leaves sbi_hsm_hart_wait() runs to the end of init_warmboot() returns to scratch->next_addr (next_addr can be garbage here) sets next_addr, etc. for hart #1 (no good: hart #1 has already left) sends IPI to hart #1 (no good either) If this happens, the secondary hart jumps to a wrong next_addr at the end of init_warmboot(), which leads to a system hang or crash. To reproduce the issue more reliably, one could add a delay in sbi_hsm_hart_start() after setting the hart's state but before sending IPI to that hart: hstate = atomic_cmpxchg(&hdata->state, SBI_HSM_STATE_STOPPED, SBI_HSM_STATE_START_PENDING); ... + sbi_timer_mdelay(10); init_count = sbi_init_count(hartid); rscratch->next_arg1 = arg1; rscratch->next_addr = saddr; The issue can be reproduced, for example, in a QEMU VM with '-machine virt' and 2 or more CPUs, with Linux as the guest OS. This patch moves writing of next_arg1, next_addr and next_mode for the secondary hart before setting its state to SBI_HSM_STATE_START_PENDING. In theory, it is possible that two or more harts enter sbi_hsm_hart_start() for the same target hart simultaneously. To make sure the current hart has exclusive access to the scratch area of the target hart at that point, a per-hart 'start_ticket' is used. It is initially 0. The current hart tries to acquire the ticket first (set it to 1) at the beginning of sbi_hsm_hart_start() and only proceeds if it has successfully acquired it. The target hart reads next_addr, etc., and then the releases the ticket (sets it to 0) before calling sbi_hart_switch_mode(). This way, even if some other hart manages to enter sbi_hsm_hart_start() after the ticket has been released but before the target hart jumps to next_addr, it will not cause problems. atomic_cmpxchg() already has "acquire" semantics, among other things, so no additional barriers are needed in hsm_start_ticket_acquire(). No hart can perform or observe the update of *rscratch before setting of 'start_ticket' to 1. atomic_write() only imposes ordering of writes, so an explicit barrier is needed in hsm_start_ticket_release() to ensure its "release" semantics. This guarantees that reads of scratch->next_addr, etc., in sbi_hsm_hart_start_finish() cannot happen after 'start_ticket' has been released. Signed-off-by: Evgenii Shatokhin <e.shatokhin@yadro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-03-10lib: sbi: Refactor the calls to sbi_hart_switch_mode()Evgenii Shatokhin3-16/+23
Move them into sbi_hsm_hart_start_finish() and sbi_hsm_hart_resume_finish() to make them easier to manage. This will be used by subsequent patches. Suggested-by: Anup Patel <anup@brainfault.org> Signed-off-by: Evgenii Shatokhin <e.shatokhin@yadro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-03-10lib: sbi_pmu: Add hartid parameter PMU device opsMayuresh Chitale2-16/+23
Platform specific firmware event handler may leverage the hartid to program per hart specific registers for a given counter. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-03-10lib: sbi_pmu: Introduce fw_counter_write_value APIMayuresh Chitale2-15/+21
Add fw_counter_write_value API for platform specific firmware events which separates setting the counter's initial value from starting the counter. This is required so that the fw_event_data array can be reused to save the event data received. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-03-10lib: sbi_pmu: Use dedicated event code for platform firmware eventsMayuresh Chitale1-13/+52
For all platform specific firmware event operations use the dedicated event code (0xFFFF) when matching against the input firmware event. Furthermore save the real platform specific firmware event code received as the event data for future use. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-03-10lib: sbi_pmu: Update sbi_pmu dev opsMayuresh Chitale2-18/+21
Update fw_event_validate_code, fw_counter_match_code and fw_counter_start ops which used a 32 bit event code to use the 64 bit event data instead. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-03-10lib: sbi_pmu: Rename fw_counter_valueMayuresh Chitale1-9/+13
Rename and reuse fw_counter_value array to save both the counter values for the SBI firmware events and event data for the SBI platform specific firmware events. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org> Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
2023-03-10lib: sbi_pmu: Reserve space for implementation specific firmware eventsMayuresh Chitale1-0/+11
We reserve space for SBI implementation specific custom firmware events which can be used by M-mode firmwares and HS-mode hypervisors for their own use. This reserved space is intentionally large to ensure that SBI implementation has enough space to accommodate platform specific firmware events as well. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-03-10lib: sbi_pmu: Implement sbi_pmu_counter_fw_read_hiMayuresh Chitale2-0/+9
To support 64 bit firmware counters on RV32 systems, we implement sbi_pmu_counter_fw_read_hi() which returns the upper 32 bits of the firmware counter value. On RV64 (or higher) systems, this function will always return zero. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-03-10lib: sbi_pmu: add callback for counter widthMayuresh Chitale2-0/+11
This patch adds a callback to fetch the number of bits implemented for a custom firmware counter. If the callback fails or is not implemented then width defaults to 63. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-03-09lib: serial: Cadence: Enable compatibility for cdns,uart-r1p8Mayuresh Chitale1-0/+1
The Cadence driver does not use the RX byte status feature and hence can be advertised to be compatible with cdns,uart-r1p8 as well. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-03-09platform: starfive: add PMIC power ops in JH7110 visionfive2 boardMinda Chen2-0/+273
add reboot and poweroff support. The whole reboot and shutdown pm op includes shutdown jh7110 pmu device power domain and access on board pmic register through I2C. Signed-off-by: Minda Chen <minda.chen@starfivetech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-03-09lib: utils/i2c: Add minimal StarFive jh7110 I2C driverMinda Chen5-0/+286
Starfive JH7110 I2C IP is synopsys designware. Minimum StarFIve I2C driver to read/send bytes over I2C bus. This allows querying information and perform operation of onboard PMIC, as well as power-off and reset. Signed-off-by: Minda Chen <minda.chen@starfivetech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-03-01make: Add a command line option for debugging OpenSBIBin Meng2-1/+19
Add a new make command line option "make DEBUG=1" to prevent compiler optimizations using -O2. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-03-01gpio/starfive: add gpio driver and support gpio resetminda.chen4-0/+124
Add gpio driver and gpio reset function in Starfive JH7110 SOC platform. Signed-off-by: minda.chen <minda.chen@starfivetech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27platform: generic: Add system suspend testAndrew Jones4-1/+55
When the system-suspend-test property is present in the domain config node as shown below, implement system suspend with a simple 5 second delay followed by a WFI. This allows testing system suspend when the low-level firmware doesn't support it. / { chosen { opensbi-domains { compatible = "opensbi,domain,config"; system-suspend-test; }; Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27docs: Correct opensbi-domain property nameAndrew Jones1-3/+3
Replace the commas with dashes to correct the name. Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27lib: sbi: Implement system suspendAndrew Jones1-1/+56
Fill the implementation of the system suspend ecall. A platform implementation of the suspend callbacks is still required for this to do anything. Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27lib: sbi: Add system_suspend_allowed domain propertyAndrew Jones4-0/+18
Only privileged domains should be allowed to suspend the entire system. Give the root domain this property by default and allow other domains to be given the property by specifying it in the DT. Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27lib: sbi: Add system suspend skeletonAndrew Jones7-0/+119
Add the SUSP extension probe and ecall support, but for now the system suspend function is just a stub. Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27lib: sbi_hsm: Export some functionsAndrew Jones2-2/+14
A coming patch can make use of a few internal hsm functions if we export them. Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27lib: sbi_hsm: Remove unnecessary includeAndrew Jones1-2/+2
Also remove a superfluous semicolon and add a blank line. Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27lib: sbi_hsm: Move misplaced commentAndrew Jones1-2/+4
While non-retentive suspend is not allowed for M-mode, the comment at the top of sbi_hsm_hart_suspend() implied suspend wasn't allowed for M-mode at all. Move the comment above the mode check which is inside a suspend type is non-retentive check. Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27lib: sbi_hsm: Ensure errors are consistent with specAndrew Jones1-3/+3
HSM functions define when SBI_ERR_INVALID_PARAM should be returned. Ensure it's not used for reasons that don't meet the definitions by using the catch-all code, SBI_ERR_FAILED, for those reasons instead. Also, in one case sbi_hart_suspend() may have returned SBI_ERR_DENIED, which isn't defined for that function at all. Use SBI_ERR_FAILED for that case too. Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27lib: sbi_hsm: Don't try to restore state on failed changeAndrew Jones1-5/+2
When a state change fails there's no need to restore the original state as it remains the same. Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27lib: sbi_hsm: Factor out invalid state detectionAndrew Jones1-41/+24
Remove some redundant code by creating an invalid state detection macro. No functional change intended. Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27docs: domain_support: Update the DT exampleBin Meng1-2/+2
commit 3e2f573e707e ("lib: utils: Disallow non-root domains from adding M-mode regions") added access permission check in __fdt_parse_region(). With the existing DT example in the doc OpenSBI won't boot anymore. Let's update the DT example so that it can work out of the box. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27lib: utils/fdt/fdt_domain: Simplify region access permission checkBin Meng1-6/+4
The region access permission check in __fdt_parse_region() can be simplified as masking SBI_DOMAIN_MEMREGION_{M,SU}_ACCESS_MASK is enough. While we are here, update the confusing comments to match the codes. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27lib: sbi/sbi_domain: cosmetic style fixesBin Meng1-2/+2
Minor updates to the comments for language and style fixes. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27lib: sbi: sbi_ecall: Check the range of SBI errorYu Chien Peter Lin1-1/+1
We should also check if the return error code is greater than 0 (SBI_SUCCESS), as this is an invalid error. Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27platform: generic: renesas: rzfive: Configure the PMA regionLad Prabhakar2-0/+22
On the Renesas RZ/Five SoC by default we want to configure 128MiB of memory ranging from 0x58000000 as a non-cacheable + bufferable region in the PMA and populate this region as PMA reserve DT node with shared DMA pool and no-map flags set so that Linux drivers requesting any DMA'able memory go through this region. PMA node passed to the above stack: reserved-memory { #address-cells = <2>; #size-cells = <2>; ranges; pma_resv0@58000000 { compatible = "shared-dma-pool"; reg = <0x0 0x58000000 0x0 0x08000000>; no-map; linux,dma-default; }; }; Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27platform: generic: renesas: rzfive: Add support to configure the PMALad Prabhakar5-0/+407
I/O Coherence Port (IOCP) provides an AXI interface for connecting external non-caching masters, such as DMA controllers. The accesses from IOCP are coherent with D-Caches and L2 Cache. IOCP is a specification option and is disabled on the Renesas RZ/Five SoC due to this reason IP blocks using DMA will fail. The Andes AX45MP core has a Programmable Physical Memory Attributes (PMA) block that allows dynamic adjustment of memory attributes in the runtime. It contains a configurable amount of PMA entries implemented as CSR registers to control the attributes of memory locations in interest. Below are the memory attributes supported: * Device, Non-bufferable * Device, bufferable * Memory, Non-cacheable, Non-bufferable * Memory, Non-cacheable, Bufferable * Memory, Write-back, No-allocate * Memory, Write-back, Read-allocate * Memory, Write-back, Write-allocate * Memory, Write-back, Read and Write-allocate More info about PMA (section 10.3): Link: http://www.andestech.com/wp-content/uploads/AX45MP-1C-Rev.-5.0.0-Datasheet.pdf As a workaround for SoCs with IOCP disabled CMO needs to be handled by software. Firstly OpenSBI configures the memory region as "Memory, Non-cacheable, Bufferable" and passes this region as a global shared dma pool as a DT node. With DMA_GLOBAL_POOL enabled all DMA allocations happen from this region and synchronization callbacks are implemented to synchronize when doing DMA transactions. Example PMA region passed as a DT node from OpenSBI: reserved-memory { #address-cells = <2>; #size-cells = <2>; ranges; pma_resv0@58000000 { compatible = "shared-dma-pool"; reg = <0x0 0x58000000 0x0 0x08000000>; no-map; linux,dma-default; }; }; Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27include: sbi: Remove extid parameter from vendor_ext_provider() callbackAnup Patel4-9/+8
The extid parameter of vendor_ext_provider() is redundant so let us remove it. Signed-off-by: Anup Patel <apatel@ventanamicro.com>
2023-02-27lib: sbi: Align SBI vendor extension id with mvendorid CSRAnup Patel4-25/+31
As-per the SBI specification, the lower 24bits of the SBI vendor extension id is same as lower 24bits of the mvendorid CSR. We update the SBI vendor extension id checking based on above. Signed-off-by: Anup Patel <apatel@ventanamicro.com>
2023-02-27lib: sbi_hart: Enable hcontext and scontextNylon Chen2-0/+3
According to the description in "riscv-state-enable[0]", to access h/scontext in S-Mode, we need to enable the 57th bit. If it is not enabled, an "illegal instruction" error will occur. Link: https://github.com/riscv/riscv-state-enable/blob/a28bfae443f350d5b4c42874f428367d5b322ffe/content.adoc [0] Signed-off-by: Nylon Chen <nylon.chen@sifive.com> Reviewed-by: Zong Li <zong.li@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27docs: fix typo in fw.mdShengyu Qu1-1/+1
In docs/firmware/fw.md, there's a configuration parameter called FW_TEXT_ADDR, which actually should be FW_TEXT_START, so fix it. Signed-off-by: Shengyu Qu <wiagn233@outlook.com> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27lib: utils: fdt_fixup: Fix compile errorXiang W1-5/+8
When building with GCC-10 or older versions, it throws the following error: CC-DEP platform/generic/lib/utils/fdt/fdt_fixup.dep CC platform/generic/lib/utils/fdt/fdt_fixup.o lib/utils/fdt/fdt_fixup.c: In function 'fdt_reserved_memory_fixup': lib/utils/fdt/fdt_fixup.c:376:2: error: label at end of compound statement 376 | next_entry: | ^~~~~~~~~~ Remove the goto statement. Resolves: https://github.com/riscv-software-src/opensbi/issues/288 Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Signed-off-by: Xiang W <wxjstz@126.com> Reviewed-by: Anup Patel <anup@brainfault.org> Reviewed-by: Bin Meng <bmeng@tinylab.org>
2023-02-27include: fdt/fdt_helper: Change fdt_get_address() to return root.next_arg1Bin Meng1-2/+2
In sbi_domain_finalize(), when locating the coldboot hart's domain, the coldboot hart's scratch->arg1 will be overwritten by the domain configuration. However scratch->arg1 holds the FDT address of the coldboot hart, and is still being accessed by fdt_get_address() in later boot process. scratch->arg1 could then contain completely garbage and lead to a crash. To fix this, we change fdt_get_address() to return root domain's next_arg1 as the FDT pointer. Resolves: https://github.com/riscv-software-src/opensbi/issues/281 Fixes: b1678af210dc ("lib: sbi: Add initial domain support") Reported-by: Marouene Boubakri <marouene.boubakri@nxp.com> Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27platform: generic/andes: Fix ae350.c header dependencyBin Meng1-0/+1
The code calls various macros from riscv_asm.h which is not directly included. Fix such dependency. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27platform: generic/allwinner: Fix sun20i-d1.c header dependencyBin Meng1-0/+2
The code calls various macros from riscv_asm.h and sbi_scratch.h which are not directly included. Fix such dependency. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-27lib: utils/fdt: Fix fdt_pmu.c header dependencyBin Meng1-0/+1
The code calls sbi_scratch_thishart_ptr() from sbi_scratch.h which is not directly included. Fix such dependency. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-10lib: sbi: Speed-up sbi_printf() and friends using nputs()Anup Patel1-22/+54
The sbi_printf() is slow for semihosting because it prints one character at a time. To speed-up sbi_printf() for semihosting, we use a temporary buffer and nputs(). Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
2023-02-10lib: utils/serial: Implement console_puts() for semihostingAnup Patel1-0/+37
We implement console_puts() for semihosting serial driver to speed-up semihosting based prints. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
2023-02-10lib: sbi: Add console_puts() callback in the console deviceAnup Patel2-7/+25
We add console_puts() callback in the console device which allows console drivers (such as semihosting) to implement a specialized way to output character string. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
2023-02-10lib: sbi: Implement SBI debug console extensionAnup Patel3-0/+79
We implement SBI debug console extension as one of the replacement SBI extensions. This extension is only available when OpenSBI platform provides a console device to generic library. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Bin Meng <bmeng@tinylab.org>
2023-02-10lib: sbi: Add sbi_domain_check_addr_range() functionAnup Patel2-0/+84
We add sbi_domain_check_addr_range() helper function to check whether a given address range is accessible under a particular domain. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
2023-02-09lib: sbi: Add sbi_ngets() functionAnup Patel2-0/+17
We add new sbi_ngets() which help us read characters into a physical memory location. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
2023-02-09lib: sbi: Add sbi_nputs() functionAnup Patel2-0/+14
We add new sbi_nputs() which help us print a fixed number of characters from a physical memory location. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Xiang W <wxjstz@126.com>
2023-02-09include: Add defines for SBI debug console extensionAnup Patel1-0/+6
We add SBI debug console extension related defines to the SBI ecall interface header. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Xiang W <wxjstz@126.com>