Commit 7ffab4d78cdc202fc4ef7f9cb6677756b5c8b3a1
1 parent
088ab16c
Use qemu_ram_alloc.
Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7052 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
4 changed files
with
15 additions
and
9 deletions
hw/arm-misc.h
| @@ -27,6 +27,7 @@ struct arm_boot_info { | @@ -27,6 +27,7 @@ struct arm_boot_info { | ||
| 27 | const char *kernel_cmdline; | 27 | const char *kernel_cmdline; |
| 28 | const char *initrd_filename; | 28 | const char *initrd_filename; |
| 29 | target_phys_addr_t loader_start; | 29 | target_phys_addr_t loader_start; |
| 30 | + target_phys_addr_t smp_loader_start; | ||
| 30 | int nb_cpus; | 31 | int nb_cpus; |
| 31 | int board_id; | 32 | int board_id; |
| 32 | int (*atag_board)(struct arm_boot_info *info, void *p); | 33 | int (*atag_board)(struct arm_boot_info *info, void *p); |
hw/integratorcp.c
| @@ -457,7 +457,7 @@ static void integratorcp_init(ram_addr_t ram_size, int vga_ram_size, | @@ -457,7 +457,7 @@ static void integratorcp_init(ram_addr_t ram_size, int vga_ram_size, | ||
| 457 | const char *initrd_filename, const char *cpu_model) | 457 | const char *initrd_filename, const char *cpu_model) |
| 458 | { | 458 | { |
| 459 | CPUState *env; | 459 | CPUState *env; |
| 460 | - uint32_t ram_offset; | 460 | + ram_addr_t ram_offset; |
| 461 | qemu_irq *pic; | 461 | qemu_irq *pic; |
| 462 | qemu_irq *cpu_pic; | 462 | qemu_irq *cpu_pic; |
| 463 | int sd; | 463 | int sd; |
hw/realview.c
| @@ -29,6 +29,7 @@ static void realview_init(ram_addr_t ram_size, int vga_ram_size, | @@ -29,6 +29,7 @@ static void realview_init(ram_addr_t ram_size, int vga_ram_size, | ||
| 29 | const char *initrd_filename, const char *cpu_model) | 29 | const char *initrd_filename, const char *cpu_model) |
| 30 | { | 30 | { |
| 31 | CPUState *env; | 31 | CPUState *env; |
| 32 | + ram_addr_t ram_offset; | ||
| 32 | qemu_irq *pic; | 33 | qemu_irq *pic; |
| 33 | void *scsi_hba; | 34 | void *scsi_hba; |
| 34 | PCIBus *pci_bus; | 35 | PCIBus *pci_bus; |
| @@ -64,9 +65,10 @@ static void realview_init(ram_addr_t ram_size, int vga_ram_size, | @@ -64,9 +65,10 @@ static void realview_init(ram_addr_t ram_size, int vga_ram_size, | ||
| 64 | } | 65 | } |
| 65 | } | 66 | } |
| 66 | 67 | ||
| 68 | + ram_offset = qemu_ram_alloc(ram_size); | ||
| 67 | /* ??? RAM should repeat to fill physical memory space. */ | 69 | /* ??? RAM should repeat to fill physical memory space. */ |
| 68 | /* SDRAM at address zero. */ | 70 | /* SDRAM at address zero. */ |
| 69 | - cpu_register_physical_memory(0, ram_size, IO_MEM_RAM); | 71 | + cpu_register_physical_memory(0, ram_size, ram_offset | IO_MEM_RAM); |
| 70 | 72 | ||
| 71 | arm_sysctl_init(0x10000000, 0xc1400400); | 73 | arm_sysctl_init(0x10000000, 0xc1400400); |
| 72 | 74 | ||
| @@ -182,18 +184,19 @@ static void realview_init(ram_addr_t ram_size, int vga_ram_size, | @@ -182,18 +184,19 @@ static void realview_init(ram_addr_t ram_size, int vga_ram_size, | ||
| 182 | /* 0x68000000 PCI mem 1. */ | 184 | /* 0x68000000 PCI mem 1. */ |
| 183 | /* 0x6c000000 PCI mem 2. */ | 185 | /* 0x6c000000 PCI mem 2. */ |
| 184 | 186 | ||
| 187 | + /* ??? Hack to map an additional page of ram for the secondary CPU | ||
| 188 | + startup code. I guess this works on real hardware because the | ||
| 189 | + BootROM happens to be in ROM/flash or in memory that isn't clobbered | ||
| 190 | + until after Linux boots the secondary CPUs. */ | ||
| 191 | + ram_offset = qemu_ram_alloc(0x1000); | ||
| 192 | + cpu_register_physical_memory(0x80000000, 0x1000, ram_offset | IO_MEM_RAM); | ||
| 193 | + | ||
| 185 | realview_binfo.ram_size = ram_size; | 194 | realview_binfo.ram_size = ram_size; |
| 186 | realview_binfo.kernel_filename = kernel_filename; | 195 | realview_binfo.kernel_filename = kernel_filename; |
| 187 | realview_binfo.kernel_cmdline = kernel_cmdline; | 196 | realview_binfo.kernel_cmdline = kernel_cmdline; |
| 188 | realview_binfo.initrd_filename = initrd_filename; | 197 | realview_binfo.initrd_filename = initrd_filename; |
| 189 | realview_binfo.nb_cpus = ncpu; | 198 | realview_binfo.nb_cpus = ncpu; |
| 190 | arm_load_kernel(first_cpu, &realview_binfo); | 199 | arm_load_kernel(first_cpu, &realview_binfo); |
| 191 | - | ||
| 192 | - /* ??? Hack to map an additional page of ram for the secondary CPU | ||
| 193 | - startup code. I guess this works on real hardware because the | ||
| 194 | - BootROM happens to be in ROM/flash or in memory that isn't clobbered | ||
| 195 | - until after Linux boots the secondary CPUs. */ | ||
| 196 | - cpu_register_physical_memory(0x80000000, 0x1000, IO_MEM_RAM + ram_size); | ||
| 197 | } | 200 | } |
| 198 | 201 | ||
| 199 | QEMUMachine realview_machine = { | 202 | QEMUMachine realview_machine = { |
hw/versatilepb.c
| @@ -160,6 +160,7 @@ static void versatile_init(ram_addr_t ram_size, int vga_ram_size, | @@ -160,6 +160,7 @@ static void versatile_init(ram_addr_t ram_size, int vga_ram_size, | ||
| 160 | int board_id) | 160 | int board_id) |
| 161 | { | 161 | { |
| 162 | CPUState *env; | 162 | CPUState *env; |
| 163 | + ram_addr_t ram_offset; | ||
| 163 | qemu_irq *pic; | 164 | qemu_irq *pic; |
| 164 | qemu_irq *sic; | 165 | qemu_irq *sic; |
| 165 | void *scsi_hba; | 166 | void *scsi_hba; |
| @@ -176,9 +177,10 @@ static void versatile_init(ram_addr_t ram_size, int vga_ram_size, | @@ -176,9 +177,10 @@ static void versatile_init(ram_addr_t ram_size, int vga_ram_size, | ||
| 176 | fprintf(stderr, "Unable to find CPU definition\n"); | 177 | fprintf(stderr, "Unable to find CPU definition\n"); |
| 177 | exit(1); | 178 | exit(1); |
| 178 | } | 179 | } |
| 180 | + ram_offset = qemu_ram_alloc(ram_size); | ||
| 179 | /* ??? RAM should repeat to fill physical memory space. */ | 181 | /* ??? RAM should repeat to fill physical memory space. */ |
| 180 | /* SDRAM at address zero. */ | 182 | /* SDRAM at address zero. */ |
| 181 | - cpu_register_physical_memory(0, ram_size, IO_MEM_RAM); | 183 | + cpu_register_physical_memory(0, ram_size, ram_offset | IO_MEM_RAM); |
| 182 | 184 | ||
| 183 | arm_sysctl_init(0x10000000, 0x41007004); | 185 | arm_sysctl_init(0x10000000, 0x41007004); |
| 184 | pic = arm_pic_init_cpu(env); | 186 | pic = arm_pic_init_cpu(env); |