Files
ports/sysutils/opensbi/files/patch-lib_sbi_sbi__hart.c
Mitchell Horne 8e0b9063b8 sysutils/opensbi: update to v1.7
Bump dependent u-boot ports.

Sponsored by:	The FreeBSD Foundation
2025-07-02 13:27:27 -03:00

20 lines
579 B
C

--- lib/sbi/sbi_hart.c.orig 2025-06-30 03:07:30 UTC
+++ lib/sbi/sbi_hart.c
@@ -567,6 +567,16 @@ int sbi_hart_pmp_configure(struct sbi_scratch *scratch
if (!pmp_count)
return 0;
+ /*
+ * Disable the PMP for the sifive/fu540 platform, required to work
+ * around a hardware errata.
+ */
+ extern int need_pmp_war;
+ if (need_pmp_war) {
+ pmp_set(0, PMP_R | PMP_W | PMP_X, -1, __riscv_xlen);
+ return 0;
+ }
+
pmp_log2gran = sbi_hart_pmp_log2gran(scratch);
pmp_bits = sbi_hart_pmp_addrbits(scratch) - 1;
pmp_addr_max = (1UL << pmp_bits) | ((1UL << pmp_bits) - 1);