From 24b4d48674ad2dc088949cdf852231ab1e81f56b Mon Sep 17 00:00:00 2001 From: Anup Patel Date: Sat, 22 Dec 2018 11:15:37 +0530 Subject: [PATCH 1/5] platform: Remove PLAT_NAME from all platforms The PLAT_NAME is used only in platform.c for all platforms hence remove it. Signed-off-by: Anup Patel --- platform/kendryte/k210/config.mk | 1 - platform/kendryte/k210/platform.c | 2 +- platform/qemu/sifive_u/config.mk | 1 - platform/qemu/sifive_u/platform.c | 2 +- platform/qemu/virt/config.mk | 1 - platform/qemu/virt/platform.c | 2 +- platform/sifive/hifive_u540/config.mk | 1 - platform/sifive/hifive_u540/platform.c | 2 +- 8 files changed, 4 insertions(+), 8 deletions(-) diff --git a/platform/kendryte/k210/config.mk b/platform/kendryte/k210/config.mk index c0c36ea0..f800a41f 100644 --- a/platform/kendryte/k210/config.mk +++ b/platform/kendryte/k210/config.mk @@ -8,7 +8,6 @@ # # Essential defines required by SBI platform -platform-cppflags-y = -DPLAT_NAME="Kendryte K210" platform-cppflags-y+= -DPLAT_HART_COUNT=2 platform-cppflags-y+= -DPLAT_HART_STACK_SIZE=4096 diff --git a/platform/kendryte/k210/platform.c b/platform/kendryte/k210/platform.c index d3765d0e..4ef1a249 100644 --- a/platform/kendryte/k210/platform.c +++ b/platform/kendryte/k210/platform.c @@ -76,7 +76,7 @@ static int k210_system_shutdown(u32 type) struct sbi_platform platform = { - .name = STRINGIFY(PLAT_NAME), + .name = "Kendryte K210", .features = SBI_PLATFORM_HAS_MMIO_TIMER_VALUE, .hart_count = PLAT_HART_COUNT, diff --git a/platform/qemu/sifive_u/config.mk b/platform/qemu/sifive_u/config.mk index d4470cd0..c2668a8f 100644 --- a/platform/qemu/sifive_u/config.mk +++ b/platform/qemu/sifive_u/config.mk @@ -8,7 +8,6 @@ # # Essential defines required by SBI platform -platform-cppflags-y = -DPLAT_NAME="QEMU SiFive Unleashed" platform-cppflags-y+= -DPLAT_HART_COUNT=1 platform-cppflags-y+= -DPLAT_HART_STACK_SIZE=8192 diff --git a/platform/qemu/sifive_u/platform.c b/platform/qemu/sifive_u/platform.c index f01df1ef..c2dcafc8 100644 --- a/platform/qemu/sifive_u/platform.c +++ b/platform/qemu/sifive_u/platform.c @@ -100,7 +100,7 @@ static int sifive_u_system_down(u32 type) } struct sbi_platform platform = { - .name = STRINGIFY(PLAT_NAME), + .name = "QEMU SiFive Unleashed", .features = SBI_PLATFORM_DEFAULT_FEATURES, .hart_count = PLAT_HART_COUNT, .hart_stack_size = PLAT_HART_STACK_SIZE, diff --git a/platform/qemu/virt/config.mk b/platform/qemu/virt/config.mk index 8496e2d4..467b0576 100644 --- a/platform/qemu/virt/config.mk +++ b/platform/qemu/virt/config.mk @@ -8,7 +8,6 @@ # # Essential defines required by SBI platform -platform-cppflags-y = -DPLAT_NAME="QEMU Virt Machine" platform-cppflags-y+= -DPLAT_HART_COUNT=8 platform-cppflags-y+= -DPLAT_HART_STACK_SIZE=8192 diff --git a/platform/qemu/virt/platform.c b/platform/qemu/virt/platform.c index 9e006744..7b82e4e2 100644 --- a/platform/qemu/virt/platform.c +++ b/platform/qemu/virt/platform.c @@ -101,7 +101,7 @@ static int virt_system_down(u32 type) } struct sbi_platform platform = { - .name = STRINGIFY(PLAT_NAME), + .name = "QEMU Virt Machine", .features = SBI_PLATFORM_DEFAULT_FEATURES, .hart_count = PLAT_HART_COUNT, .hart_stack_size = PLAT_HART_STACK_SIZE, diff --git a/platform/sifive/hifive_u540/config.mk b/platform/sifive/hifive_u540/config.mk index f411fa9a..ecbf88c3 100644 --- a/platform/sifive/hifive_u540/config.mk +++ b/platform/sifive/hifive_u540/config.mk @@ -8,7 +8,6 @@ # # Essential defines required by SBI platform -platform-cppflags-y = -DPLAT_NAME="SiFive HiFive U540" platform-cppflags-y+= -DPLAT_HART_COUNT=5 platform-cppflags-y+= -DPLAT_HART_STACK_SIZE=8192 diff --git a/platform/sifive/hifive_u540/platform.c b/platform/sifive/hifive_u540/platform.c index 646ce273..395ad4ed 100644 --- a/platform/sifive/hifive_u540/platform.c +++ b/platform/sifive/hifive_u540/platform.c @@ -120,7 +120,7 @@ static int sifive_u_system_down(u32 type) } struct sbi_platform platform = { - .name = STRINGIFY(PLAT_NAME), + .name = "SiFive HiFive U540", .features = SBI_PLATFORM_DEFAULT_FEATURES, .hart_count = PLAT_HART_COUNT, .hart_stack_size = PLAT_HART_STACK_SIZE, From 1cf7ec9e3bbf287fc9d601d2346b9e73fda40a84 Mon Sep 17 00:00:00 2001 From: Anup Patel Date: Sat, 22 Dec 2018 12:02:31 +0530 Subject: [PATCH 2/5] firmware: Remove stack section from common linker script We don't need a separate stack section for per-HART stack instead we create per-HART stack at the end of firmware (i.e. after _fw_end symbol). Signed-off-by: Anup Patel --- firmware/fw_common.S | 61 +++++++++++++++++++++++++++++------------- firmware/fw_common.ldS | 12 --------- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/firmware/fw_common.S b/firmware/fw_common.S index 198aa0b9..4c11e852 100644 --- a/firmware/fw_common.S +++ b/firmware/fw_common.S @@ -122,18 +122,28 @@ _start_warm: csrw mie, zero csrw mip, zero - /* set MSIE bit to receive IPI */ + /* Set MSIE bit to receive IPI */ li a2, MIP_MSIP csrw mie, a2 + + /* Preload per-HART details + * s6 -> HART ID + * s7 -> HART Count + * s8 -> HART Stack Size + */ + csrr s6, mhartid + li s7, PLAT_HART_COUNT + li s8, PLAT_HART_STACK_SIZE + /* HART ID should be within expected limit */ - csrr a6, mhartid - li a5, PLAT_HART_COUNT - bge a6, a5, _start_hang + csrr s6, mhartid + bge s6, s7, _start_hang /* Setup scratch space */ - li a5, PLAT_HART_STACK_SIZE - la tp, _stack_end - mul a5, a5, a6 + la tp, _fw_end + mul a5, s7, s8 + add tp, tp, a5 + mul a5, s8, s6 sub tp, tp, a5 li a5, RISCV_SCRATCH_SIZE sub tp, tp, a5 @@ -143,6 +153,8 @@ _start_warm: REG_S zero, RISCV_SCRATCH_TMP0_OFFSET(tp) la a4, _fw_start la a5, _fw_end + mul t0, s7, s8 + add a5, a5, t0 sub a5, a5, a4 REG_S a4, RISCV_SCRATCH_FW_START_OFFSET(tp) REG_S a5, RISCV_SCRATCH_FW_SIZE_OFFSET(tp) @@ -180,18 +192,29 @@ _start_warm: .section .entry, "ax", %progbits .globl _hartid_to_scratch _hartid_to_scratch: - add sp, sp, -(2 * __SIZEOF_POINTER__) - REG_S a1, (sp) - REG_S a2, (__SIZEOF_POINTER__)(sp) - li a1, PLAT_HART_STACK_SIZE - la a2, _stack_end - mul a1, a1, a0 - sub a2, a2, a1 - li a1, RISCV_SCRATCH_SIZE - sub a0, a2, a1 - REG_L a1, (sp) - REG_L a2, (__SIZEOF_POINTER__)(sp) - add sp, sp, (2 * __SIZEOF_POINTER__) + add sp, sp, -(3 * __SIZEOF_POINTER__) + REG_S s0, (sp) + REG_S s1, (__SIZEOF_POINTER__)(sp) + REG_S s2, (__SIZEOF_POINTER__ * 2)(sp) + /* + * a0 -> HART ID (passed by caller) + * s0 -> HART Stack Size + * s1 -> HART Stack End + * s2 -> Temporary + */ + li s0, PLAT_HART_STACK_SIZE + li s2, PLAT_HART_COUNT + mul s2, s2, s0 + la s1, _fw_end + add s1, s1, s2 + mul s2, s0, a0 + sub s1, s1, s2 + li s2, RISCV_SCRATCH_SIZE + sub a0, s1, s2 + REG_L s0, (sp) + REG_L s1, (__SIZEOF_POINTER__)(sp) + REG_L s2, (__SIZEOF_POINTER__ * 2)(sp) + add sp, sp, (3 * __SIZEOF_POINTER__) ret .align 3 diff --git a/firmware/fw_common.ldS b/firmware/fw_common.ldS index 3761d62f..52771f8b 100644 --- a/firmware/fw_common.ldS +++ b/firmware/fw_common.ldS @@ -61,18 +61,6 @@ . = ALIGN(0x1000); /* Ensure next section is page aligned */ - .stack : - { - PROVIDE(_stack_start = .); - *(.stack) - *(.stack.*) - . = . + (PLAT_HART_STACK_SIZE * PLAT_HART_COUNT); - . = ALIGN(8); - PROVIDE(_stack_end = .); - } - - . = ALIGN(0x1000); /* Ensure next section is page aligned */ - .bss : { PROVIDE(_bss_start = .); From 58ca525a7d35b2d4cd7045fd343fb6d85567f01d Mon Sep 17 00:00:00 2001 From: Anup Patel Date: Sat, 22 Dec 2018 12:40:54 +0530 Subject: [PATCH 3/5] firmware: Don't depend on PLAT_HART_COUNT and PLAT_HART_STACK_SIZE The hart_count and hart_stack_size information is already available in "struct sbi_platform" so we use that instead of depending on PLAT_HART_COUNT and PLAT_HART_STACK_SIZE. Signed-off-by: Anup Patel --- firmware/fw_common.S | 10 ++++++---- include/sbi/riscv_asm.h | 5 +++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/firmware/fw_common.S b/firmware/fw_common.S index 4c11e852..d426f15f 100644 --- a/firmware/fw_common.S +++ b/firmware/fw_common.S @@ -132,8 +132,9 @@ _start_warm: * s8 -> HART Stack Size */ csrr s6, mhartid - li s7, PLAT_HART_COUNT - li s8, PLAT_HART_STACK_SIZE + la a4, platform + lwu s7, RISCV_PLATFORM_HART_COUNT_OFFSET(a4) + lwu s8, RISCV_PLATFORM_HART_STACK_SIZE_OFFSET(a4) /* HART ID should be within expected limit */ csrr s6, mhartid @@ -202,8 +203,9 @@ _hartid_to_scratch: * s1 -> HART Stack End * s2 -> Temporary */ - li s0, PLAT_HART_STACK_SIZE - li s2, PLAT_HART_COUNT + la s2, platform + lwu s0, RISCV_PLATFORM_HART_STACK_SIZE_OFFSET(s2) + lwu s2, RISCV_PLATFORM_HART_COUNT_OFFSET(s2) mul s2, s2, s0 la s1, _fw_end add s1, s1, s2 diff --git a/include/sbi/riscv_asm.h b/include/sbi/riscv_asm.h index 516bf6f9..045310b5 100644 --- a/include/sbi/riscv_asm.h +++ b/include/sbi/riscv_asm.h @@ -81,6 +81,11 @@ #define RISCV_SCRATCH_IPI_TYPE_OFFSET (9 * __SIZEOF_POINTER__) #define RISCV_SCRATCH_SIZE 256 +#define RISCV_PLATFORM_NAME_OFFSET (0x0) +#define RISCV_PLATFORM_FEATURES_OFFSET (0x40) +#define RISCV_PLATFORM_HART_COUNT_OFFSET (0x48) +#define RISCV_PLATFORM_HART_STACK_SIZE_OFFSET (0x4c) + #define RISCV_TRAP_REGS_zero 0 #define RISCV_TRAP_REGS_ra 1 #define RISCV_TRAP_REGS_sp 2 From 472d3f4e170814a2eda663a97b84728557a71757 Mon Sep 17 00:00:00 2001 From: Anup Patel Date: Sat, 22 Dec 2018 21:01:40 +0530 Subject: [PATCH 4/5] platform: Remove PLAT_HART_COUNT and PLAT_HART_STACK_SIZE 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 --- platform/kendryte/k210/config.mk | 5 +---- platform/kendryte/k210/platform.c | 10 +++++----- platform/kendryte/k210/platform.h | 5 ++++- platform/qemu/sifive_u/config.mk | 5 +---- platform/qemu/sifive_u/platform.c | 15 +++++++++------ platform/qemu/virt/config.mk | 5 +---- platform/qemu/virt/platform.c | 15 +++++++++------ platform/sifive/hifive_u540/config.mk | 5 +---- platform/sifive/hifive_u540/platform.c | 15 +++++++++------ 9 files changed, 40 insertions(+), 40 deletions(-) diff --git a/platform/kendryte/k210/config.mk b/platform/kendryte/k210/config.mk index f800a41f..512fc2ab 100644 --- a/platform/kendryte/k210/config.mk +++ b/platform/kendryte/k210/config.mk @@ -7,11 +7,8 @@ # SPDX-License-Identifier: BSD-2-Clause # -# Essential defines required by SBI platform -platform-cppflags-y+= -DPLAT_HART_COUNT=2 -platform-cppflags-y+= -DPLAT_HART_STACK_SIZE=4096 - # Compiler flags +platform-cppflags-y = platform-cflags-y =-mabi=lp64 -march=rv64imafdc -mcmodel=medany platform-asflags-y =-mabi=lp64 -march=rv64imafdc -mcmodel=medany platform-ldflags-y = diff --git a/platform/kendryte/k210/platform.c b/platform/kendryte/k210/platform.c index 4ef1a249..226cb775 100644 --- a/platform/kendryte/k210/platform.c +++ b/platform/kendryte/k210/platform.c @@ -38,7 +38,7 @@ static char k210_console_getc(void) static int k210_cold_irqchip_init(void) { return plic_cold_irqchip_init(PLIC_BASE_ADDR, PLIC_NUM_SOURCES, - PLAT_HART_COUNT); + K210_HART_COUNT); } static int k210_warm_irqchip_init(u32 core_id) @@ -50,12 +50,12 @@ static int k210_warm_irqchip_init(u32 core_id) static int k210_cold_ipi_init(void) { - return clint_cold_ipi_init(CLINT_BASE_ADDR, PLAT_HART_COUNT); + return clint_cold_ipi_init(CLINT_BASE_ADDR, K210_HART_COUNT); } static int k210_cold_timer_init(void) { - return clint_cold_timer_init(CLINT_BASE_ADDR, PLAT_HART_COUNT); + return clint_cold_timer_init(CLINT_BASE_ADDR, K210_HART_COUNT); } static int k210_system_reboot(u32 type) @@ -79,8 +79,8 @@ struct sbi_platform platform = { .name = "Kendryte K210", .features = SBI_PLATFORM_HAS_MMIO_TIMER_VALUE, - .hart_count = PLAT_HART_COUNT, - .hart_stack_size = PLAT_HART_STACK_SIZE, + .hart_count = K210_HART_COUNT, + .hart_stack_size = K210_HART_STACK_SIZE, .disabled_hart_mask = 0, .console_init = k210_console_init, diff --git a/platform/kendryte/k210/platform.h b/platform/kendryte/k210/platform.h index 6b520cf7..ddfdf15b 100644 --- a/platform/kendryte/k210/platform.h +++ b/platform/kendryte/k210/platform.h @@ -18,12 +18,15 @@ #include +#define K210_HART_COUNT 2 +#define K210_HART_STACK_SIZE 4096 + /* Register base address */ /* Under Coreplex */ #define CLINT_BASE_ADDR (0x02000000U) #define PLIC_BASE_ADDR (0x0C000000U) -#define PLIC_NUM_CORES (PLAT_HART_COUNT) +#define PLIC_NUM_CORES (K210_HART_COUNT) /* Under TileLink */ #define GPIOHS_BASE_ADDR (0x38001000U) diff --git a/platform/qemu/sifive_u/config.mk b/platform/qemu/sifive_u/config.mk index c2668a8f..630098e5 100644 --- a/platform/qemu/sifive_u/config.mk +++ b/platform/qemu/sifive_u/config.mk @@ -7,11 +7,8 @@ # SPDX-License-Identifier: BSD-2-Clause # -# Essential defines required by SBI platform -platform-cppflags-y+= -DPLAT_HART_COUNT=1 -platform-cppflags-y+= -DPLAT_HART_STACK_SIZE=8192 - # Compiler flags +platform-cppflags-y = platform-cflags-y =-mabi=lp64 -march=rv64imafdc -mcmodel=medany platform-asflags-y =-mabi=lp64 -march=rv64imafdc -mcmodel=medany platform-ldflags-y = diff --git a/platform/qemu/sifive_u/platform.c b/platform/qemu/sifive_u/platform.c index c2dcafc8..f593323a 100644 --- a/platform/qemu/sifive_u/platform.c +++ b/platform/qemu/sifive_u/platform.c @@ -14,6 +14,9 @@ #include #include +#define SIFIVE_U_HART_COUNT 1 +#define SIFIVE_U_HART_STACK_SIZE 8192 + #define SIFIVE_U_SYS_CLK 1000000000 #define SIFIVE_U_PERIPH_CLK (SIFIVE_U_SYS_CLK / 2) @@ -31,7 +34,7 @@ static int sifive_u_cold_final_init(void) u32 i; void *fdt = sbi_scratch_thishart_arg1_ptr(); - for (i = 0; i < PLAT_HART_COUNT; i++) + for (i = 0; i < SIFIVE_U_HART_COUNT; i++) plic_fdt_fixup(fdt, "riscv,plic0", 2 * i); return 0; @@ -71,7 +74,7 @@ static int sifive_u_cold_irqchip_init(void) { return plic_cold_irqchip_init(SIFIVE_U_PLIC_ADDR, SIFIVE_U_PLIC_NUM_SOURCES, - PLAT_HART_COUNT); + SIFIVE_U_HART_COUNT); } static int sifive_u_warm_irqchip_init(u32 target_hart) @@ -84,13 +87,13 @@ static int sifive_u_warm_irqchip_init(u32 target_hart) static int sifive_u_cold_ipi_init(void) { return clint_cold_ipi_init(SIFIVE_U_CLINT_ADDR, - PLAT_HART_COUNT); + SIFIVE_U_HART_COUNT); } static int sifive_u_cold_timer_init(void) { return clint_cold_timer_init(SIFIVE_U_CLINT_ADDR, - PLAT_HART_COUNT); + SIFIVE_U_HART_COUNT); } static int sifive_u_system_down(u32 type) @@ -102,8 +105,8 @@ static int sifive_u_system_down(u32 type) struct sbi_platform platform = { .name = "QEMU SiFive Unleashed", .features = SBI_PLATFORM_DEFAULT_FEATURES, - .hart_count = PLAT_HART_COUNT, - .hart_stack_size = PLAT_HART_STACK_SIZE, + .hart_count = SIFIVE_U_HART_COUNT, + .hart_stack_size = SIFIVE_U_HART_STACK_SIZE, .disabled_hart_mask = 0, .pmp_region_count = sifive_u_pmp_region_count, .pmp_region_info = sifive_u_pmp_region_info, diff --git a/platform/qemu/virt/config.mk b/platform/qemu/virt/config.mk index 467b0576..927422c1 100644 --- a/platform/qemu/virt/config.mk +++ b/platform/qemu/virt/config.mk @@ -7,11 +7,8 @@ # SPDX-License-Identifier: BSD-2-Clause # -# Essential defines required by SBI platform -platform-cppflags-y+= -DPLAT_HART_COUNT=8 -platform-cppflags-y+= -DPLAT_HART_STACK_SIZE=8192 - # Compiler flags +platform-cppflags-y = platform-cflags-y =-mabi=lp64 -march=rv64imafdc -mcmodel=medany platform-asflags-y =-mabi=lp64 -march=rv64imafdc -mcmodel=medany platform-ldflags-y = diff --git a/platform/qemu/virt/platform.c b/platform/qemu/virt/platform.c index 7b82e4e2..98357cfc 100644 --- a/platform/qemu/virt/platform.c +++ b/platform/qemu/virt/platform.c @@ -14,6 +14,9 @@ #include #include +#define VIRT_HART_COUNT 8 +#define VIRT_HART_STACK_SIZE 8192 + #define VIRT_TEST_ADDR 0x100000 #define VIRT_CLINT_ADDR 0x2000000 @@ -31,7 +34,7 @@ static int virt_cold_final_init(void) u32 i; void *fdt = sbi_scratch_thishart_arg1_ptr(); - for (i = 0; i < PLAT_HART_COUNT; i++) + for (i = 0; i < VIRT_HART_COUNT; i++) plic_fdt_fixup(fdt, "riscv,plic0", 2 * i); return 0; @@ -72,7 +75,7 @@ static int virt_cold_irqchip_init(void) { return plic_cold_irqchip_init(VIRT_PLIC_ADDR, VIRT_PLIC_NUM_SOURCES, - PLAT_HART_COUNT); + VIRT_HART_COUNT); } static int virt_warm_irqchip_init(u32 target_hart) @@ -85,13 +88,13 @@ static int virt_warm_irqchip_init(u32 target_hart) static int virt_cold_ipi_init(void) { return clint_cold_ipi_init(VIRT_CLINT_ADDR, - PLAT_HART_COUNT); + VIRT_HART_COUNT); } static int virt_cold_timer_init(void) { return clint_cold_timer_init(VIRT_CLINT_ADDR, - PLAT_HART_COUNT); + VIRT_HART_COUNT); } static int virt_system_down(u32 type) @@ -103,8 +106,8 @@ static int virt_system_down(u32 type) struct sbi_platform platform = { .name = "QEMU Virt Machine", .features = SBI_PLATFORM_DEFAULT_FEATURES, - .hart_count = PLAT_HART_COUNT, - .hart_stack_size = PLAT_HART_STACK_SIZE, + .hart_count = VIRT_HART_COUNT, + .hart_stack_size = VIRT_HART_STACK_SIZE, .disabled_hart_mask = 0, .pmp_region_count = virt_pmp_region_count, .pmp_region_info = virt_pmp_region_info, diff --git a/platform/sifive/hifive_u540/config.mk b/platform/sifive/hifive_u540/config.mk index ecbf88c3..630098e5 100644 --- a/platform/sifive/hifive_u540/config.mk +++ b/platform/sifive/hifive_u540/config.mk @@ -7,11 +7,8 @@ # SPDX-License-Identifier: BSD-2-Clause # -# Essential defines required by SBI platform -platform-cppflags-y+= -DPLAT_HART_COUNT=5 -platform-cppflags-y+= -DPLAT_HART_STACK_SIZE=8192 - # Compiler flags +platform-cppflags-y = platform-cflags-y =-mabi=lp64 -march=rv64imafdc -mcmodel=medany platform-asflags-y =-mabi=lp64 -march=rv64imafdc -mcmodel=medany platform-ldflags-y = diff --git a/platform/sifive/hifive_u540/platform.c b/platform/sifive/hifive_u540/platform.c index 395ad4ed..1e600a3e 100644 --- a/platform/sifive/hifive_u540/platform.c +++ b/platform/sifive/hifive_u540/platform.c @@ -15,6 +15,9 @@ #include #include +#define SIFIVE_U_HART_COUNT 5 +#define SIFIVE_U_HART_STACK_SIZE 8192 + #define SIFIVE_U_SYS_CLK 1000000000 #define SIFIVE_U_CLINT_ADDR 0x2000000 @@ -41,7 +44,7 @@ static int sifive_u_cold_final_init(void) void *fdt = sbi_scratch_thishart_arg1_ptr(); plic_fdt_fixup(fdt, "riscv,plic0", 0); - for (i = 1; i < PLAT_HART_COUNT; i++) + for (i = 1; i < SIFIVE_U_HART_COUNT; i++) plic_fdt_fixup(fdt, "riscv,plic0", 2 * i - 1); return 0; @@ -91,7 +94,7 @@ static int sifive_u_cold_irqchip_init(void) { return plic_cold_irqchip_init(SIFIVE_U_PLIC_ADDR, SIFIVE_U_PLIC_NUM_SOURCES, - PLAT_HART_COUNT); + SIFIVE_U_HART_COUNT); } static int sifive_u_warm_irqchip_init(u32 target_hart) @@ -104,13 +107,13 @@ static int sifive_u_warm_irqchip_init(u32 target_hart) static int sifive_u_cold_ipi_init(void) { return clint_cold_ipi_init(SIFIVE_U_CLINT_ADDR, - PLAT_HART_COUNT); + SIFIVE_U_HART_COUNT); } static int sifive_u_cold_timer_init(void) { return clint_cold_timer_init(SIFIVE_U_CLINT_ADDR, - PLAT_HART_COUNT); + SIFIVE_U_HART_COUNT); } static int sifive_u_system_down(u32 type) @@ -122,8 +125,8 @@ static int sifive_u_system_down(u32 type) struct sbi_platform platform = { .name = "SiFive HiFive U540", .features = SBI_PLATFORM_DEFAULT_FEATURES, - .hart_count = PLAT_HART_COUNT, - .hart_stack_size = PLAT_HART_STACK_SIZE, + .hart_count = SIFIVE_U_HART_COUNT, + .hart_stack_size = SIFIVE_U_HART_STACK_SIZE, .disabled_hart_mask = ~(1 << SIFIVE_U_HARITD_ENABLED), .pmp_region_count = sifive_u_pmp_region_count, .pmp_region_info = sifive_u_pmp_region_info, From 4e8d078613ee670a8577ec76d7b0a05944e07f1b Mon Sep 17 00:00:00 2001 From: Anup Patel Date: Sat, 22 Dec 2018 21:14:23 +0530 Subject: [PATCH 5/5] top: Typo fix in top-level README.md The platform specific options will be PLATFORM_ and not PLAT_ hence this patch fixes typo in top-level README.md. Signed-off-by: Anup Patel --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index db6c77b1..8d5b7233 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ OR `make PLATFORM= I= install` In addition, we can also specify platform specific command-line -options to top-level make (such as `PLAT_` or `FW_`) +options to top-level make (such as `PLATFORM_` or `FW_`) which are described under `docs/platform/.md` OR `docs/firmware/.md`.