|
@@ -443,6 +443,7 @@ static void riscv_virt_board_init(MachineState *machine)
|
|
|
MemoryRegion *mask_rom = g_new(MemoryRegion, 1);
|
|
|
char *plic_hart_config;
|
|
|
size_t plic_hart_config_len;
|
|
|
+ target_ulong start_addr = memmap[VIRT_DRAM].base;
|
|
|
int i;
|
|
|
unsigned int smp_cpus = machine->smp.cpus;
|
|
|
|
|
@@ -489,6 +490,14 @@ static void riscv_virt_board_init(MachineState *machine)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if (drive_get(IF_PFLASH, 0, 0)) {
|
|
|
+ /*
|
|
|
+ * Pflash was supplied, let's overwrite the address we jump to after
|
|
|
+ * reset to the base of the flash.
|
|
|
+ */
|
|
|
+ start_addr = virt_memmap[VIRT_FLASH].base;
|
|
|
+ }
|
|
|
+
|
|
|
/* reset vector */
|
|
|
uint32_t reset_vec[8] = {
|
|
|
0x00000297, /* 1: auipc t0, %pcrel_hi(dtb) */
|
|
@@ -501,7 +510,7 @@ static void riscv_virt_board_init(MachineState *machine)
|
|
|
#endif
|
|
|
0x00028067, /* jr t0 */
|
|
|
0x00000000,
|
|
|
- memmap[VIRT_DRAM].base, /* start: .dword memmap[VIRT_DRAM].base */
|
|
|
+ start_addr, /* start: .dword */
|
|
|
0x00000000,
|
|
|
/* dtb: */
|
|
|
};
|