2019-06-25 01:11:49 +03:00
|
|
|
/*
|
|
|
|
* QEMU RISC-V Boot Helper
|
|
|
|
*
|
|
|
|
* Copyright (c) 2017 SiFive, Inc.
|
|
|
|
* Copyright (c) 2019 Alistair Francis <alistair.francis@wdc.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2 or later, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef RISCV_BOOT_H
|
|
|
|
#define RISCV_BOOT_H
|
|
|
|
|
2019-08-12 08:23:31 +03:00
|
|
|
#include "exec/cpu-defs.h"
|
2020-04-24 00:09:37 +03:00
|
|
|
#include "hw/loader.h"
|
2020-12-16 21:23:08 +03:00
|
|
|
#include "hw/riscv/riscv_hart.h"
|
2019-08-12 08:23:31 +03:00
|
|
|
|
2021-04-30 10:13:01 +03:00
|
|
|
#define RISCV32_BIOS_BIN "opensbi-riscv32-generic-fw_dynamic.bin"
|
|
|
|
#define RISCV64_BIOS_BIN "opensbi-riscv64-generic-fw_dynamic.bin"
|
|
|
|
|
2021-01-16 02:00:27 +03:00
|
|
|
bool riscv_is_32bit(RISCVHartArrayState *harts);
|
2020-10-14 03:17:30 +03:00
|
|
|
|
2021-10-22 09:01:30 +03:00
|
|
|
char *riscv_plic_hart_config_string(int hart_count);
|
|
|
|
|
2021-01-16 02:00:27 +03:00
|
|
|
target_ulong riscv_calc_kernel_start_addr(RISCVHartArrayState *harts,
|
2020-10-14 03:17:33 +03:00
|
|
|
target_ulong firmware_end_addr);
|
2020-10-14 03:17:28 +03:00
|
|
|
target_ulong riscv_find_and_load_firmware(MachineState *machine,
|
|
|
|
const char *default_machine_firmware,
|
|
|
|
hwaddr firmware_load_addr,
|
|
|
|
symbol_fn_t sym_cb);
|
2019-08-16 16:09:35 +03:00
|
|
|
char *riscv_find_firmware(const char *firmware_filename);
|
2019-06-25 01:11:52 +03:00
|
|
|
target_ulong riscv_load_firmware(const char *firmware_filename,
|
2020-04-27 11:06:42 +03:00
|
|
|
hwaddr firmware_load_addr,
|
|
|
|
symbol_fn_t sym_cb);
|
2019-11-19 09:21:09 +03:00
|
|
|
target_ulong riscv_load_kernel(const char *kernel_filename,
|
2020-10-14 03:17:33 +03:00
|
|
|
target_ulong firmware_end_addr,
|
2019-11-19 09:21:09 +03:00
|
|
|
symbol_fn_t sym_cb);
|
2019-06-25 01:11:49 +03:00
|
|
|
hwaddr riscv_load_initrd(const char *filename, uint64_t mem_size,
|
|
|
|
uint64_t kernel_entry, hwaddr *start);
|
2020-07-01 21:39:47 +03:00
|
|
|
uint32_t riscv_load_fdt(hwaddr dram_start, uint64_t dram_size, void *fdt);
|
2021-01-16 02:00:27 +03:00
|
|
|
void riscv_setup_rom_reset_vec(MachineState *machine, RISCVHartArrayState *harts,
|
2020-12-16 21:23:08 +03:00
|
|
|
hwaddr saddr,
|
2020-12-16 21:22:37 +03:00
|
|
|
hwaddr rom_base, hwaddr rom_size,
|
|
|
|
uint64_t kernel_entry,
|
2020-07-01 21:39:47 +03:00
|
|
|
uint32_t fdt_load_addr, void *fdt);
|
2020-12-16 21:22:37 +03:00
|
|
|
void riscv_rom_copy_firmware_info(MachineState *machine, hwaddr rom_base,
|
|
|
|
hwaddr rom_size,
|
2020-07-01 21:39:48 +03:00
|
|
|
uint32_t reset_vec_size,
|
|
|
|
uint64_t kernel_entry);
|
2022-01-12 11:13:22 +03:00
|
|
|
void riscv_setup_direct_kernel(hwaddr kernel_addr, hwaddr fdt_addr);
|
2019-06-25 01:11:49 +03:00
|
|
|
|
|
|
|
#endif /* RISCV_BOOT_H */
|