summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-12-22Fix plic warm init in common code.Anup Patel2-27/+25
Unleashed doesn't have S mode for hart 0. PLIC register base calculation is current wrong because of that. Signed-off-by: Atish Patra <atish.patra@wdc.com> Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-22Move hardcoded uart constant to macros.Atish Patra2-2/+7
Signed-off-by: Atish Patra <atish.patra@wdc.com>
2018-12-21Introduce HAS_MFAULTS_DELEGATION featureDamien Le Moal3-7/+13
Conditionnally delegate page fault exceptions from M mode to S mode based on the platform features. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-21platform: kendryte/k210: Don't include math.hAnup Patel1-1/+0
The math.h is not required anymore and it also gives compile error for certain toolchains hence thsi patch removes math.h include from kendryte/k210/sysctl.c. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-21firmware: Remove redundant write to mideleg and medelegAnup Patel1-2/+0
The mideleg and medeleg are already programmed in delegate_traps() so no need to set it here. Any CSR setup in our reference firmware becomes a requirement for bootloader linking to libsbi.a so we should have minimum possible CSR setup in our reference firmware. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-21Revert "Fix FDT relocation"Anup Patel1-2/+0
This patch reverts "Fix FDT relocation" because it breaks fw_jump firmware. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-21lib: Remove prints from sbi_hart_switch_mode()Anup Patel1-8/+1
The sbi_hart_switch_mode() will be used by CPU hotplug. This means if we have prints in sbi_hart_switch_mode() then these prints will mix with Linux prints. Being a runtime firmware, we should be verbose only at coldboot time and error situations. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-21lib: Fix delegate_traps() for Linux bootAnup Patel1-0/+3
commit d403c70fb11fb55042ca3cef0dbe399ed87cc79b breaks Linux booting because of fewer exceptions delegated to S-mode. This patch fixes Linux booting by having all required exceptions delegated to S-mode. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-21console: protect output with a spinlockDamien Le Moal1-9/+11
Avoid getting messages from multiple harts mingled into garbage text with a spinlock serializing calls to sbi_puts() and sbi_printf(). Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-21Kendryte-k210: Remove unnecessary asm functionsDamien Le Moal2-41/+10
Use functions defined in sbi/riscv_asm.h. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-21Introduce sbi_current_hartid()Damien Le Moal4-4/+15
Use this helper instead of hardcoding csr_read(mhartid). Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-21Cleanup and rename sbi_hart_boot_next()Damien Le Moal3-18/+33
Cleanup sbi_hart_boot_nexti() code, adding messages for clarity and rename the function to sbi_hart_switch_mode() to reflect what the function actually does. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-21Fiw comment typoDamien Le Moal1-1/+1
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-21Update Kendryte k210 supportDamien Le Moal7-1441/+169
Booting now. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-21Fix interrupt and exception delegationDamien Le Moal1-11/+13
When S mode is not supported, simply clear mideleg and medeleg. Otherwise, set delegation from M-mode to S-mode, removing the page fault exceptions as those would not happen in M-mode. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-21Add a hang messageDamien Le Moal1-0/+2
Make it clear that the end of the FW execution was reached without the hand being passed to any payload. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-21Add a bannerDamien Le Moal1-1/+14
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-21fw: Disable delegationDamien Le Moal1-0/+2
Also disable interrupts and exceptions delegation when clearing mie and mip. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-21Fix FDT relocationDamien Le Moal1-0/+2
Or rather, disable it if FW_PAYLOAD_FDT_ADDR is not defined. This correspond to cases where the underlying FW that loaded and started opensbi did not provide any FDT. In such case, the platform code will need to prepare one. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-21Refine platform features controlDamien Le Moal7-26/+45
Allow a platform to report its supported features in more details. The new features defined are: * SBI_PLATFORM_HAS_PMP * SBI_PLATFORM_HAS_SCOUNTEREN * SBI_PLATFORM_HAS_MCOUNTEREN In addition, define the macro SBI_PLATFORM_DEFAULT_FEATURES as the set of features that are generally expected to be supported by a Linux capable platform. Operations touching the features controlled with these falgs are not executed if the platform does not set the corresponding feature flags. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-21lib: Hang in sbi_hart_boot_next() if next mode is not supportedAtish Patra1-0/+4
We should not jump to next stage if next mode (S-mode or U-mode) is not supported by HART. Signed-off-by: Atish Patra <atish.patra@wdc.com> Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-21top: Rename "plat" to "platform" everywhereAnup Patel33-92/+92
This patch renames "plat" to "platform" everywhere for better readablility. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-21lib: Introduce bitmap to track HARTs waiting for coldbootAnup Patel1-5/+16
On QEMU Virt, max supported HARTs are 8 but number of HARTs actually depend on "-smp" command-line parameter passed to QEMU. This creates problems in sbi_hart_wake_coldboot_harts() because when number of HARTs are less than 8. To tackle this, we introduce a bitmap to track HARTs waiting for coldboot to finish. We wake only those HARTs who have set their bit in coldboot bitmap. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-21top: Rename "blob" to "firmware" everywhereAnup Patel12-63/+63
This patch renames "blob" to "firmware" everywhere for better and intutive naming. Signed-off-by: Anup Patel <anup@brainfault.org>
2018-12-21lib: sbi_hart: Remove unwanted sbi_printf()Anup Patel1-5/+3
This patch removes unwanted sbi_printf() from sbi_hart_wait_for_coldboot(). Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-21docs: Add documentation for firmware blobsAnup Patel2-0/+88
This patch adds documentation for fw_jump and fw_payload firmware blobs. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-21top: More detailed top-level README.mdAnup Patel1-21/+65
This patch adds more details to top-level README.md based on current state of OpenSBI. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-21Merge pull request #1 from riscv/atish_fix_1Anup Patel8-25/+79
Various fixes for unleashed board
2018-12-21Support unsigned long in sbi_printfAtish Patra1-1/+6
Signed-off-by: Atish Patra <atish.patra@wdc.com>
2018-12-21Use wfi for coldboot finish call.Atish Patra4-18/+24
Signed-off-by: Atish Patra <atish.patra@wdc.com>
2018-12-21Fix baud rate divisor computation for U540.Atish Patra2-5/+46
Signed-off-by: Atish Patra <atish.patra@wdc.com>
2018-12-21Support /r/n as newline character.Atish Patra1-0/+2
Signed-off-by: Atish Patra <atish.patra@wdc.com>
2018-12-21HiFive Unleashed has 5 harts. Fix the config to reflect that.Atish Patra1-1/+1
Signed-off-by: Atish Patra <atish.patra@wdc.com>
2018-12-20plat: kendryte/k210: Enable fw_payload in config.mkAnup Patel1-6/+3
We can only use fw_payload blob on Kendryte K210 board because there is no previous booting stage hence this patch enables fw_payload for Kendryte K210 board. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-20plat: Add Kendryte k210 initial supportDamien Le Moal8-0/+4574
Only compiles for now, completely untested. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-20blob: Fix commentsDamien Le Moal1-2/+5
Add comments to assembler (not trivial to follow). Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-20Added .gitignoreDamien Le Moal1-0/+8
Ignore build and install directories Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-19blob: payload: Add FW_PAYLOAD_FDT_PATH optionAnup Patel4-7/+51
This patch extends fw_payload blob to provide FW_PAYLOAD_FDT_PATH option using which we can embed custom FDT in .text section of fw_payload blob. In other words, FW_PAYLOAD_FDT_PATH is an option to forcefully override FDT passed by previous booting stage in a1 register. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-19blob: Rename FW_xyz_FDT_OFFSET to FW_xyz_FDT_ADDRAnup Patel6-21/+16
Instead of placing FDT (passed by previous booting stage) at a location relative to next address we should have absolute location of placing FDT so that we more freedom of placing FDT. This will be particularly useful for platforms/boards with very less RAM (such as Kendryte board). Due to above motivation, we rename FW_xyz_FDT_OFFSET options to FW_xyz_FDT_ADDR options and use FW_xyz_FDT_ADDR options as absolute address for placing FDT. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-19blob: Rename PLAT_TEXT_START to FW_TEXT_STARTAnup Patel6-5/+9
The PLAT_TEXT_START is only used by our firmware blobs hence rename it to FW_TEXT_START. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-19blob: payload: Introduce FW_PAYLOAD_OFFSET compile time optionAnup Patel5-1/+7
This patch remove hard-coding of payload location in fw_payload.elf.ldS by adding compile-time option FW_PAYLOAD_OFFSET. With the new compile-time option, payload will be placed at PLAT_TEXT_START + FW_PAYLOAD_OFFSET address. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-19blob: Fix comment typosDamien Le Moal2-3/+3
Various typos fix. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-16plat: clint: Reduce use of atomic operation on IPI registersAnup Patel1-9/+4
Currently, we aggresively use atomic operation on CLINT IPI register. This patch simplify CLINT IPI APIs by reducing use of atomic operations. In future, we will gradually increase use of atomic operations for CLINT IPI APIs. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-16plat: Add separate platform support for QEMU sifive_u machineAnup Patel3-0/+155
The QEMU sifive_u machine is not excatly same as HiFive Unleashed board hence we add separate platform support for QEMU sifive_u machine. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-16lib: Don't emulate CSR read for misa and mhartidAnup Patel1-15/+0
Emulation of CSR read for misa and mhartid was a workaround for bootloader accessing these CSRs in S-mode. This patch removes CSR read emulation for misa and mhartid. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-11Initial commit.Anup Patel67-0/+6084
Signed-off-by: Anup Patel <anup.patel@wdc.com>