summaryrefslogtreecommitdiff
path: root/platform
AgeCommit message (Collapse)AuthorFilesLines
2019-02-14platform: Use CSR_<FOO> instead of <foo> for csr_*()Atish Patra1-1/+1
Some older toolchains may not have all the csr's defined. Update all the csr functions to use the CSR_ #define values instead of the toolchain defined values. Suggested-by: Olof Johansson <olof@lixom.net> Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-02-12Makefile: Set ABI, ISA and Code Model in top-level makeAnup Patel5-25/+20
This patch introduces following optional PLATFORM options: PLATFORM_RISCV_XLEN -> RISC-V register width PLATFORM_RISCV_ABI -> RISC-V GCC ABI PLATFORM_RISCV_ISA -> RISC-V GCC ISA string PLATFORM_RISCV_CODE_MODEL -> RISC-V GCC Code Model If the above options are not provided by platform config.mk or by command-line parameters then: 1. PLATFORM_RISCV_XLEN will be determined using toolchain capability 2. PLATFORM_RISCV_ABI, PLATFORM_RISCV_ISA, and PLATFORM_RISCV_CODE_MODEL is set to value best suited for generic libsbi.a As a result of these optional PLATFORM options, the platform-cflags-y and platform-asflags-y is further simplified for platform config.mk. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-02-12platform: qemu: Set FW_JUMP_ADDR and FW_PAYLOAD_OFFSET as-per XLENAnup Patel2-6/+28
The current 4MB aligned FW_JUMP_ADDR and FW_PAYLOAD_OFFSET breaks U-Boot on QEMU virt and sifive_u machines. Instead of using 4MB aligned for both 32bit and 64bit systems, we use different values based compiler XLEN. Another advantage of this approach will be that our fw_payload.bin will smaller for 64bit systems. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-02-12platform: template: Improve comments for FW_JUMP_ADDR and FW_PAYLOAD_OFFSETAnup Patel1-3/+13
Both FW_JUMP_ADDR and FW_PAYLOAD_OFFSET, should be: 1. 4MB aligned for 32bit system 2. 2MB aligned for 64bit system Explicitly specify the above details in config.mk comments for template platform. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-02-08platform: clint: Allow running on 32-bit systemsAlistair Francis1-0/+24
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2019-02-08platform: qemu/virt: Move kernel start address to 4MB allignedAlistair Francis1-2/+4
In order to support 32-bit guests move the start address to a 4MB allignment. As 64-bit kernels have a requirement on being 2MB alligned let's just make this the default for both 32 and 64 bit kernels. Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2019-02-08platform: template: Move kernel start address to 4MB allignedAlistair Francis1-2/+4
In order to support 32-bit guests move the start address to a 4MB allignment. As 64-bit kernels have a requirement on being 2MB alligned let's just make this the default for both 32 and 64 bit kernels. Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2019-02-08platform/qemu/virt: Dynamically calculate xlenAlistair Francis2-2/+13
The QEMU virt machine can be either 32 or 66 bit. Don't hard code the CPU bit length and instead let the compiler determine it. Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2019-01-29platform: fu540: Provide a compile time option selective hart booting.Atish Patra2-2/+13
Currently, only hart 1 is enabled for fu540 platform to support U-boot. Introduce a compile time FU540_ENABLED_HART_MASK option so that specific harts can be selected for booting. As fu540 is a multicore, we should boot all cores by default except hart 0. Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-01-24platform: add template platform filesDamien Le Moal3-0/+319
Create commented template files to use as a base for new platforms support implementation. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2019-01-24all: Update copyright header in all filesAnup patel31-93/+93
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 <anup.patel@wdc.com>
2019-01-23include: Rename ipi_inject() to ipi_send() for sbi_platformAnup Patel6-6/+6
For better naming, we rename ipi_inject() to ipi_send() in struct sbi_platform. We also replace term "inject" with "send" in all related places. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-01-23include: Drop MMIO from SBI_PLATFORM_HAS_MMIO_TIMER_VALUEAnup Patel1-1/+1
It is not necessary that platform has MMIO-based timer value register. It can also have some custom (implementation specific) CSR for timer value. This patch renames SBI_PLATFORM_HAS_MMIO_TIMER_VALUE to SBI_PLATFORM_HAS_TIMER_VALUE to imply "platform timer value" instead of "mmio timer value". Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-01-23lib: Remove target_hart and hartid parameter from TIMER callbacksAnup Patel6-14/+20
The target_hart and hartid paramter of TIMER callbacks is not required because it always current hartid which can be obtained using sbi_current_hartid() API. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-01-23lib: Remove hartid parameter from IRQCHIP callbacksAnup Patel4-4/+12
The hartid parameter in IRQCHIP callbacks of sbi_platform is not required because current hartid can be determined using sbi_current_hartid() API. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-01-23lib: Remove source_hart and hartid parameter from IPI callbacksAnup patel6-21/+22
The source_hart and hartid parameter is really not required in IPI callbacks of sbi_platform because current hartid can always be obtained by calling sbi_current_hartid() API. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-01-23lib: Remove hartid paramter from early_init() and final_init() callbacksAnup Patel3-3/+3
We simplify early_init() and final_init() callbacks of sbi_platform by removing "hartid" parameter. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-01-21kendryte/k210: Add device tree supportDamien Le Moal3-0/+72
The Kendryte k210 board initial loader does not provide a device tree for the firmware and subsequent payload. Add the k210.dts device tree description file to solve this. This file describes only the SoC core components: CPUs, memory and PLIC. Automatically compile and add this file to the firmware generated using the FW_PAYLOAD_FDT_PATH configuration parameter. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2019-01-21kendryte/k210: Fix consoleDamien Le Moal1-3/+7
Clear console input when intializing it. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2019-01-21build: Introduce FW_PAYLOAD_ALIGNDamien Le Moal1-3/+1
The firmware payload offset defined by FW_PAYLOAD_OFFSET must specify a value large enough so the the payload does not overlap with the base firmware data, bss and text. For platforms without any strong requirement on the payload address, introduce the FW_PAYLOAD_ALIGN build parameter to automatically place the payload right after the base firmware at an address aligned with the defined value. Either FW_PAYLOAD_OFFSET or FW_PAYLOAD_ALIGN should be defined by a platform configuration. If both FW_PAYLOAD_OFFSET and FW_PAYLOAD_ALIGN are defined by a platform, FW_PAYLOAD_OFFSET has precedence and is used for building the final firmawre image. Using FW_PAYLOAD_ALIGN=4096 with the Kendryte platform rather than the abitrary FW_PAYLOAD_OFFSET=0x10000 value reduces the final firmware image size by about 20KB. Add a description of the FW_PAYLOAD_ALIGN configuration parameter in the fw_payload documentation file as well. And while at it, also fix various grammar and style issues in that file.. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2019-01-18platform: Fix compile error caused by standard includesAnup Patel5-15/+60
Avoid using standard includes namely stdint.h, string.h, stdlib.h, etc. All standard include except stddef.h give compilation error due to differences in RISC-V toolchain configuration. Typically, the compilation error is related to "gnu-stubs-lp64.h". This patch fixes compile error caused by standard includes by providing substitutes of definetions provided by standard includes wherever required. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2019-01-18platform: No need to pass context id for plic fixup.Atish Patra5-17/+11
PLIC DT entry fixup can be done by comparing external interrupt number instead of context id. No need to invoke fixup for each plic context. Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-01-18platform: Modify DT using libfdtAtish Patra1-4/+37
Perform following DT updates. 1. Mask hart if mmu is not supported. 2. Add stdout-path under chosen node. Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-01-18platform: Remove string functions from tinyfdt.cAtish Patra5-26/+18
There are couple of string function defined in platform code. We no longer need them as we can directly link minimal libc. Every platform required to inclde this as PLIC driver required libc functions. Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-01-18platform: Include libfdt & libc.Atish Patra2-0/+5
Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-01-18platform: Rename fdt.c to tinyfdt.cAtish Patra4-2/+2
Libfdt already have fdt.c and fdt.h. Rename both fdt.* present in openSBI to tinyfdt.* Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-01-18platform: Add libfdt support.Atish Patra17-0/+5875
Some of the platform (i.e. SiFive FU540) requires Device Tree modification before it is passed to higher stages. Add libfdt support now to help this process. Libfdt should only be included per platform basis. Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-01-18platform: Add minimal libc support.Atish Patra2-0/+185
libfdt requires minimal libc support. Absoultely minimum functions are added in libc. Signed-off-by: Atish Patra <atish.patra@wdc.com>
2019-01-03platform: kendryte/k210: Simplify sysctl codeDamien Le Moal3-1909/+20
Simplify sysctl.c code to only the used CPU freqency function. This reduces the size of the final firmware by 4KB. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2019-01-03platform: kendryte/k210: Declare local function staticDamien Le Moal1-2/+2
k210_console_putc() and k210_console_init() are local functions. Declare them as static. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-31platform: Fix author name for Kendryte K210 platformAnup Patel3-3/+3
The Kendryte K210 platform support was contributed by Damien hence fix author name. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-31platform: Rename sifive/hifive_u540 to sifive/fu540Anup Patel4-174/+174
We rename sifive/hifive_u540 platform support to sifive/fu540 to match the SoC name which is SiFive FU540 (as-per user manual). In fact, we can expect no (or very minimal) board specific quirks in sifive/fu540 platform support. These board specific quirks can be turned on/off in-future using PLATFORM_<xyz> make command-line option. Signed-off-by: Anup Patel <anup.patel@wdc.com> Signed-off-by: Atish Patra <atish.patra@wdc.com>
2018-12-27lib: Rename target_hart parameter to hartid for PMP platform callbacksAnup Patel3-6/+6
We rename target_hart parameter of PMP platform callbacks to hartid for clarity because the parameter represents current hartid. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-27lib: Simplify sbi_platform timer_init() hooksAnup Patel4-19/+48
Instead of having separate timer_init() hooks for cold and warm boot, this patch updates struct sbi_platform to have just one timer_init() hook. The type of boot (cold or warm) is now a boolean flag parameter for the updated timer_init() hook. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-27lib: Simplify sbi_platform ipi_init() hooksAnup Patel4-19/+49
Instead of having separate ipi_init() hooks for cold and warm boot, this patch updates struct sbi_platform to have just one ipi_init() hook. The type of boot (cold or warm) is now a boolean flag parameter for the updated ipi_init() hook. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-27lib: Simplify sbi_platform irqchip_init() hooksAnup Patel4-50/+59
Instead of having separate irqchip_init() hooks for cold and warm boot, this patch updates struct sbi_platform to have just one irqchip_init() hook. The type of boot (cold or warm) is now a boolean flag parameter for the updated irqchip_init() hook. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-27lib: Simplify sbi_platform early_init() and final_init() hooksAnup Patel4-11/+21
Instead of having separate early_init() and final_init() hooks for cold and warm boot, this patch updates struct sbi_platform to have just one early_init() and one final_init() hook. The type of boot (cold or warm) is now a boolean flag parameter for the updated early_init() and final_init() hooks. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-22platform: Remove PLAT_HART_COUNT and PLAT_HART_STACK_SIZEAnup Patel9-40/+40
The PLAT_HART_COUNT and PLAT_HART_STACK_SIZE are only used by platform code so no need of exposing these to everyone by adding it to platform-cppflags-y. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-22platform: Remove PLAT_NAME from all platformsAnup Patel8-8/+4
The PLAT_NAME is used only in platform.c for all platforms hence remove it. Signed-off-by: Anup Patel <anup.patel@wdc.com>
2018-12-22Disable all interrupts during warm irqchip init.Atish Patra1-1/+6
M mode is not expected to recieve any interrupts. S mode interrupts shouldn't be enabled in M mode. Signed-off-by: Atish Patra <atish.patra@wdc.com>
2018-12-22Introduce hart disabled parameter in platform.Atish Patra4-0/+6
As of now, uboot doesn't have support for SMP. Moreover, unleashed board has a E51 hart which doesn't not support S mode. We should only boot only 1 non-zero hart. Signed-off-by: Atish Patra <atish.patra@wdc.com>
2018-12-22Fix plic warm init in platform code.Anup Patel4-7/+49
Pass S-Mode and M-mode context id separately to common warm init. Signed-off-by: Atish Patra <atish.patra@wdc.com> Signed-off-by: Anup Patel <anup.patel@wdc.com>
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 Moal1-1/+1
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-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-21Update Kendryte k210 supportDamien Le Moal7-1441/+169
Booting now. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2018-12-21Refine platform features controlDamien Le Moal3-3/+3
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-21top: Rename "plat" to "platform" everywhereAnup Patel31-0/+6047
This patch renames "plat" to "platform" everywhere for better readablility. Signed-off-by: Anup Patel <anup.patel@wdc.com>