提交 f3d6b95e 编写于 作者: P pbrook

ARM reabbot support (orginal patch by Aurelien Jarno).


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2476 c046a42c-6fe2-441c-8c8c-71466251a162
上级 5adb4839
...@@ -24,6 +24,17 @@ static uint32_t bootloader[] = { ...@@ -24,6 +24,17 @@ static uint32_t bootloader[] = {
0 /* Kernel entry point. Set by integratorcp_init. */ 0 /* Kernel entry point. Set by integratorcp_init. */
}; };
static void main_cpu_reset(void *opaque)
{
CPUState *env = opaque;
cpu_reset(env);
if (env->kernel_filename)
arm_load_kernel(env, env->ram_size, env->kernel_filename,
env->kernel_cmdline, env->initrd_filename,
env->board_id);
}
static void set_kernel_args(uint32_t ram_size, int initrd_size, static void set_kernel_args(uint32_t ram_size, int initrd_size,
const char *kernel_cmdline) const char *kernel_cmdline)
{ {
...@@ -81,6 +92,14 @@ void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename, ...@@ -81,6 +92,14 @@ void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename,
exit(1); exit(1);
} }
if (!env->kernel_filename) {
env->ram_size = ram_size;
env->kernel_filename = kernel_filename;
env->kernel_cmdline = kernel_cmdline;
env->initrd_filename = initrd_filename;
env->board_id = board_id;
qemu_register_reset(main_cpu_reset, env);
}
/* Assume that raw images are linux kernels, and ELF images are not. */ /* Assume that raw images are linux kernels, and ELF images are not. */
kernel_size = load_elf(kernel_filename, 0, &elf_entry); kernel_size = load_elf(kernel_filename, 0, &elf_entry);
entry = elf_entry; entry = elf_entry;
......
...@@ -149,7 +149,7 @@ static void arm_sysctl_write(void *opaque, target_phys_addr_t offset, ...@@ -149,7 +149,7 @@ static void arm_sysctl_write(void *opaque, target_phys_addr_t offset,
if (s->lockval == LOCK_VALUE) { if (s->lockval == LOCK_VALUE) {
s->resetlevel = val; s->resetlevel = val;
if (val & 0x100) if (val & 0x100)
cpu_abort(cpu_single_env, "Board reset\n"); qemu_system_reset_request ();
} }
break; break;
case 0x44: /* PCICTL */ case 0x44: /* PCICTL */
......
...@@ -122,6 +122,12 @@ typedef struct CPUARMState { ...@@ -122,6 +122,12 @@ typedef struct CPUARMState {
CPU_COMMON CPU_COMMON
/* These fields after the common ones so thes are preserved on reset. */
int ram_size;
const char *kernel_filename;
const char *kernel_cmdline;
const char *initrd_filename;
int board_id;
} CPUARMState; } CPUARMState;
CPUARMState *cpu_arm_init(void); CPUARMState *cpu_arm_init(void);
......
...@@ -5,8 +5,37 @@ ...@@ -5,8 +5,37 @@
#include "cpu.h" #include "cpu.h"
#include "exec-all.h" #include "exec-all.h"
static inline void set_feature(CPUARMState *env, int feature)
{
env->features |= 1u << feature;
}
static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
{
env->cp15.c0_cpuid = id;
switch (id) {
case ARM_CPUID_ARM926:
set_feature(env, ARM_FEATURE_VFP);
env->vfp.xregs[ARM_VFP_FPSID] = 0x41011090;
break;
case ARM_CPUID_ARM1026:
set_feature(env, ARM_FEATURE_VFP);
set_feature(env, ARM_FEATURE_AUXCR);
env->vfp.xregs[ARM_VFP_FPSID] = 0x410110a0;
break;
default:
cpu_abort(env, "Bad CPU ID: %x\n", id);
break;
}
}
void cpu_reset(CPUARMState *env) void cpu_reset(CPUARMState *env)
{ {
uint32_t id;
id = env->cp15.c0_cpuid;
memset(env, 0, offsetof(CPUARMState, breakpoints));
if (id)
cpu_reset_model_id(env, id);
#if defined (CONFIG_USER_ONLY) #if defined (CONFIG_USER_ONLY)
env->uncached_cpsr = ARM_CPU_MODE_USR; env->uncached_cpsr = ARM_CPU_MODE_USR;
env->vfp.xregs[ARM_VFP_FPEXC] = 1 << 30; env->vfp.xregs[ARM_VFP_FPEXC] = 1 << 30;
...@@ -16,6 +45,7 @@ void cpu_reset(CPUARMState *env) ...@@ -16,6 +45,7 @@ void cpu_reset(CPUARMState *env)
env->vfp.xregs[ARM_VFP_FPEXC] = 0; env->vfp.xregs[ARM_VFP_FPEXC] = 0;
#endif #endif
env->regs[15] = 0; env->regs[15] = 0;
tlb_flush(env, 1);
} }
CPUARMState *cpu_arm_init(void) CPUARMState *cpu_arm_init(void)
...@@ -27,15 +57,9 @@ CPUARMState *cpu_arm_init(void) ...@@ -27,15 +57,9 @@ CPUARMState *cpu_arm_init(void)
return NULL; return NULL;
cpu_exec_init(env); cpu_exec_init(env);
cpu_reset(env); cpu_reset(env);
tlb_flush(env, 1);
return env; return env;
} }
static inline void set_feature(CPUARMState *env, int feature)
{
env->features |= 1u << feature;
}
struct arm_cpu_t { struct arm_cpu_t {
uint32_t id; uint32_t id;
const char *name; const char *name;
...@@ -74,22 +98,7 @@ void cpu_arm_set_model(CPUARMState *env, const char *name) ...@@ -74,22 +98,7 @@ void cpu_arm_set_model(CPUARMState *env, const char *name)
cpu_abort(env, "Unknown CPU '%s'", name); cpu_abort(env, "Unknown CPU '%s'", name);
return; return;
} }
cpu_reset_model_id(env, id);
env->cp15.c0_cpuid = id;
switch (id) {
case ARM_CPUID_ARM926:
set_feature(env, ARM_FEATURE_VFP);
env->vfp.xregs[ARM_VFP_FPSID] = 0x41011090;
break;
case ARM_CPUID_ARM1026:
set_feature(env, ARM_FEATURE_VFP);
set_feature(env, ARM_FEATURE_AUXCR);
env->vfp.xregs[ARM_VFP_FPSID] = 0x410110a0;
break;
default:
cpu_abort(env, "Bad CPU ID: %x\n", id);
break;
}
} }
void cpu_arm_close(CPUARMState *env) void cpu_arm_close(CPUARMState *env)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册