|
| 1 | +diff --git a/recipes-bsp/opensbi/opensbi-sifive-hf-prem/0009-ace.patch b/recipes-bsp/opensbi/opensbi-sifive-hf-prem/0009-ace.patch |
| 2 | +new file mode 100644 |
| 3 | +index 0000000..77f2315 |
| 4 | +--- /dev/null |
| 5 | ++++ b/recipes-bsp/opensbi/opensbi-sifive-hf-prem/0009-ace.patch |
| 6 | +@@ -0,0 +1,149 @@ |
| 7 | ++ |
| 8 | ++ |
| 9 | ++ |
| 10 | ++ |
| 11 | ++diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c |
| 12 | ++index 06c60ae..3582e74 100644 |
| 13 | ++--- a/lib/sbi/sbi_domain.c |
| 14 | +++++ b/lib/sbi/sbi_domain.c |
| 15 | ++@@ -796,16 +796,16 @@ int sbi_domain_init(struct sbi_scratch *scratch, u32 cold_hartid) |
| 16 | ++ root.possible_harts = root_hmask; |
| 17 | ++ |
| 18 | ++ /* Root domain firmware memory region */ |
| 19 | ++- sbi_domain_memregion_init(scratch->fw_start, scratch->fw_rw_offset, |
| 20 | ++- (SBI_DOMAIN_MEMREGION_M_READABLE | |
| 21 | +++ sbi_domain_memregion_init(scratch->fw_start, scratch->fw_size, |
| 22 | +++ (SBI_DOMAIN_MEMREGION_M_READABLE | SBI_DOMAIN_MEMREGION_M_WRITABLE | |
| 23 | ++ SBI_DOMAIN_MEMREGION_M_EXECUTABLE), |
| 24 | ++ &root_memregs[root_memregs_count++],0); |
| 25 | ++ |
| 26 | ++- sbi_domain_memregion_init((scratch->fw_start + scratch->fw_rw_offset), |
| 27 | ++- (scratch->fw_size - scratch->fw_rw_offset), |
| 28 | ++- (SBI_DOMAIN_MEMREGION_M_READABLE | |
| 29 | ++- SBI_DOMAIN_MEMREGION_M_WRITABLE), |
| 30 | ++- &root_memregs[root_memregs_count++],0); |
| 31 | +++ // sbi_domain_memregion_init((scratch->fw_start + scratch->fw_rw_offset), |
| 32 | +++ // (scratch->fw_size - scratch->fw_rw_offset), |
| 33 | +++ // (SBI_DOMAIN_MEMREGION_M_READABLE | |
| 34 | +++ // SBI_DOMAIN_MEMREGION_M_WRITABLE), |
| 35 | +++ // &root_memregs[root_memregs_count++],0); |
| 36 | ++ |
| 37 | ++ #ifdef CONFIG_PLATFORM_ESWIN |
| 38 | ++ sbi_domain_memregion_init(0x1000000000UL, 0x3fffffUL, SBI_DOMAIN_MEMREGION_ENF_PERMISSIONS, |
| 39 | ++diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c |
| 40 | ++index f621cdd..68b2b18 100644 |
| 41 | ++--- a/lib/sbi/sbi_hart.c |
| 42 | +++++ b/lib/sbi/sbi_hart.c |
| 43 | ++@@ -435,7 +435,7 @@ static int sbi_hart_smepmp_configure(struct sbi_scratch *scratch, |
| 44 | ++ pmp_disable(SBI_SMEPMP_RESV_ENTRY); |
| 45 | ++ |
| 46 | ++ /* Program M-only regions when MML is not set. */ |
| 47 | ++- pmp_idx = 0; |
| 48 | +++ pmp_idx = 2; |
| 49 | ++ sbi_domain_for_each_memregion(dom, reg) { |
| 50 | ++ /* Skip reserved entry */ |
| 51 | ++ if (pmp_idx == SBI_SMEPMP_RESV_ENTRY) |
| 52 | ++@@ -461,7 +461,7 @@ static int sbi_hart_smepmp_configure(struct sbi_scratch *scratch, |
| 53 | ++ csr_set(CSR_MSECCFG, MSECCFG_MML); |
| 54 | ++ |
| 55 | ++ /* Program shared and SU-only regions */ |
| 56 | ++- pmp_idx = 0; |
| 57 | +++ pmp_idx = 2; |
| 58 | ++ sbi_domain_for_each_memregion(dom, reg) { |
| 59 | ++ /* Skip reserved entry */ |
| 60 | ++ if (pmp_idx == SBI_SMEPMP_RESV_ENTRY) |
| 61 | ++@@ -498,7 +498,7 @@ static int sbi_hart_oldpmp_configure(struct sbi_scratch *scratch, |
| 62 | ++ { |
| 63 | ++ struct sbi_domain_memregion *reg; |
| 64 | ++ struct sbi_domain *dom = sbi_domain_thishart_ptr(); |
| 65 | ++- unsigned int pmp_idx = 0; |
| 66 | +++ unsigned int pmp_idx = 2; |
| 67 | ++ unsigned int pmp_flags; |
| 68 | ++ unsigned long pmp_addr; |
| 69 | ++ |
| 70 | ++diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c |
| 71 | ++index 3d60ceb..3870971 100644 |
| 72 | ++--- a/lib/sbi/sbi_hsm.c |
| 73 | +++++ b/lib/sbi/sbi_hsm.c |
| 74 | ++@@ -26,6 +26,8 @@ |
| 75 | ++ #include <sbi/sbi_timer.h> |
| 76 | ++ #include <sbi/sbi_console.h> |
| 77 | ++ |
| 78 | +++extern void ace_setup_this_hart(); |
| 79 | +++ |
| 80 | ++ #define __sbi_hsm_hart_change_state(hdata, oldstate, newstate) \ |
| 81 | ++ ({ \ |
| 82 | ++ long state = atomic_cmpxchg(&(hdata)->state, oldstate, newstate); \ |
| 83 | ++@@ -154,6 +156,8 @@ void __noreturn sbi_hsm_hart_start_finish(struct sbi_scratch *scratch, |
| 84 | ++ next_mode = scratch->next_mode; |
| 85 | ++ hsm_start_ticket_release(hdata); |
| 86 | ++ |
| 87 | +++ ace_setup_this_hart(); |
| 88 | +++ |
| 89 | ++ sbi_hart_switch_mode(hartid, next_arg1, next_addr, next_mode, false); |
| 90 | ++ } |
| 91 | ++ |
| 92 | ++diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c |
| 93 | ++index 931ba7c..9c0454b 100644 |
| 94 | ++--- a/lib/sbi/sbi_init.c |
| 95 | +++++ b/lib/sbi/sbi_init.c |
| 96 | ++@@ -80,6 +80,8 @@ static void sbi_boot_print_general(struct sbi_scratch *scratch) |
| 97 | ++ return; |
| 98 | ++ |
| 99 | ++ /* Platform details */ |
| 100 | +++ sbi_printf("ACE: 2024.09.00-HFP550 release\n"); |
| 101 | +++ sbi_printf("ACE: build version %d\n", 152); |
| 102 | ++ sbi_printf("Platform Name : %s\n", |
| 103 | ++ sbi_platform_name(plat)); |
| 104 | ++ sbi_platform_get_features_str(plat, str, sizeof(str)); |
| 105 | ++diff --git a/lib/utils/serial/uart8250.c b/lib/utils/serial/uart8250.c |
| 106 | ++index 1fe053f..af114dd 100644 |
| 107 | ++--- a/lib/utils/serial/uart8250.c |
| 108 | +++++ b/lib/utils/serial/uart8250.c |
| 109 | ++@@ -135,7 +135,12 @@ int uart8250_init(unsigned long base, u32 in_freq, u32 baudrate, u32 reg_shift, |
| 110 | ++ |
| 111 | ++ sbi_console_set_device(&uart8250_console); |
| 112 | ++ |
| 113 | +++#ifdef CONFIG_PLATFORM_ESWIN |
| 114 | +++ /* For now, not adding memrange for UART as we are short of PMP regions */ |
| 115 | +++ return 0; |
| 116 | +++#else |
| 117 | ++ return sbi_domain_root_add_memrange(base, PAGE_SIZE, PAGE_SIZE, |
| 118 | ++ (SBI_DOMAIN_MEMREGION_MMIO | |
| 119 | ++ SBI_DOMAIN_MEMREGION_SHARED_SURW_MRW)); |
| 120 | +++#endif |
| 121 | ++ } |
| 122 | ++diff --git a/platform/eswin/eic770x/objects.mk b/platform/eswin/eic770x/objects.mk |
| 123 | ++index 8535107..7d6806d 100644 |
| 124 | ++--- a/platform/eswin/eic770x/objects.mk |
| 125 | +++++ b/platform/eswin/eic770x/objects.mk |
| 126 | ++@@ -15,7 +15,7 @@ platform-objs-y += eic770x_uart.o |
| 127 | ++ platform-cppflags-y = |
| 128 | ++ platform-cflags-y = |
| 129 | ++ platform-asflags-y = |
| 130 | ++-platform-ldflags-y = -fno-stack-protector |
| 131 | +++platform-ldflags-y = -fno-stack-protector -L/opt/woz/ace_p550/security-monitor/ -lace |
| 132 | ++ |
| 133 | ++ # Command for platform specific "make run" |
| 134 | ++ |
| 135 | ++diff --git a/platform/eswin/eic770x/platform.c b/platform/eswin/eic770x/platform.c |
| 136 | ++index e15df16..cbf581a 100644 |
| 137 | ++--- a/platform/eswin/eic770x/platform.c |
| 138 | +++++ b/platform/eswin/eic770x/platform.c |
| 139 | ++@@ -30,6 +30,8 @@ |
| 140 | ++ #include <sbi/sbi_hart.h> |
| 141 | ++ #include "eic770x_uart.h" |
| 142 | ++ |
| 143 | +++extern void init_security_monitor_asm(bool cold_boot, void *fdt); |
| 144 | +++ |
| 145 | ++ /* clang-format off */ |
| 146 | ++ #define EIC770X_HART_COUNT 4 |
| 147 | ++ #define DIE_REG_OFFSET 0 |
| 148 | ++@@ -225,6 +227,7 @@ static int eic770x_final_init(bool cold_boot) |
| 149 | ++ |
| 150 | ++ fdt = sbi_scratch_thishart_arg1_ptr(); |
| 151 | ++ eic770x_modify_dt(fdt); |
| 152 | +++ init_security_monitor_asm(cold_boot, fdt); |
| 153 | ++ |
| 154 | ++ return 0; |
| 155 | ++ } |
| 156 | +diff --git a/recipes-bsp/opensbi/opensbi-sifive-hf-prem_1.4.bb b/recipes-bsp/opensbi/opensbi-sifive-hf-prem_1.4.bb |
| 157 | +index 4a7bf4b..8740670 100644 |
| 158 | +--- a/recipes-bsp/opensbi/opensbi-sifive-hf-prem_1.4.bb |
| 159 | ++++ b/recipes-bsp/opensbi/opensbi-sifive-hf-prem_1.4.bb |
| 160 | +@@ -21,13 +21,15 @@ SRC_URI:append = " \ |
| 161 | + file://0005-lib-sbi-Configure-CSR-registers.patch \ |
| 162 | + file://0006-lib-sbi-eic770x-Add-PMP-for-TOR-region.patch \ |
| 163 | + file://0007-sbi-init-Modify-CSR-values.patch \ |
| 164 | ++ file://0009-ace.patch \ |
| 165 | + " |
| 166 | + |
| 167 | + S = "${WORKDIR}/git" |
| 168 | + |
| 169 | + TARGET_CC_ARCH += "${LDFLAGS}" |
| 170 | + |
| 171 | +-EXTRA_OEMAKE += "PLATFORM=${RISCV_SBI_PLAT} CHIPLET="BR2_CHIPLET_1" CHIPLET_DIE_AVAILABLE="BR2_CHIPLET_1_DIE0_AVAILABLE" MEM_MODE="BR2_MEMMODE_FLAT" PLATFORM_CLUSTER_X_CORE="BR2_CLUSTER_4_CORE" PLATFORM_RISCV_ISA=rv64imafdc_zicsr_zifencei I=${D}" |
| 172 | ++ |
| 173 | ++EXTRA_OEMAKE += "PLATFORM=${RISCV_SBI_PLAT} CHIPLET="BR2_CHIPLET_1" CHIPLET_DIE_AVAILABLE="BR2_CHIPLET_1_DIE0_AVAILABLE" MEM_MODE="BR2_MEMMODE_FLAT" PLATFORM_CLUSTER_X_CORE="BR2_CLUSTER_4_CORE" PLATFORM_RISCV_ISA=rv64imafdc_zicsr_zifencei PLATFORM_RISCV_ABI=lp64d I=${D}" |
| 174 | + # If RISCV_SBI_PAYLOAD is set then include it as a payload |
| 175 | + EXTRA_OEMAKE:append = " ${@riscv_get_extra_oemake_image(d)}" |
| 176 | + EXTRA_OEMAKE:append = " ${@riscv_get_extra_oemake_fdt(d)}" |
| 177 | +diff --git a/recipes-bsp/u-boot/files/0002-ace-p550.patch b/recipes-bsp/u-boot/files/0002-ace-p550.patch |
| 178 | +new file mode 100644 |
| 179 | +index 0000000..407d46f |
| 180 | +--- /dev/null |
| 181 | ++++ b/recipes-bsp/u-boot/files/0002-ace-p550.patch |
| 182 | +@@ -0,0 +1,13 @@ |
| 183 | ++diff --git a/arch/riscv/cpu/eic7700/dram.c b/arch/riscv/cpu/eic7700/dram.c |
| 184 | ++index a3521ac1e4..0728819cc2 100644 |
| 185 | ++--- a/arch/riscv/cpu/eic7700/dram.c |
| 186 | +++++ b/arch/riscv/cpu/eic7700/dram.c |
| 187 | ++@@ -16,7 +16,7 @@ DECLARE_GLOBAL_DATA_PTR; |
| 188 | ++ DECLARE_GLOBAL_DATA_PTR; |
| 189 | ++ |
| 190 | ++ /* 32 GB */ |
| 191 | ++-#define DDR_SIZE_MAX 0x800000000 |
| 192 | +++#define DDR_SIZE_MAX 0x200000000 |
| 193 | ++ |
| 194 | ++ /* 128 MB offset */ |
| 195 | ++ #define RAM_BASE_OFFSET 0x8000000 |
| 196 | +diff --git a/recipes-bsp/u-boot/u-boot-sifive-hf-prem_2024.01.bb b/recipes-bsp/u-boot/u-boot-sifive-hf-prem_2024.01.bb |
| 197 | +index 1887c67..55a9357 100644 |
| 198 | +--- a/recipes-bsp/u-boot/u-boot-sifive-hf-prem_2024.01.bb |
| 199 | ++++ b/recipes-bsp/u-boot/u-boot-sifive-hf-prem_2024.01.bb |
| 200 | +@@ -7,10 +7,16 @@ DEPENDS += "bc-native dtc-native" |
| 201 | + |
| 202 | + SRCREV = "419a5fb2a92d338e813771acb0b50fefd9a1fea0" |
| 203 | + SRC_URI = "git://github.com/eswincomputing/u-boot.git;protocol=https;branch=u-boot-2024.01-EIC7X \ |
| 204 | +- file://0001-riscv-hifive_premier_p550-defined-boot-media-sequenc.patch" |
| 205 | ++ file://0001-riscv-hifive_premier_p550-defined-boot-media-sequenc.patch \ |
| 206 | ++ file://0002-ace-p550.patch \ |
| 207 | ++ " |
| 208 | + |
| 209 | + do_deploy:append () { |
| 210 | + install -m 755 ${B}/u-boot.dtb ${DEPLOYDIR} |
| 211 | ++ cp ${DEPLOYDIR}/u-boot.dtb ${DEPLOYDIR}/u-boot_original.dtb |
| 212 | ++ fdtput -c ${DEPLOYDIR}/u-boot.dtb /reserved-memory/ace-conf-mem |
| 213 | ++ fdtput -t x ${DEPLOYDIR}/u-boot.dtb /reserved-memory/ace-conf-mem reg 0x2 0x80000000 0x2 0x0 |
| 214 | ++ fdtput -t s ${DEPLOYDIR}/u-boot.dtb /reserved-memory/ace-conf-mem no-map |
| 215 | + } |
| 216 | + |
| 217 | + COMPATIBLE_MACHINE = "hifive-premier-p550" |
0 commit comments