Index: sysutils/opensbi/Makefile =================================================================== --- sysutils/opensbi/Makefile +++ sysutils/opensbi/Makefile @@ -1,6 +1,6 @@ PORTNAME= opensbi DISTVERSIONPREFIX=v -DISTVERSION= 0.9 +DISTVERSION= 1.0 CATEGORIES= sysutils MAINTAINER= mhorne@FreeBSD.org @@ -8,28 +8,32 @@ LICENSE= BSD2CLAUSE -BUILD_DEPENDS= ${RISCV_PREFIX}gcc:devel/riscv64-none-elf-gcc \ - ${RISCV_PREFIX}ld:devel/binutils@riscv64_none_elf - USES= gmake USE_GITHUB= yes GH_ACCOUNT= riscv -RISCV_PREFIX= riscv64-none-elf- - -MAKE_ARGS= CROSS_COMPILE=${RISCV_PREFIX} I=${STAGEDIR}${PREFIX} FW_PAYLOAD=n - OPTIONS_GROUP= PLATFORMS -OPTIONS_GROUP_PLATFORMS=GENERIC SIFIVE_FU540 +OPTIONS_GROUP_PLATFORMS=GENERIC OPTIONS_SUB= yes -OPTIONS_DEFAULT= GENERIC SIFIVE_FU540 +OPTIONS_DEFAULT= GENERIC GENERIC_DESC= Support for generic platform GENERIC_PLATFORM= generic GENERIC_STRIP_ARGS= -K tohost -K fromhost -SIFIVE_FU540_DESC= Support for SiFive U540 platform -SIFIVE_FU540_PLATFORM= sifive/fu540 +.include + +MAKE_ARGS= I=${STAGEDIR}${PREFIX} V=1 FW_PAYLOAD=n + +# Opportunistically build with clang/LLVM tools from base. +.if ${OSVERSION} >= 1400033 +MAKE_ARGS+= LLVM=y +.else +RISCV_PREFIX= riscv64-none-elf- +MAKE_ARGS+= CROSS_COMPILE=${RISCV_PREFIX} +BUILD_DEPENDS+= ${RISCV_PREFIX}gcc:devel/riscv64-none-elf-gcc \ + ${RISCV_PREFIX}ld:devel/binutils@riscv64_none_elf +.endif INSTALL_TARGET= install @@ -45,9 +49,9 @@ do-install-${platform}-on: ${MKDIR} ${STAGEDIR}${PREFIX} ${MAKE_CMD} -C ${WRKSRC} PLATFORM=${${platform}_PLATFORM} ${MAKE_ARGS} \ - I=${STAGEDIR}${PREFIX} install_firmwares + I=${STAGEDIR}${PREFIX} V=1 install_firmwares ${MAKE_CMD} -C ${WRKSRC} PLATFORM=${${platform}_PLATFORM} ${MAKE_ARGS} \ - I=${STAGEDIR}${PREFIX} install_libplatsbi + I=${STAGEDIR}${PREFIX} V=1 install_libplatsbi post-install-${platform}-on: ${STRIP_CMD} ${${platform}_STRIP_ARGS} \ Index: sysutils/opensbi/distinfo =================================================================== --- sysutils/opensbi/distinfo +++ sysutils/opensbi/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1610993580 -SHA256 (riscv-opensbi-v0.9_GH0.tar.gz) = 60f995cb3cd03e3cf5e649194d3395d0fe67499fd960a36cf7058a4efde686f0 -SIZE (riscv-opensbi-v0.9_GH0.tar.gz) = 189688 +TIMESTAMP = 1641325249 +SHA256 (riscv-opensbi-v1.0_GH0.tar.gz) = a5efaeb24f5ee88d13d5788e4e00623ff312ee12c0bf736aa75a6ad9a850fb76 +SIZE (riscv-opensbi-v1.0_GH0.tar.gz) = 225774 Index: sysutils/opensbi/files/patch-lib_sbi_sbi__hart.c =================================================================== --- sysutils/opensbi/files/patch-lib_sbi_sbi__hart.c +++ sysutils/opensbi/files/patch-lib_sbi_sbi__hart.c @@ -1,6 +1,6 @@ ---- lib/sbi/sbi_hart.c.orig 2021-01-30 20:30:32 UTC +--- lib/sbi/sbi_hart.c.orig 2021-12-24 11:57:44 UTC +++ lib/sbi/sbi_hart.c -@@ -188,6 +188,16 @@ int sbi_hart_pmp_configure(struct sbi_scratch *scratch +@@ -203,6 +203,16 @@ int sbi_hart_pmp_configure(struct sbi_scratch *scratch if (!pmp_count) return 0; Index: sysutils/opensbi/files/patch-platform_generic_platform.c =================================================================== --- sysutils/opensbi/files/patch-platform_generic_platform.c +++ sysutils/opensbi/files/patch-platform_generic_platform.c @@ -1,11 +1,11 @@ ---- platform/generic/platform.c.orig 2021-01-30 20:29:48 UTC +--- platform/generic/platform.c.orig 2021-12-24 11:57:44 UTC +++ platform/generic/platform.c -@@ -22,6 +22,8 @@ +@@ -23,6 +23,8 @@ #include #include +int need_pmp_war = FALSE; + extern const struct platform_override sifive_fu540; + extern const struct platform_override sifive_fu740; - static const struct platform_override *special_platforms[] = { Index: sysutils/opensbi/files/patch-platform_generic_sifive__fu540.c =================================================================== --- /dev/null +++ sysutils/opensbi/files/patch-platform_generic_sifive__fu540.c @@ -0,0 +1,26 @@ +--- platform/generic/sifive_fu540.c.orig 2021-12-24 11:57:44 UTC ++++ platform/generic/sifive_fu540.c +@@ -11,6 +11,15 @@ + #include + #include + ++extern int need_pmp_war; ++ ++static int sifive_fu540_early_init(bool cold_boot, const struct fdt_match *match) ++{ ++ need_pmp_war = TRUE; ++ ++ return 0; ++} ++ + static u64 sifive_fu540_tlbr_flush_limit(const struct fdt_match *match) + { + /* +@@ -41,6 +50,7 @@ static const struct fdt_match sifive_fu540_match[] = { + }; + + const struct platform_override sifive_fu540 = { ++ .early_init = sifive_fu540_early_init, + .match_table = sifive_fu540_match, + .tlbr_flush_limit = sifive_fu540_tlbr_flush_limit, + .fdt_fixup = sifive_fu540_fdt_fixup, Index: sysutils/opensbi/files/patch-platform_sifive_fu540_platform.c =================================================================== --- sysutils/opensbi/files/patch-platform_sifive_fu540_platform.c +++ /dev/null @@ -1,10 +0,0 @@ ---- platform/sifive/fu540/platform.c.orig 2021-01-30 20:28:07 UTC -+++ platform/sifive/fu540/platform.c -@@ -20,6 +20,7 @@ - #include - - /* clang-format off */ -+int need_pmp_war = TRUE; - - #define FU540_HART_COUNT 5 - Index: sysutils/opensbi/pkg-plist =================================================================== --- sysutils/opensbi/pkg-plist +++ sysutils/opensbi/pkg-plist @@ -2,6 +2,7 @@ include/sbi/riscv_asm.h include/sbi/riscv_atomic.h include/sbi/riscv_barrier.h +include/sbi/riscv_elf.h include/sbi/riscv_encoding.h include/sbi/riscv_fp.h include/sbi/riscv_io.h @@ -28,6 +29,7 @@ include/sbi/sbi_math.h include/sbi/sbi_misaligned_ldst.h include/sbi/sbi_platform.h +include/sbi/sbi_pmu.h include/sbi/sbi_scratch.h include/sbi/sbi_string.h include/sbi/sbi_system.h @@ -40,17 +42,25 @@ include/sbi_utils/fdt/fdt_domain.h include/sbi_utils/fdt/fdt_fixup.h include/sbi_utils/fdt/fdt_helper.h +include/sbi_utils/fdt/fdt_pmu.h +include/sbi_utils/gpio/fdt_gpio.h +include/sbi_utils/gpio/gpio.h +include/sbi_utils/i2c/fdt_i2c.h +include/sbi_utils/i2c/i2c.h +include/sbi_utils/ipi/aclint_mswi.h include/sbi_utils/ipi/fdt_ipi.h include/sbi_utils/irqchip/fdt_irqchip.h include/sbi_utils/irqchip/plic.h include/sbi_utils/reset/fdt_reset.h include/sbi_utils/serial/fdt_serial.h +include/sbi_utils/serial/gaisler-uart.h +include/sbi_utils/serial/litex-uart.h include/sbi_utils/serial/shakti-uart.h include/sbi_utils/serial/sifive-uart.h include/sbi_utils/serial/uart8250.h -include/sbi_utils/sys/clint.h include/sbi_utils/sys/htif.h include/sbi_utils/sys/sifive_test.h +include/sbi_utils/timer/aclint_mtimer.h include/sbi_utils/timer/fdt_timer.h lib64/%%RISCV_ABI%%/libsbi.a lib64/%%RISCV_ABI%%/libsbiutils.a @@ -59,8 +69,3 @@ %%GENERIC%%%%DATADIR%%/%%RISCV_ABI%%/generic/firmware/fw_dynamic.elf %%GENERIC%%%%DATADIR%%/%%RISCV_ABI%%/generic/firmware/fw_jump.bin %%GENERIC%%%%DATADIR%%/%%RISCV_ABI%%/generic/firmware/fw_jump.elf -%%SIFIVE_FU540%%lib64/%%RISCV_ABI%%/opensbi/sifive/fu540/lib/libplatsbi.a -%%SIFIVE_FU540%%%%DATADIR%%/%%RISCV_ABI%%/sifive/fu540/firmware/fw_dynamic.bin -%%SIFIVE_FU540%%%%DATADIR%%/%%RISCV_ABI%%/sifive/fu540/firmware/fw_dynamic.elf -%%SIFIVE_FU540%%%%DATADIR%%/%%RISCV_ABI%%/sifive/fu540/firmware/fw_jump.bin -%%SIFIVE_FU540%%%%DATADIR%%/%%RISCV_ABI%%/sifive/fu540/firmware/fw_jump.elf Index: sysutils/u-boot-sifive-fu540/Makefile =================================================================== --- sysutils/u-boot-sifive-fu540/Makefile +++ sysutils/u-boot-sifive-fu540/Makefile @@ -1,12 +1,14 @@ MASTERDIR= ${.CURDIR}/../u-boot-master +U_BOOT_SLAVE_PORTREVISION_2021.07=1 + MODEL= sifive-fu540 BOARD_CONFIG= sifive_unleashed_defconfig FAMILY= sifive UBOOT_ARCH= riscv64 # The FIT image will embed an OpenSBI firmware binary -OPENSBI_FIRM= ${LOCALBASE}/share/opensbi/lp64/sifive/fu540/firmware/fw_dynamic.bin +OPENSBI_FIRM= ${LOCALBASE}/share/opensbi/lp64/generic/firmware/fw_dynamic.bin BUILD_DEPENDS+= ${OPENSBI_FIRM}:sysutils/opensbi MAKE_ENV+= OPENSBI=${OPENSBI_FIRM}