summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2019-04-03kendryte/k210: Fix file headersDamien Le Moal5-5/+25
Add missing SPDX and copyright information. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2019-04-03README: Update license informationDamien Le Moal2-0/+217
Add information regarding the Apache License Version 2.0 of some of the Kendryte/k210 platform files. Also repeat this information in a new ThirdPartyNotices.md file. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2019-04-01include: Make mstatus parameter optional for get_insn()Anup Patel3-12/+8
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 <anup.patel@wdc.com>
2019-04-01include: Rename sbi_unpriv.h to riscv_unpriv.hAnup Patel4-5/+5
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 <anup.patel@wdc.com>
2019-04-01lib: Remove unused mepc arg from load_xyz() and store_xyz() functionsAnup Patel3-20/+18
This patch removes unused mepc arg from load_xyz() and store_xyz() unpriviledge access functions. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-03-29lib: Disable the boot prints if SBI_SCRATCH_NO_BOOT_PRINTS is setBin Meng3-1/+23
Use the newly introduced "options" in "struct sbi_scratch" to conditionally disable the boot prints. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2019-03-29lib: Group all prints during boot into sbi_boot_prints()Bin Meng1-24/+31
Refactor the codes a little bit to put all prints during boot into sbi_boot_prints(). Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2019-03-29firmware: Introduce "options" in "struct sbi_scratch"Bin Meng3-0/+14
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 <bmeng.cn@gmail.com>
2019-03-18platform: plic: Fix comments of programming the interrupt enable registerBin Meng1-1/+2
The codes that currently program the interrupt enable register for S-mode disagrees with what the comments say. Fix the comments. While we are here, add one line comment to describe what is done for M-mode too. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2019-03-14lib: Return ENOTSUPP incase of invalid SBI function IDAtish Patra1-0/+2
OpenSBI should show error trace only if any valid SBI function does not perform as expected. However, OpenSBI should show notify the caller with a negative error if given SBI function ID is not valid. Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-03-14platform: plic: Bypass interrupt ID 0's priority programmingBin Meng1-1/+1
Per PLIC spec, interrupt ID 0 is defined to mean "no interrupt". We should bypass it. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2019-03-14platform: plic: Fix plic_set_priority()Bin Meng1-1/+4
At present plic_set_priority() ignores the 'source' and the priority register to be programmed is constant. Fix it. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2019-03-14firmware: Move scratch setup to _start instead of _start_warmAtish Patra1-31/+60
Scratch space setup needs to be done once for reboot for each hart. _start_warm may be called several times if hart hotplug is implemented. Move scratch space setup to the beginning so that it is done only once. Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-03-14lib: Fix full tlb flush behaviorAtish Patra1-10/+15
Currently, global page mappings are not flushed if start and size arguments are zero. Flush entire TLB if both size and start argument is passed as zero. Fixes : 90cb491 (lib: Implement sfence.vma correctly) Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-03-13platform: fu540: Fix cosmetic styling issuesBin Meng1-3/+3
There are some spaces or mixed usage of spaces and tabs in the macro definition. Change to use tab consistently. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2019-03-13docs: firmware: Fix spelling of U-BootBin Meng1-2/+2
It's U-Boot, not U-boot. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2019-03-12lib: Implement sfence.vma correctly.Atish Patra6-15/+105
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 <atish.patra@wdc.com>
2019-03-10lib: Create a sbi_ipi_data structureAlistair Francis3-11/+21
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 <alistair.francis@wdc.com>
2019-03-07firmware: Reset all registers and flush icacheAtish Patra1-0/+4
A warm reset using reset button may put icache and registers in non-coherent state. Flush the icache and reset all registers for every hart. Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-03-07firmware: Add nop to reduce bus traffic.Atish Patra1-0/+4
All the non-boot harts run in a tight loop which may cause a heavy load on the memory bus. This may delay the boot hart to complete the cold boot process. Introduce few nop that will ease up the traffic. Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-03-07Revert "firmware: Add a barrier instruction for wait for boot hart"Atish Patra1-1/+0
This reverts commit 05602e2bf4812533adcb7acb1a67e43726c0e7bb. Introducing a fence causes warm reset issue to reappear. Revert it for the time being.
2019-03-06platform: Make the `platform` read-onlyXiang Wang11-43/+45
platform should be a read-only variable, if it is placed in the data segment, it may be exploited. Signed-off-by: Xiang Wang <wxjstz@126.com>
2019-03-06firmware: Reset all the general purpose registers to zero.Atish Patra1-0/+41
A warm reset by pressing the reset button may not initialize all the registers to zero. Do it for every hart during warm boot. Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-03-06firmware: Ensure the mtvec is updated.Atish Patra1-0/+5
Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-03-06firmware: Fix a typoAtish Patra1-1/+1
Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-03-05lib:platform: Fix sbi_getc return type.Atish Patra11-19/+20
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 <xerpi.g.12@gmail.com> Suggested-by:Thadeu Lima de Souza Cascardo <cascardo@cascardo.eti.br> Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-03-05firmware: Add a barrier instruction for wait for boot hartXiang Wang1-0/+1
Multi-core communication via memory requires the addition of a barrier instructions to ensure cache coherency. Signed-off-by: Xiang Wang <wxjstz@126.com>
2019-03-05firmware: Move _boot_hart_done to the data sectionXiang Wang1-6/+5
Writable code section can cause some security problems, so move _boot_hart_done to the data section Signed-off-by: Xiang Wang <wxjstz@126.com>
2019-03-05Add tags to .gitignore for being development friendlyXiang Wang1-0/+3
Signed-off-by: Xiang Wang <wxjstz@126.com>
2019-02-28Fix missing quotes in MakefileAndreas Schwab1-1/+1
2019-02-28Fix makefile dependency generationAndreas Schwab1-2/+2
2019-02-26include: Bump-up version to 0.3v0.3Anup Patel1-1/+1
This patch updates OpenSBI version to 0.3 as part of release preparation. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-02-26Makefile: Set the platform variables before parsing the platformsAlistair Francis1-8/+10
Ensure the platform variable PLATFORM_RISCV_XLEN is set before we parse the platform files. This fixes the 32-bit openSBI FW_JUMP_ADDR. Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2019-02-22include: Bump-up version to 0.2v0.2Anup Patel1-1/+1
This patch increases OpenSBI version to 0.2. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-02-22scripts: Add script for creating binary archiveAnup Patel1-0/+135
This patch adds scripts/create-binary-archive.sh which helps us create a common tarball containing headers, static library and firmware ELFs for all platforms. This script can be used for release purpose OR for compile testing all platforms. Example usage commands are as follows: 1) Binary release archive for 32bit systems ./scripts/create-binary-archive.sh -s "bin" -x 32 -d 2) Binary release archive for 64bit systems ./scripts/create-binary-archive.sh -s "bin" -d 3) Compile test for 32bit systems ./scripts/create-binary-archive.sh -x 32 -t 4) Compile test for 64bit systems ./scripts/create-binary-archive.sh -t Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-02-22Makefile: Rename compile_ld() to compile_elf()Anup Patel1-7/+7
The compile_ld() is actually used to create ELF files so the name is misleading hence this patch renames it to compile_elf(). We also rename LDFLAGS to ELFFLAGS because these will be used for ELF creation only. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-02-22doc: Fix root partition details for fu540.Atish Patra1-1/+5
Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-02-20firmware: Improve low-level trap handler for M-mode to M-mode trapsAnup Patel2-39/+57
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 <anup.patel@wdc.com>
2019-02-20include: Add PRILX define to help print unsigned longAnup Patel2-18/+20
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 <anup.patel@wdc.com>
2019-02-19template: Fix some callback namesSergi Granell1-3/+3
2019-02-19template: Remove trailing ';'Sergi Granell1-1/+1
2019-02-19template: Fix typo in platform_final_initSergi Granell1-1/+1
There was a space instead of '_' in the function `platform_final_init`.
2019-02-19docs: Update unleashed platform guide.Atish Patra1-35/+116
Following updates to fu540 platform guide. 1. Update a section about flashing the firmware binary to sdcard with correct partition identifier. 2. Refer the individual payload section. 3. Update uboot booting section. Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-02-19docs: Add a payload section describing different payloads.Atish Patra4-2/+68
Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-02-19docs: Wrap text to 80 columns.Atish Patra1-3/+8
Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-02-19docs: Update about toolchain section.Atish Patra1-0/+10
Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-02-19Makefile: Use sed instead of awk to parse OpenSBI versionAnup Patel1-2/+2
This patch replaces use of awk with sed in top-level makefile to parse OpenSBI version from include/sbi/sbi_version.h. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-02-19Makefile: Fix error evaluating OPENSBI_CC_XLENAnup Patel1-25/+25
We get following error evaluating OPENSBI_CC_XLEN on Ubuntu-18.04: /bin/sh: 1: Bad substitution This patch fixes above error by using "awk" in string assigned to OPENSBI_CC_XLEN and it also moves "Setup compilation commands" before OPENSBI_CC_XLEN. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-02-18lib: Fix mask shift in sbi_ipi_send_many()Anup Patel1-1/+1
The mask shift in for-loop of sbi_ipi_send_many() is broken with commit 918c1354b75c74b62f67c4e929551d643f035443 ("lib: Improve delivery of SBI_IPI_EVENT_HALT") This patch fix it. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-02-18lib: Fix small typo on sbi_ipi.cNick Kossifidis1-1/+1