Commit 864c136a933f18bbf78609e3e43e75fde0923bba

Authored by blueswir1
1 parent f586ce09

Use qemu_ram_alloc

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6520 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 10 additions and 6 deletions
hw/ppc_chrp.c
... ... @@ -35,6 +35,7 @@
35 35 #include "escc.h"
36 36  
37 37 #define MAX_IDE_BUS 2
  38 +#define VGA_BIOS_SIZE 65536
38 39  
39 40 /* UniN device */
40 41 static void unin_writel (void *opaque, target_phys_addr_t addr, uint32_t value)
... ... @@ -71,7 +72,7 @@ static void ppc_core99_init (ram_addr_t ram_size, int vga_ram_size,
71 72 qemu_irq *pic, **openpic_irqs;
72 73 int unin_memory;
73 74 int linux_boot, i;
74   - unsigned long bios_offset, vga_bios_offset;
  75 + ram_addr_t ram_offset, vga_ram_offset, bios_offset, vga_bios_offset;
75 76 uint32_t kernel_base, kernel_size, initrd_base, initrd_size;
76 77 PCIBus *pci_bus;
77 78 nvram_t nvram;
... ... @@ -117,10 +118,14 @@ static void ppc_core99_init (ram_addr_t ram_size, int vga_ram_size,
117 118 }
118 119  
119 120 /* allocate RAM */
120   - cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
  121 + ram_offset = qemu_ram_alloc(ram_size);
  122 + cpu_register_physical_memory(0, ram_size, ram_offset);
  123 +
  124 + /* allocate VGA RAM */
  125 + vga_ram_offset = qemu_ram_alloc(vga_ram_size);
121 126  
122 127 /* allocate and load BIOS */
123   - bios_offset = ram_size + vga_ram_size;
  128 + bios_offset = qemu_ram_alloc(BIOS_SIZE);
124 129 if (bios_name == NULL)
125 130 bios_name = BIOS_FILENAME;
126 131 snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
... ... @@ -138,7 +143,7 @@ static void ppc_core99_init (ram_addr_t ram_size, int vga_ram_size,
138 143 bios_size, bios_offset | IO_MEM_ROM);
139 144  
140 145 /* allocate and load VGA BIOS */
141   - vga_bios_offset = bios_offset + bios_size;
  146 + vga_bios_offset = qemu_ram_alloc(VGA_BIOS_SIZE);
142 147 snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME);
143 148 vga_bios_size = load_image(buf, phys_ram_base + vga_bios_offset + 8);
144 149 if (vga_bios_size < 0) {
... ... @@ -156,7 +161,6 @@ static void ppc_core99_init (ram_addr_t ram_size, int vga_ram_size,
156 161 vga_bios_size);
157 162 vga_bios_size += 8;
158 163 }
159   - vga_bios_size = (vga_bios_size + 0xfff) & ~0xfff;
160 164  
161 165 if (linux_boot) {
162 166 kernel_base = KERNEL_LOAD_ADDR;
... ... @@ -337,6 +341,6 @@ QEMUMachine core99_machine = {
337 341 .name = "mac99",
338 342 .desc = "Mac99 based PowerMAC",
339 343 .init = ppc_core99_init,
340   - .ram_require = BIOS_SIZE + VGA_RAM_SIZE,
  344 + .ram_require = BIOS_SIZE + VGA_BIOS_SIZE + VGA_RAM_SIZE,
341 345 .max_cpus = MAX_CPUS,
342 346 };
... ...