Commit 9d551997 authored by balrog's avatar balrog

Account for machine with RAM which is not mapped at 0x0 in arm_boot.c.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2757 c046a42c-6fe2-441c-8c8c-71466251a162
parent b00052e4
......@@ -32,11 +32,12 @@ static void main_cpu_reset(void *opaque)
if (env->kernel_filename)
arm_load_kernel(env, env->ram_size, env->kernel_filename,
env->kernel_cmdline, env->initrd_filename,
env->board_id);
env->board_id, env->loader_start);
}
static void set_kernel_args(uint32_t ram_size, int initrd_size,
const char *kernel_cmdline)
const char *kernel_cmdline,
target_phys_addr_t loader_start)
{
uint32_t *p;
......@@ -51,12 +52,12 @@ static void set_kernel_args(uint32_t ram_size, int initrd_size,
stl_raw(p++, 4);
stl_raw(p++, 0x54410002);
stl_raw(p++, ram_size);
stl_raw(p++, 0);
stl_raw(p++, loader_start);
if (initrd_size) {
/* ATAG_INITRD2 */
stl_raw(p++, 4);
stl_raw(p++, 0x54420005);
stl_raw(p++, INITRD_LOAD_ADDR);
stl_raw(p++, loader_start + INITRD_LOAD_ADDR);
stl_raw(p++, initrd_size);
}
if (kernel_cmdline && *kernel_cmdline) {
......@@ -77,7 +78,7 @@ static void set_kernel_args(uint32_t ram_size, int initrd_size,
void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename,
const char *kernel_cmdline, const char *initrd_filename,
int board_id)
int board_id, target_phys_addr_t loader_start)
{
int kernel_size;
int initrd_size;
......@@ -98,6 +99,7 @@ void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename,
env->kernel_cmdline = kernel_cmdline;
env->initrd_filename = initrd_filename;
env->board_id = board_id;
env->loader_start = loader_start;
qemu_register_reset(main_cpu_reset, env);
}
/* Assume that raw images are linux kernels, and ELF images are not. */
......@@ -109,7 +111,7 @@ void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename,
if (kernel_size < 0) {
kernel_size = load_image(kernel_filename,
phys_ram_base + KERNEL_LOAD_ADDR);
entry = KERNEL_LOAD_ADDR;
entry = loader_start + KERNEL_LOAD_ADDR;
is_linux = 1;
}
if (kernel_size < 0) {
......@@ -134,11 +136,10 @@ void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename,
}
bootloader[1] |= board_id & 0xff;
bootloader[2] |= (board_id >> 8) & 0xff;
bootloader[5] = KERNEL_ARGS_ADDR;
bootloader[5] = loader_start + KERNEL_ARGS_ADDR;
bootloader[6] = entry;
for (n = 0; n < sizeof(bootloader) / 4; n++)
stl_raw(phys_ram_base + (n * 4), bootloader[n]);
set_kernel_args(ram_size, initrd_size, kernel_cmdline);
set_kernel_args(ram_size, initrd_size, kernel_cmdline, loader_start);
}
}
......@@ -508,7 +508,7 @@ static void integratorcp_init(int ram_size, int vga_ram_size, int boot_device,
pl110_init(ds, 0xc0000000, pic[22], 0);
arm_load_kernel(env, ram_size, kernel_filename, kernel_cmdline,
initrd_filename, 0x113);
initrd_filename, 0x113, 0x0);
}
QEMUMachine integratorcp_machine = {
......
......@@ -131,7 +131,7 @@ static void realview_init(int ram_size, int vga_ram_size, int boot_device,
/* 0x6c000000 PCI mem 2. */
arm_load_kernel(env, ram_size, kernel_filename, kernel_cmdline,
initrd_filename, 0x33b);
initrd_filename, 0x33b, 0x0);
}
QEMUMachine realview_machine = {
......
......@@ -1035,7 +1035,7 @@ static void spitz_common_init(int ram_size, int vga_ram_size,
cpu->env->regs[15] = PXA2XX_RAM_BASE;
arm_load_kernel(cpu->env, ram_size, kernel_filename, kernel_cmdline,
initrd_filename, arm_id);
initrd_filename, arm_id, PXA2XX_RAM_BASE);
sl_bootparam_write(SL_PXA_PARAM_BASE - PXA2XX_RAM_BASE);
}
......
......@@ -260,7 +260,7 @@ static void versatile_init(int ram_size, int vga_ram_size, int boot_device,
/* 0x101f4000 SSPI. */
arm_load_kernel(env, ram_size, kernel_filename, kernel_cmdline,
initrd_filename, board_id);
initrd_filename, board_id, 0x0);
}
static void vpb_init(int ram_size, int vga_ram_size, int boot_device,
......
......@@ -144,12 +144,13 @@ typedef struct CPUARMState {
CPU_COMMON
/* These fields after the common ones so thes are preserved on reset. */
/* These fields after the common ones so they are preserved on reset. */
int ram_size;
const char *kernel_filename;
const char *kernel_cmdline;
const char *initrd_filename;
int board_id;
target_phys_addr_t loader_start;
} CPUARMState;
CPUARMState *cpu_arm_init(void);
......
......@@ -1450,7 +1450,7 @@ qemu_irq *arm_gic_init(uint32_t base, qemu_irq parent_irq);
void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename,
const char *kernel_cmdline, const char *initrd_filename,
int board_id);
int board_id, target_phys_addr_t loader_start);
/* sh7750.c */
struct SH7750State;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment