Commit 9d55199763d4067158d6c556e78312f7d007d914
1 parent
b00052e4
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
Showing
7 changed files
with
17 additions
and
15 deletions
hw/arm_boot.c
... | ... | @@ -32,11 +32,12 @@ static void main_cpu_reset(void *opaque) |
32 | 32 | if (env->kernel_filename) |
33 | 33 | arm_load_kernel(env, env->ram_size, env->kernel_filename, |
34 | 34 | env->kernel_cmdline, env->initrd_filename, |
35 | - env->board_id); | |
35 | + env->board_id, env->loader_start); | |
36 | 36 | } |
37 | 37 | |
38 | 38 | static void set_kernel_args(uint32_t ram_size, int initrd_size, |
39 | - const char *kernel_cmdline) | |
39 | + const char *kernel_cmdline, | |
40 | + target_phys_addr_t loader_start) | |
40 | 41 | { |
41 | 42 | uint32_t *p; |
42 | 43 | |
... | ... | @@ -51,12 +52,12 @@ static void set_kernel_args(uint32_t ram_size, int initrd_size, |
51 | 52 | stl_raw(p++, 4); |
52 | 53 | stl_raw(p++, 0x54410002); |
53 | 54 | stl_raw(p++, ram_size); |
54 | - stl_raw(p++, 0); | |
55 | + stl_raw(p++, loader_start); | |
55 | 56 | if (initrd_size) { |
56 | 57 | /* ATAG_INITRD2 */ |
57 | 58 | stl_raw(p++, 4); |
58 | 59 | stl_raw(p++, 0x54420005); |
59 | - stl_raw(p++, INITRD_LOAD_ADDR); | |
60 | + stl_raw(p++, loader_start + INITRD_LOAD_ADDR); | |
60 | 61 | stl_raw(p++, initrd_size); |
61 | 62 | } |
62 | 63 | if (kernel_cmdline && *kernel_cmdline) { |
... | ... | @@ -77,7 +78,7 @@ static void set_kernel_args(uint32_t ram_size, int initrd_size, |
77 | 78 | |
78 | 79 | void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename, |
79 | 80 | const char *kernel_cmdline, const char *initrd_filename, |
80 | - int board_id) | |
81 | + int board_id, target_phys_addr_t loader_start) | |
81 | 82 | { |
82 | 83 | int kernel_size; |
83 | 84 | int initrd_size; |
... | ... | @@ -98,6 +99,7 @@ void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename, |
98 | 99 | env->kernel_cmdline = kernel_cmdline; |
99 | 100 | env->initrd_filename = initrd_filename; |
100 | 101 | env->board_id = board_id; |
102 | + env->loader_start = loader_start; | |
101 | 103 | qemu_register_reset(main_cpu_reset, env); |
102 | 104 | } |
103 | 105 | /* 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, |
109 | 111 | if (kernel_size < 0) { |
110 | 112 | kernel_size = load_image(kernel_filename, |
111 | 113 | phys_ram_base + KERNEL_LOAD_ADDR); |
112 | - entry = KERNEL_LOAD_ADDR; | |
114 | + entry = loader_start + KERNEL_LOAD_ADDR; | |
113 | 115 | is_linux = 1; |
114 | 116 | } |
115 | 117 | if (kernel_size < 0) { |
... | ... | @@ -134,11 +136,10 @@ void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename, |
134 | 136 | } |
135 | 137 | bootloader[1] |= board_id & 0xff; |
136 | 138 | bootloader[2] |= (board_id >> 8) & 0xff; |
137 | - bootloader[5] = KERNEL_ARGS_ADDR; | |
139 | + bootloader[5] = loader_start + KERNEL_ARGS_ADDR; | |
138 | 140 | bootloader[6] = entry; |
139 | 141 | for (n = 0; n < sizeof(bootloader) / 4; n++) |
140 | 142 | stl_raw(phys_ram_base + (n * 4), bootloader[n]); |
141 | - set_kernel_args(ram_size, initrd_size, kernel_cmdline); | |
143 | + set_kernel_args(ram_size, initrd_size, kernel_cmdline, loader_start); | |
142 | 144 | } |
143 | 145 | } |
144 | - | ... | ... |
hw/integratorcp.c
... | ... | @@ -508,7 +508,7 @@ static void integratorcp_init(int ram_size, int vga_ram_size, int boot_device, |
508 | 508 | pl110_init(ds, 0xc0000000, pic[22], 0); |
509 | 509 | |
510 | 510 | arm_load_kernel(env, ram_size, kernel_filename, kernel_cmdline, |
511 | - initrd_filename, 0x113); | |
511 | + initrd_filename, 0x113, 0x0); | |
512 | 512 | } |
513 | 513 | |
514 | 514 | QEMUMachine integratorcp_machine = { | ... | ... |
hw/realview.c
... | ... | @@ -131,7 +131,7 @@ static void realview_init(int ram_size, int vga_ram_size, int boot_device, |
131 | 131 | /* 0x6c000000 PCI mem 2. */ |
132 | 132 | |
133 | 133 | arm_load_kernel(env, ram_size, kernel_filename, kernel_cmdline, |
134 | - initrd_filename, 0x33b); | |
134 | + initrd_filename, 0x33b, 0x0); | |
135 | 135 | } |
136 | 136 | |
137 | 137 | QEMUMachine realview_machine = { | ... | ... |
hw/spitz.c
... | ... | @@ -1035,7 +1035,7 @@ static void spitz_common_init(int ram_size, int vga_ram_size, |
1035 | 1035 | cpu->env->regs[15] = PXA2XX_RAM_BASE; |
1036 | 1036 | |
1037 | 1037 | arm_load_kernel(cpu->env, ram_size, kernel_filename, kernel_cmdline, |
1038 | - initrd_filename, arm_id); | |
1038 | + initrd_filename, arm_id, PXA2XX_RAM_BASE); | |
1039 | 1039 | sl_bootparam_write(SL_PXA_PARAM_BASE - PXA2XX_RAM_BASE); |
1040 | 1040 | } |
1041 | 1041 | ... | ... |
hw/versatilepb.c
... | ... | @@ -260,7 +260,7 @@ static void versatile_init(int ram_size, int vga_ram_size, int boot_device, |
260 | 260 | /* 0x101f4000 SSPI. */ |
261 | 261 | |
262 | 262 | arm_load_kernel(env, ram_size, kernel_filename, kernel_cmdline, |
263 | - initrd_filename, board_id); | |
263 | + initrd_filename, board_id, 0x0); | |
264 | 264 | } |
265 | 265 | |
266 | 266 | static void vpb_init(int ram_size, int vga_ram_size, int boot_device, | ... | ... |
target-arm/cpu.h
... | ... | @@ -144,12 +144,13 @@ typedef struct CPUARMState { |
144 | 144 | |
145 | 145 | CPU_COMMON |
146 | 146 | |
147 | - /* These fields after the common ones so thes are preserved on reset. */ | |
147 | + /* These fields after the common ones so they are preserved on reset. */ | |
148 | 148 | int ram_size; |
149 | 149 | const char *kernel_filename; |
150 | 150 | const char *kernel_cmdline; |
151 | 151 | const char *initrd_filename; |
152 | 152 | int board_id; |
153 | + target_phys_addr_t loader_start; | |
153 | 154 | } CPUARMState; |
154 | 155 | |
155 | 156 | CPUARMState *cpu_arm_init(void); | ... | ... |
vl.h
... | ... | @@ -1450,7 +1450,7 @@ qemu_irq *arm_gic_init(uint32_t base, qemu_irq parent_irq); |
1450 | 1450 | |
1451 | 1451 | void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename, |
1452 | 1452 | const char *kernel_cmdline, const char *initrd_filename, |
1453 | - int board_id); | |
1453 | + int board_id, target_phys_addr_t loader_start); | |
1454 | 1454 | |
1455 | 1455 | /* sh7750.c */ |
1456 | 1456 | struct SH7750State; | ... | ... |