提交 6ed221b6 编写于 作者: A Adam Lackorzynski 提交者: Aurelien Jarno

target-arm: Integrate secondary CPU reset in arm_boot

Integrate secondary CPU reset into arm_boot, removing it from realview.c.
On non-Linux systems secondary CPUs start with the same entry as the boot
CPU.
Signed-off-by: NAdam Lackorzynski <adam@os.inf.tu-dresden.de>
Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
上级 f8bf8606
...@@ -175,7 +175,7 @@ static void set_kernel_args_old(struct arm_boot_info *info, ...@@ -175,7 +175,7 @@ static void set_kernel_args_old(struct arm_boot_info *info,
} }
} }
static void main_cpu_reset(void *opaque) static void do_cpu_reset(void *opaque)
{ {
CPUState *env = opaque; CPUState *env = opaque;
struct arm_boot_info *info = env->boot_info; struct arm_boot_info *info = env->boot_info;
...@@ -187,16 +187,20 @@ static void main_cpu_reset(void *opaque) ...@@ -187,16 +187,20 @@ static void main_cpu_reset(void *opaque)
env->regs[15] = info->entry & 0xfffffffe; env->regs[15] = info->entry & 0xfffffffe;
env->thumb = info->entry & 1; env->thumb = info->entry & 1;
} else { } else {
env->regs[15] = info->loader_start; if (env == first_cpu) {
if (old_param) { env->regs[15] = info->loader_start;
set_kernel_args_old(info, info->initrd_size, if (old_param) {
set_kernel_args_old(info, info->initrd_size,
info->loader_start);
} else {
set_kernel_args(info, info->initrd_size,
info->loader_start); info->loader_start);
}
} else { } else {
set_kernel_args(info, info->initrd_size, info->loader_start); env->regs[15] = info->smp_loader_start;
} }
} }
} }
/* TODO: Reset secondary CPUs. */
} }
void arm_load_kernel(CPUState *env, struct arm_boot_info *info) void arm_load_kernel(CPUState *env, struct arm_boot_info *info)
...@@ -217,7 +221,6 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info) ...@@ -217,7 +221,6 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info)
if (info->nb_cpus == 0) if (info->nb_cpus == 0)
info->nb_cpus = 1; info->nb_cpus = 1;
env->boot_info = info;
#ifdef TARGET_WORDS_BIGENDIAN #ifdef TARGET_WORDS_BIGENDIAN
big_endian = 1; big_endian = 1;
...@@ -279,5 +282,9 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info) ...@@ -279,5 +282,9 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info)
info->initrd_size = initrd_size; info->initrd_size = initrd_size;
} }
info->is_linux = is_linux; info->is_linux = is_linux;
qemu_register_reset(main_cpu_reset, env);
for (; env; env = env->next_cpu) {
env->boot_info = info;
qemu_register_reset(do_cpu_reset, env);
}
} }
...@@ -104,17 +104,6 @@ static struct arm_boot_info realview_binfo = { ...@@ -104,17 +104,6 @@ static struct arm_boot_info realview_binfo = {
.smp_loader_start = SMP_BOOT_ADDR, .smp_loader_start = SMP_BOOT_ADDR,
}; };
static void secondary_cpu_reset(void *opaque)
{
CPUState *env = opaque;
cpu_reset(env);
/* Set entry point for secondary CPUs. This assumes we're using
the init code from arm_boot.c. Real hardware resets all CPUs
the same. */
env->regs[15] = SMP_BOOT_ADDR;
}
/* The following two lists must be consistent. */ /* The following two lists must be consistent. */
enum realview_board_type { enum realview_board_type {
BOARD_EB, BOARD_EB,
...@@ -177,9 +166,6 @@ static void realview_init(ram_addr_t ram_size, ...@@ -177,9 +166,6 @@ static void realview_init(ram_addr_t ram_size,
} }
irqp = arm_pic_init_cpu(env); irqp = arm_pic_init_cpu(env);
cpu_irq[n] = irqp[ARM_PIC_CPU_IRQ]; cpu_irq[n] = irqp[ARM_PIC_CPU_IRQ];
if (n > 0) {
qemu_register_reset(secondary_cpu_reset, env);
}
} }
if (arm_feature(env, ARM_FEATURE_V7)) { if (arm_feature(env, ARM_FEATURE_V7)) {
if (is_mpcore) { if (is_mpcore) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册