mirror of https://gitee.com/openkylin/qemu.git
Use qemu_ram_alloc
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6520 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
f586ce09e2
commit
864c136a93
|
@ -35,6 +35,7 @@
|
||||||
#include "escc.h"
|
#include "escc.h"
|
||||||
|
|
||||||
#define MAX_IDE_BUS 2
|
#define MAX_IDE_BUS 2
|
||||||
|
#define VGA_BIOS_SIZE 65536
|
||||||
|
|
||||||
/* UniN device */
|
/* UniN device */
|
||||||
static void unin_writel (void *opaque, target_phys_addr_t addr, uint32_t value)
|
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,
|
||||||
qemu_irq *pic, **openpic_irqs;
|
qemu_irq *pic, **openpic_irqs;
|
||||||
int unin_memory;
|
int unin_memory;
|
||||||
int linux_boot, i;
|
int linux_boot, i;
|
||||||
unsigned long bios_offset, vga_bios_offset;
|
ram_addr_t ram_offset, vga_ram_offset, bios_offset, vga_bios_offset;
|
||||||
uint32_t kernel_base, kernel_size, initrd_base, initrd_size;
|
uint32_t kernel_base, kernel_size, initrd_base, initrd_size;
|
||||||
PCIBus *pci_bus;
|
PCIBus *pci_bus;
|
||||||
nvram_t nvram;
|
nvram_t nvram;
|
||||||
|
@ -117,10 +118,14 @@ static void ppc_core99_init (ram_addr_t ram_size, int vga_ram_size,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocate RAM */
|
/* allocate RAM */
|
||||||
cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
|
ram_offset = qemu_ram_alloc(ram_size);
|
||||||
|
cpu_register_physical_memory(0, ram_size, ram_offset);
|
||||||
|
|
||||||
|
/* allocate VGA RAM */
|
||||||
|
vga_ram_offset = qemu_ram_alloc(vga_ram_size);
|
||||||
|
|
||||||
/* allocate and load BIOS */
|
/* allocate and load BIOS */
|
||||||
bios_offset = ram_size + vga_ram_size;
|
bios_offset = qemu_ram_alloc(BIOS_SIZE);
|
||||||
if (bios_name == NULL)
|
if (bios_name == NULL)
|
||||||
bios_name = BIOS_FILENAME;
|
bios_name = BIOS_FILENAME;
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
|
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,
|
||||||
bios_size, bios_offset | IO_MEM_ROM);
|
bios_size, bios_offset | IO_MEM_ROM);
|
||||||
|
|
||||||
/* allocate and load VGA BIOS */
|
/* allocate and load VGA BIOS */
|
||||||
vga_bios_offset = bios_offset + bios_size;
|
vga_bios_offset = qemu_ram_alloc(VGA_BIOS_SIZE);
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME);
|
snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME);
|
||||||
vga_bios_size = load_image(buf, phys_ram_base + vga_bios_offset + 8);
|
vga_bios_size = load_image(buf, phys_ram_base + vga_bios_offset + 8);
|
||||||
if (vga_bios_size < 0) {
|
if (vga_bios_size < 0) {
|
||||||
|
@ -156,7 +161,6 @@ static void ppc_core99_init (ram_addr_t ram_size, int vga_ram_size,
|
||||||
vga_bios_size);
|
vga_bios_size);
|
||||||
vga_bios_size += 8;
|
vga_bios_size += 8;
|
||||||
}
|
}
|
||||||
vga_bios_size = (vga_bios_size + 0xfff) & ~0xfff;
|
|
||||||
|
|
||||||
if (linux_boot) {
|
if (linux_boot) {
|
||||||
kernel_base = KERNEL_LOAD_ADDR;
|
kernel_base = KERNEL_LOAD_ADDR;
|
||||||
|
@ -337,6 +341,6 @@ QEMUMachine core99_machine = {
|
||||||
.name = "mac99",
|
.name = "mac99",
|
||||||
.desc = "Mac99 based PowerMAC",
|
.desc = "Mac99 based PowerMAC",
|
||||||
.init = ppc_core99_init,
|
.init = ppc_core99_init,
|
||||||
.ram_require = BIOS_SIZE + VGA_RAM_SIZE,
|
.ram_require = BIOS_SIZE + VGA_BIOS_SIZE + VGA_RAM_SIZE,
|
||||||
.max_cpus = MAX_CPUS,
|
.max_cpus = MAX_CPUS,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue