mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-18 23:52:14 -06:00
hw/arm/boot: Factor out "set up firmware boot" code
Factor out the "boot via firmware" code path from arm_load_kernel() into its own function. This commit only moves code around; no semantic changes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Message-id: 20190131112240.8395-4-peter.maydell@linaro.org
This commit is contained in:
parent
d33774ee44
commit
4c0f268731
1 changed files with 49 additions and 43 deletions
|
@ -1138,33 +1138,9 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
|
static void arm_setup_firmware_boot(ARMCPU *cpu, struct arm_boot_info *info)
|
||||||
{
|
{
|
||||||
CPUState *cs;
|
/* Set up for booting firmware (which might load a kernel via fw_cfg) */
|
||||||
AddressSpace *as = arm_boot_address_space(cpu, info);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* CPU objects (unlike devices) are not automatically reset on system
|
|
||||||
* reset, so we must always register a handler to do so. If we're
|
|
||||||
* actually loading a kernel, the handler is also responsible for
|
|
||||||
* arranging that we start it correctly.
|
|
||||||
*/
|
|
||||||
for (cs = first_cpu; cs; cs = CPU_NEXT(cs)) {
|
|
||||||
qemu_register_reset(do_cpu_reset, ARM_CPU(cs));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The board code is not supposed to set secure_board_setup unless
|
|
||||||
* running its code in secure mode is actually possible, and KVM
|
|
||||||
* doesn't support secure.
|
|
||||||
*/
|
|
||||||
assert(!(info->secure_board_setup && kvm_enabled()));
|
|
||||||
|
|
||||||
info->dtb_filename = qemu_opt_get(qemu_get_machine_opts(), "dtb");
|
|
||||||
info->dtb_limit = 0;
|
|
||||||
|
|
||||||
/* Load the kernel. */
|
|
||||||
if (!info->kernel_filename || info->firmware_loaded) {
|
|
||||||
|
|
||||||
if (have_dtb(info)) {
|
if (have_dtb(info)) {
|
||||||
/*
|
/*
|
||||||
|
@ -1208,6 +1184,36 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
|
||||||
* We will start from address 0 (typically a boot ROM image) in the
|
* We will start from address 0 (typically a boot ROM image) in the
|
||||||
* same way as hardware.
|
* same way as hardware.
|
||||||
*/
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
|
||||||
|
{
|
||||||
|
CPUState *cs;
|
||||||
|
AddressSpace *as = arm_boot_address_space(cpu, info);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CPU objects (unlike devices) are not automatically reset on system
|
||||||
|
* reset, so we must always register a handler to do so. If we're
|
||||||
|
* actually loading a kernel, the handler is also responsible for
|
||||||
|
* arranging that we start it correctly.
|
||||||
|
*/
|
||||||
|
for (cs = first_cpu; cs; cs = CPU_NEXT(cs)) {
|
||||||
|
qemu_register_reset(do_cpu_reset, ARM_CPU(cs));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The board code is not supposed to set secure_board_setup unless
|
||||||
|
* running its code in secure mode is actually possible, and KVM
|
||||||
|
* doesn't support secure.
|
||||||
|
*/
|
||||||
|
assert(!(info->secure_board_setup && kvm_enabled()));
|
||||||
|
|
||||||
|
info->dtb_filename = qemu_opt_get(qemu_get_machine_opts(), "dtb");
|
||||||
|
info->dtb_limit = 0;
|
||||||
|
|
||||||
|
/* Load the kernel. */
|
||||||
|
if (!info->kernel_filename || info->firmware_loaded) {
|
||||||
|
arm_setup_firmware_boot(cpu, info);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
arm_setup_direct_kernel_boot(cpu, info);
|
arm_setup_direct_kernel_boot(cpu, info);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue