mirror of
https://github.com/mii443/qemu.git
synced 2025-12-16 17:18:49 +00:00
hw/riscv: Split out the boot functions
Split the common RISC-V boot functions into a seperate file. This allows us to share the common code. Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
This commit is contained in:
committed by
Palmer Dabbelt
parent
05446f4133
commit
0ac24d56c5
@@ -41,11 +41,11 @@
|
||||
#include "hw/riscv/sifive_uart.h"
|
||||
#include "hw/riscv/sifive_prci.h"
|
||||
#include "hw/riscv/sifive_u.h"
|
||||
#include "hw/riscv/boot.h"
|
||||
#include "chardev/char.h"
|
||||
#include "sysemu/arch_init.h"
|
||||
#include "sysemu/device_tree.h"
|
||||
#include "exec/address-spaces.h"
|
||||
#include "elf.h"
|
||||
|
||||
#include <libfdt.h>
|
||||
|
||||
@@ -65,19 +65,6 @@ static const struct MemmapEntry {
|
||||
|
||||
#define GEM_REVISION 0x10070109
|
||||
|
||||
static target_ulong load_kernel(const char *kernel_filename)
|
||||
{
|
||||
uint64_t kernel_entry, kernel_high;
|
||||
|
||||
if (load_elf(kernel_filename, NULL, NULL, NULL,
|
||||
&kernel_entry, NULL, &kernel_high,
|
||||
0, EM_RISCV, 1, 0) < 0) {
|
||||
error_report("could not load kernel '%s'", kernel_filename);
|
||||
exit(1);
|
||||
}
|
||||
return kernel_entry;
|
||||
}
|
||||
|
||||
static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
|
||||
uint64_t mem_size, const char *cmdline)
|
||||
{
|
||||
@@ -283,7 +270,7 @@ static void riscv_sifive_u_init(MachineState *machine)
|
||||
create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline);
|
||||
|
||||
if (machine->kernel_filename) {
|
||||
load_kernel(machine->kernel_filename);
|
||||
riscv_load_kernel(machine->kernel_filename);
|
||||
}
|
||||
|
||||
/* reset vector */
|
||||
|
||||
Reference in New Issue
Block a user